git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] supply '-n' to gzip to produce identical tarballs

From
Fraser Tweedale <frase@frase.id.au>
Date
Apr 10, 2011, 10:13 UTC
Message-ID
<20110410101345.GD1521@bacardi.wooloowin.frase.id.au>
In-Reply-To
<m362qm4kvu.fsf@localhost.localdomain>
On Sun, Apr 10, 2011 at 12:38:32AM -0700, Jakub Narebski wrote:
Show 21 quoted lines
> Fraser Tweedale <frase@frase.id.au> writes:
> 
> > Subject: [PATCH] supply '-n' to gzip to produce identical tarballs
> >
> > Without the '-n' ('--no-name') argument, gzip includes timestamp in
> > output which results in different files.  Important systems like FreeBSD
> > ports and perhaps many others hash/checksum downloaded files to ensure
> > integrity.  For projects that do not release official archives, gitweb's
> > snapshot feature would be an excellent stand-in but for the fact that the
> > files it produces are not identical.
> > 
> > Supply '-n' to gzip to exclude timestamp from output and produce idential
> > output every time.
> > 
> > Signed-off-by: Fraser Tweedale <frase@frase.id.au>
> 
> Very good description, except subject line should denote which
> subsystem this commit affects, i.e.:
> 
>   gitweb: supply '-n' to gzip to produce identical tarballs
> 

Thank you. Do I need to amend the message and resubmit the patch? (first time submitting a patch to git; I used git send-email).

> Hmmm... gzip in gitweb's 'snapshot' action gets data compressed from
> standard input, not from filesystem.  Isn't -n / --no-name no-op then?
> Just asking...
> 

It is not no-op; I have tested to confirm this. I'm not sure whether a file name is recorded in the stdin case, or if so what it is, but the timestamp is recorded and that makes the difference.

Show 26 quoted lines
> > ---
> >  gitweb/gitweb.perl |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> > index 46186ab..2ab08da 100755
> > --- a/gitweb/gitweb.perl
> > +++ b/gitweb/gitweb.perl
> > @@ -186,7 +186,7 @@ our %known_snapshot_formats = (
> >  		'type' => 'application/x-gzip',
> >  		'suffix' => '.tar.gz',
> >  		'format' => 'tar',
> > -		'compressor' => ['gzip']},
> > +		'compressor' => ['gzip', '-n']},
> 
> Perhaps it would be more clear to use
> 
>   +		'compressor' => ['gzip', '--no-name']},
> 
> >  
> >  	'tbz2' => {
> >  		'display' => 'tar.bz2',
> > -- 
> > 1.7.4.3
> > 
> 

Definitely, if the argument is the same (or even present) on all systems. On FreeBSD and GNU both '-n' and '--no-name' are do the job, but an audit of other systems should be done to ensure they don't break. I chose '-n' as it seemed the more conservative choice.

> -- 
> Jakub Narebski
> Poland
> ShadeHawk on #git
Previous: Jakub NarebskiNext: Jakub Narebski
Message 3 of 6 in “supply '-n' to gzip to produce identical tarballs”
  1. supply '-n' to gzip to produce identical tarballsFraser Tweedale, Apr 10, 2011
  2. Jakub NarebskiApr 10, 2011
  3. Fraser TweedaleApr 10, 2011
  4. Jakub NarebskiApr 10, 2011
  5. Junio C HamanoApr 11, 2011
  6. Fraser TweedaleApr 11, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.