On 2021-01-11 Étienne Mollier wrote:
> Lasse Collin, on 2021-01-11 19:19:09 +0200:
> > I understand from your message that you got a different result. I
> > wonder what would explain the difference. Your results are close to
> > what I would expect with the "trap '' PIPE" patch. Are you sure you
> > used the correctly patched xzcmp for testing? Otherwise I'm
> > clueless what could explain the difference in our results.  
> 
> Oops, I forgot to pop the initial patch off the stack.  The
> `trap '' PIPE` was still present on top of the script.  >_<"
> When I rerun these tests without this on top, I see the same
> good results as you.  This explains that.

Good. :-)

I noticed that in 2012 a similar issue was fixed in xzgrep. There
SIGPIPE is detected more precisely with "kill -l $exit_status", so I
adapted the xzdiff patch to use that correctly and committed it.

The xzgrep method had a minor bug (it didn't check if the status was >=
128 indicating a signal). I also noticed another bug in xzgrep that it
used gzip -q (which converts SIGPIPE to exit status 2) and ignored exit
status 2 as SIGPIPE, which is bad because with bzip2 exit status 2
means corrupt input. These are now hopefully fixed too.

Hopefully the removal of -q won't introduce a new bug in some special
situation. One difference I noticed is that without -q bzip2 will
display a fairly long error message if input is corrupt. With -q it is
silent. I suspect the non-silent behavior is better with these scripts;
just having exit status 2 from xzdiff/xzcmp isn't enough. With gzip and
xz, -q or lack of -q makes no difference in this situation. With zstd
the -q option is required though because otherwise zstd is noisy in
normal situations.

I also added zstd support to xzdiff/xzcmp. xzgrep already had it in
xz.git.

The scripts now have a different set of bugs than before. Hopefully the
total number of bugs has not increased. :-)

Thanks!

-- 
Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode

Reply via email to