Subject: bin/28581: gzip not compat w. RFC/GNU gzip on mtime values in header
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: James Chacon <jmc@netbsd.org>
List: netbsd-bugs
Date: 12/07/2004 23:21:00
>Number: 28581
>Category: bin
>Synopsis: gzip not compat w. RFC/GNU gzip on mtime values in header
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Dec 07 23:21:00 +0000 2004
>Originator: James Chacon
>Release: NetBSD 2.0G
>Organization:
>Environment:
System: NetBSD quix 2.0G NetBSD 2.0G (QUIX) #3: Tue Aug 17 23:48:17 CDT 2004 roo
t@quix:/local0/src/sys/arch/i386/compile/QUIX i386
Architecture: i386
Machine: i386
>Description:
RFC 1952 for gzip states the mtime value in the header comes from the mtime
of the file being compressed.
If the data doesn't come from a file it should be set to the current time.
0 is only used if no time stamp is available (I'm guessing for systems which
cannot determine current time?).
In any case, GNU gzip honors all of these by the following:
1. For files passed on the command line, stat the file and use st_mtime
2. For data coming through stdin, fstat stdin and if IS_REG use st_mtime
3. For anything else use time(2) (i.e. pipline)
Ours fails #2 and #3 by assuming that anything redirecting stdout should put
mtime = 0 in the header.
>How-To-Repeat:
gzip file > file.gz
and hexdump and look at the mtime. It'll be the current time and not the
mtime from the file.
>Fix:
Make handle_stdout take a time value in gzip.c