This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Bug in gzip's stdout handling
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: Thomas Hammer <thammer at sim dot no>
- Cc: support at gzip dot org, cygwin at cygwin dot com
- Date: Fri, 14 Nov 2003 10:28:05 -0500 (EST)
- Subject: Re: Bug in gzip's stdout handling
- References: <GPEILLHCKKGPIGFLPKIOMEJLENAA.thammer@sim.no>
- Reply-to: cygwin at cygwin dot com
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 <http://cygwin.com/problems.html> 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:
> DIRENT UTIME STDC_HEADERS HAVE_UNISTD_H HAVE_MEMORY_H HAVE_STRING_H HAVE_LSTAT ASMV
> 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 <http://cygwin.com/problems.html> - this will confirm the
guess.
> 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 Makefile.in 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
patch.
Igor
> It would be nice if you could look into it.
>
> Best Regards,
> Thomas Hammer
> hammer@sim.no
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,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: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/