This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in gzip's stdout handling

On Fri, 14 Nov 2003, Thomas Hammer wrote:

> Hi.
> I run the latest version of cygwin, with gzip, on WindowsXP SP1 and have a
> problem with gzip.

Please see <> for guidelines on how to
report Cygwin problems.

> The command
>   $ cat binaryfile.bin | gzip -c > bin.gz
> produces an invalid .gz file:
>   $ gunzip bin.gz
>   gunzip: bin.gz: invalid compressed data--crc error
>   gunzip: bin.gz: invalid compressed data--length error
> If I do
>   gzip binaryfile.bin
> everything works as expected - i.e. the resulting .gz file is valid.
> If I do this instead:
>   cat binaryfile.bin > acopy.bin
> The two .bin files are identical.
> My gzip version:
>   $ gzip --version
>   gzip 1.3.5
>   (2002-09-30)
>   Copyright 2002 Free Software Foundation
>   Copyright 1992-1993 Jean-loup Gailly
>   This program comes with ABSOLUTELY NO WARRANTY.
>   You may redistribute copies of this program
>   under the terms of the GNU General Public License.
>   For more information about these matters, see the file named COPYING.
>   Compilation options:
>   Written by Jean-loup Gailly.
> My conclusion is that gzip's handling of stdout is broken in some way.

I bet you have a text mount.  Please *attach* the output of "cygcheck
-svr", as per <> - this will confirm the

> The reason I report this problem, instead of just avoiding it by not using
> the -c option for gzip, is that I discovered the problem while running make
> dist on a created by automake. And it's automake that creates
> the gzip command line. I'll send a patch to the automake people and ask them
> to fix this - but since it's really gzip that is broken, I think it should
> be fixed here too.
> I think you could fix this by setting the mode for the filehandle for stdout
> to O_BINARY, i.e. something like this:
> #if defined (_WIN32)
>     setmode(FileHandle, O_BINARY);      /* Make sure it is in binary mode. */
> #endif

FYI, Cygwin doesn't define _WIN32.  Besides, the above is not a proper

> It would be nice if you could look into it.
> Best Regards,
> Thomas Hammer

      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]