<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 25, 2022 at 5:49 PM enh <<a href="mailto:enh@google.com">enh@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">the kernel folks build in an even more restricted environment than AOSP. so although they have bzip2 and gzip, they don't have bzcat and gzcat.<div><br></div><div>from a bad run (with no bzcat/gzcat):<br><br>~/aosp-master-with-phones$ /usr/bin/strace -f -e execve ./prebuilts/build-tools/linux-x86/bin/toybox tar tvf x.tar.gz <br>execve("./prebuilts/build-tools/linux-x86/bin/toybox", ["./prebuilts/build-tools/linux-x8"..., "tar", "tvf", "x.tar.gz"], 0x7ffe8acad930 /* 36 vars */) = 0<br>/usr/bin/strace: Process 640688 attached<br>[pid 640688] execve("/usr/local/google/home/enh/aosp-master-with-phones/prebuilts/build-tools/path/linux-x86/bzip2", ["bzip2", "-d"], 0x7ffd675c2a80 /* 36 vars */) = 0<br>bzip2: (stdin) is not a bzip2 file.<br>[pid 640688] +++ exited with 2 +++<br>--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=640688, si_uid=73769, si_status=2, si_utime=0, si_stime=0} ---<br>+++ exited with 0 +++</div><div> <br></div><div>from a successful run (with all the tools):<br><br>~/aosp-master-with-phones$ strace -f -e execve ./prebuilts/build-tools/linux-x86/bin/toybox tar tvf x.tar.gz <br>execve("./prebuilts/build-tools/linux-x86/bin/toybox", ["./prebuilts/build-tools/linux-x8"..., "tar", "tvf", "x.tar.gz"], 0x7ffea9535030 /* 36 vars */) = 0<br>strace: Process 640431 attached<br>[pid 640431] execve("/usr/bin/zcat", ["/usr/bin/zcat"], 0x7fffe0fd7580 /* 36 vars */) = 0<br>[pid 640431] execve("/usr/bin/gzip", ["gzip", "-cd"], 0x55f91049b290 /* 34 vars */) = 0<br>[pid 640431] +++ exited with 0 +++<br>--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=640431, si_uid=73769, si_status=0, si_utime=0, si_stime=0} ---<br>-rw-r----- enh/primarygroup         0  2022-08-25 20:53 foo<br>+++ exited with 0 +++</div><div><br>there is code to try to use $TOOL -d if the *cat tool doesn't exist (that's why we're running bzip2 at all), but it's obviously not working here :-(<br></div><div><br></div><div>it also works fine if you explicitly say 'z'.</div><div><br></div><div>so here's the setup:</div><div><br></div><div>$ touch foo<br>$ tar czf x.tar.gz foo</div><div><br></div><div>here's the failure:</div><div><br>$ tar tf x.tar.gz<br>bzip2: (stdin) is not a bzip2 file.</div><div><br></div><div>here's the success:</div><div><br>$ tar tzf /tmp/x.tar.gz<br>foo<br></div><div><br></div><div>i didn't get time today to look at this in more detail, but i do notice that there appears to be an inconsistency between the two ways we choose the appropriate tool:</div><div><br></div><div>    *archiver = FLAG(I) ? TT.I : (FLAG(z) ? "gzip" : (FLAG(J) ? "xz":"bzip2"));<br><br>      struct string_list *zcat = FLAG(I) ? 0 : find_in_path(getenv("PATH"),<br>        FLAG(j) ? "bzcat" : FLAG(J) ? "xzcat" : "zcat");<br></div><div><br></div><div>is that intentional or a bug?</div><div><br></div><div>(i'll try to have another look tomorrow, but since you seem to be nocturnal atm i thought i'd send this out now anyway :-) )</div></div></blockquote><div><br></div><div>ran out of time to investigate further today, but i did at least send you a patch to fix the build, and another to fix the tar tests on macOS again... </div></div></div>