This is the mail archive of the cygwin 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: Problem with gzip


> -----Original Message-----
> From: cygwin-owner On Behalf Of Christopher Faylor
> Sent: 14 April 2004 15:36

> How about some *details* about how you made the suspect logs.tar.gz
> file.

  He made it by taking a valid .gz file and running it through u2d!  Or
perhaps some accident with textmode mountpoints.  Permit me to demonstrate
by turning all the CR/LF pairs back into plain LFs (although to be precise,
I should be referring to hex $0d and $0a bytes, since this file isn't an
ASCII file and those aren't actually CR and LF in the context of raw binary
data):

------->snip!<-------
dk@mace /davek> unzip test.zip
Archive:  test.zip
   creating: test/
   creating: test/logs/
  inflating: test/logs/config.log
  inflating: test/logs/my_check.log
  inflating: test/logs/my_conf.log
 extracting: test/logs.tar.gz
dk@mace /davek> cd test
dk@mace /davek/test> ls -la
total 5
drwxr-xr-x+   3 dk       Domain U        0 Apr  6 11:40 .
drwx------+  30 dk       Domain U        0 Apr 14 15:52 ..
drwxr-xr-x+   2 dk       Domain U        0 Apr  6 11:22 logs
-rw-r--r--    1 dk       Domain U     4707 Apr  6 11:37 logs.tar.gz
dk@mace /davek/test> mv logs old.logs
dk@mace /davek/test> sed -e 's/\\r\\n/\\n/g' logs.tar.gz >logs-fixed.tar.gz
dk@mace /davek/test> tar xfvz logs.tar.gz
logs/
logs/config.log
tar: Skipping to next header

gzip: stdin: invalid compressed data--crc error

gzip: stdin: invalid compressed data--length error
tar: Archive contains obsolescent base-64 headers
tar: Child returned status 1
tar: Error exit delayed from previous errors
dk@mace /davek/test> tar xfvz logs-fixed.tar.gz
logs/
logs/config.log
logs/my_check.log
logs/my_conf.log
dk@mace /davek/test> ls -la logs/
total 25
drwxr-xr-x+   2 dk       Domain U        0 Apr 14 15:53 .
drwxr-xr-x+   4 dk       Domain U        0 Apr 14 15:53 ..
-rw-r--r--    1 dk       Domain U     6872 Apr  6 11:21 config.log
-rw-r--r--    1 dk       Domain U    12183 Apr  6 11:21 my_check.log
-rw-r--r--    1 dk       Domain U     5314 Apr  6 11:21 my_conf.log
dk@mace /davek/test>
------->snip!<-------

  Note that running d2u on the file won't fix it: d2u will delete all the
$0d bytes regardless of whether they're followed by $0a or not, which isn't
what we want; there's some genuine $0d's in there.

>  The above errors seem to indicate that gzip is correctly
> detecting a damaged .gz file.

  Absolutely so.  Every $0a byte got a bogus $0d prepended to it.  No wonder
it wouldn't unpack!


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


--
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/


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