gzip 1.4-1 creates corrupt archive

Peter murrxx3@arcor.de
Sat Aug 25 11:18:00 GMT 2012


To trim a log file on my windows box I tried the lines below in a bash
script. (my bash is 4.1.10(4))
 
cat "$LOG" | gzip > "$LOG.old.gz"
> "$LOG"
 
The resulting archive was corrupt.
Directly compressing like  gzip "$LOG"  works OK but is not suitable in my
case as the logging service constantly writes to the file
I also tried the -c and -a options of gzip but did not succeed.
>From my investigation I suspect there is something with textmode and binmode
but I do not fully understand how to deal with it.
 
What I finally found is that bzip2 works in the above line.
So my solution is to use bzip2 instead of gzip.
 
So my question is:  why can't  gzip  do it automatically if bzip2 can?
 
 


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list