Subject: Re: 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 22:32:45
On Tue, Dec 07, 2004 at 11:21:00PM +0000, James Chacon wrote:
> >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.
I meant to say it'll be 0 when it should be the file's mtime.
James