On Wed, Sep 28, 2011 at 8:31 AM, Dmitry Chestnykh
<dmi...@codingrobots.com>wrote:

> > The zlib compressor adds a timestamp at the beginning.  If you gunzip the
> tarballs, you'll find that they are identical.
>
>
> If I read gzip specs correctly, it allows zero timestamp:
>
> > MTIME (Modification TIME)
> > This gives the most recent modification time of the original file being
> compressed. The time is in Unix format, i.e., seconds since 00:00:00 GMT,
> > Jan. 1, 1970. (Note that this may cause problems for MS-DOS and other
> systems that use local rather than Universal time.) If the compressed data
> did not come from a file, MTIME is set to the time at which compression
> started. MTIME = 0 means no time stamp is available.
>
> (http://www.gzip.org/zlib/rfc-gzip.html#header-trailer)
>
> I tried to gunzip such file, and it correctly set today's time, not 1970,
> for the unzipped file, when the field is 0.
> SHA-1 sums for .tar.gz downloaded at different times then matched.
>
> So maybe:
>
>
I already checked in a change that sets the timestamp based on the check-in
time.  But I like your patch better (since it is simpler).


> Index: src/gzip.c
> ===================================================================
> --- src/gzip.c
> +++ src/gzip.c
> @@ -49,19 +49,17 @@
>  /*
>  ** Begin constructing a gzip file.
>  */
>  void gzip_begin(void){
>   char aHdr[10];
> -  sqlite3_int64 now;
>   assert( gzip.eState==0 );
>   blob_zero(&gzip.out);
>   aHdr[0] = 0x1f;
>   aHdr[1] = 0x8b;
>   aHdr[2] = 8;
>   aHdr[3] = 0;
> -  now = db_int64(0, "SELECT (julianday('now') - 2440587.5)*86400.0");
> -  put32(&aHdr[4], now&0xffffffff);
> +  put32(&aHdr[4], 0);
>   aHdr[8] = 2;
>   aHdr[9] = 255;
>   blob_append(&gzip.out, aHdr, 10);
>   gzip.iCRC = 0;
>   gzip.eState = 1;
>
> --
> Dmitry Chestnykh
>
> _______________________________________________
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to