Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Fri, 14 Nov 2003 10:28:05 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Thomas Hammer cc: support AT gzip DOT org, cygwin AT cygwin DOT com Subject: Re: Bug in gzip's stdout handling In-Reply-To: Message-ID: References: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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: > 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 - 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 AT sim DOT no -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT 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/