Re: Fwd: Bug#1050663: dar option --on-fly-isolate creates catalogue with broken slice_layout
Thomas <dar.support.ml-202308-Tv/[email protected]> Tue, 5 Sep 2023 21:59:42 +0200
| Newsgroups | gmane.comp.sysutils.backup.dar.support |
|---|---|
| Message-ID | <ZPeIrm/[email protected]> |
Hi Denis!
On Sun, Sep 03, 2023 at 11:00:57PM +0200, Denis Corbin wrote:
> On 03/09/2023 19:37, Rolf Gebhardt wrote:
> > I've been following the discussion here and had a look at the patch and
> > the associated code of the class 'slice_layout'.
> > I noticed one little thing:As far as I can see, the boolean member
> > variable 'older_sar_than_v8', which acts as condition in the patched
> > code, is not initialized in the constructor.
>
> Yes, you are correct, but this is not necessary (read below)
>
> >
> > I'm not familiar with the internals of DAR, so I don't know if
> > slice_layout::write can be called without first calling
> > slice_layout::read or slice_layout::clear.
>
> In the slice_layout::older_sar_than_v8 (as well as some others) are public
> and are either:
> - initialized by the caller code (sar, macro_tools, ...) before calling
> slice_layout::write() to write this to an dar backup
I don't think this is the case. I got hunting with printf and a couple
of compiler runs.
My findings (as usual with DAR v2.7.11 and g++ 13):
I dumped older_sar_than_v8 and tmp directly after the tmp ternary
operator line like so:
,---- [ slice_layout.cpp ]
| char tmp = older_sar_than_v8 ? OLDER_THAN_V8 : V8;
| printf("older_sar_than_v8: >%d<, tmp: >%d<\n", older_sar_than_v8, tmp);
`----
I expected to see
* for older_sar_than_v8: 0 or 1
* for tmp: 56 or 55
I get with dar_static --create ...:
older_sar_than_v8: >88<, tmp: >-32<
older_sar_than_v8: >88<, tmp: >-32<
I interpret 88 as not initialized and -32 as a random number.
If I initialize older_sar_than_v8 in slice_layout.hpp with true I get:
older_sar_than_v8: >1<, tmp: >55<
older_sar_than_v8: >1<, tmp: >55<
If I initialize older_sar_than_v8 in slice_layout.hpp with false I get:
older_sar_than_v8: >0<, tmp: >56<
older_sar_than_v8: >0<, tmp: >56<
I would say the default value comes trough and is not changed on the
way. With a initialized older_sar_than_v8 the ternary operator works
like a charm.
Therefore I think older_sar_than_v8 is not initialized during
dar_static --create... and the optimizer does with tmp whatever it
wants.
Fun fact:
With my patch and no initialization the compiler handles it "better". 88
is interpreted like "true" in the if-clause and we get at least
char('7'):
older_sar_than_v8: >88<, tmp: >55<
older_sar_than_v8: >88<, tmp: >55<
Hope this helps.
Tom