X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=3.8 required=5.0 tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-15.arcor-online.net 3FDDD1AB538 From: "Peter" To: Subject: gzip 1.4-1 creates corrupt archive Date: Sat, 25 Aug 2012 08:11:47 +0200 Message-ID: <98106E7FBCC84B84880593C9916C9502@AMIGIME> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 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