bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23316: gzip-1.7: gzip -l issue when piping


From: John Stanley
Subject: bug#23316: gzip-1.7: gzip -l issue when piping
Date: Tue, 19 Apr 2016 02:12:43 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0

Hi,

There is a problem with gzip-1.7 when piping output with the 'list' option. Specifically, both
    gzip -l file.gz > output
and
    gzip -l file.gz | grep -q pattern ...

produce

gzip: write error: Bad file descriptor

This issue is due to the following code (I assume to the close()):

gzip-1.7/gzip.c:670

 670     if (to_stdout
 671         && ((synchronous
 672              && (fdatasync (STDOUT_FILENO) != 0 && errno != EINVAL))
 673             || close (STDOUT_FILENO) != 0)
 674         && errno != EBADF)
 675       write_error ();

In the cases above, to_stdout=1, and synchronous=0.

The issue appears to be 'list' specific, eg,

    gzip -dc file.gz | grep -q pattern ...

looks ok.

Perhaps line 670 should be:

670     if (!list && to_stdout

or, not set to_stdout in the list case ? Not sure..

thanks,
John

Thanks,
John






reply via email to

[Prev in Thread] Current Thread [Next in Thread]