Re: Fwd: Bug#1050663: dar option --on-fly-isolate creates catalogue with broken slice_layout
Thomas <dar.support.ml-202308-Tv/[email protected]> Sat, 2 Sep 2023 10:59:28 +0200
| Newsgroups | gmane.comp.sysutils.backup.dar.support |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Aug 30, 2023 at 03:24:12PM -0500, John Goerzen wrote: > On Wed, Aug 30 2023, Denis Corbin wrote: > > >> Summary > >> ======= > >> g++ 10 works fine with optimization. > >> g++ 11 or newer work only without optimization. > >> Hope this helps. > > > > Thanks for confirming this is a gcc issue. I don't know what should be the next > > step, if someone fills a bug report to gcc Debian maintainer? > > Well, to be sure, we have a couple of possibilities: > > 1) This is a gcc bug, > > or 2) There is something in dar (or, for that matter, bzip2 or some > other library) that is relying on some sort of C/C++ undefined behavior > (UB) that the optimizer is taking in a different direction. Other > possibilities could include race conditions, etc. To find the root cause why the optimizer does something harmfull in our case is way over my head. But... I have found a workaround for dar. The appended patch works for me with dar v2.7.11 and g++ v13.2.0, v12.3.0 and v11.4.0. Means, files generated with OnFlyIsolation are readable again with default optimizations activated. It seems the optimizer does not like the used ternary operator. I tested the patch with g++ v10.4.0 and 9.3.0, too without problems but these versions are working with or without this patch anyway. Hope this helps. Tom
slice_layout.cpp-remove_ternary_operator.patch
(text/x-diff, 526 B)
diff -rupN DAR_a/src/libdar/slice_layout.cpp DAR_b/src/libdar/slice_layout.cpp
--- DAR_a/src/libdar/slice_layout.cpp 2023-09-02 09:08:49.657051708 +0200
+++ DAR_b/src/libdar/slice_layout.cpp 2023-09-02 09:11:39.240669572 +0200
@@ -54,7 +54,11 @@ namespace libdar
void slice_layout::write(generic_file & f) const
{
- char tmp = older_sar_than_v8 ? OLDER_THAN_V8 : V8;
+ char tmp = V8;
+ if(older_sar_than_v8)
+ {
+ tmp = OLDER_THAN_V8;
+ }
first_size.dump(f);
other_size.dump(f);
first_slice_header.dump(f);