Re: Debdiff project announcement.
On Sun, Feb 06, 2000 at 09:48:01AM -0500, Tom Rothamel wrote:
> On Sat, Feb 05, 2000 at 11:17:16AM -0500, Joey Hess wrote:
> > Tom Rothamel wrote:
> > > Information on the order of elements within control.tar and data.tar
> > > will be preserved in the debdiff. This should lead to identical output
> > > to the original when these files are compressed with gzip.
> >
> > It won't, because .gz files have timestamps in them that change when they
> > are repacked. Try and see..
>
> Grr... you're right, of course. I'll need to figure out a way around
> this one. (Probably originally by coming out with a tool that can
> checksum the individual members of a deb, ignoring differences in the
> gzip compression.)
Sorry about the late-ish reply, but you can fix this problem by just copying
the gzip header across (its just really a few bytes).
The attached small C prog calculates the length of a gzip header and the
compression factor used (roughly). This can be used to reconstruct a gzip
with the same md5sum by copying the header across.
--
Tom <tom@debian.org>
This restaurant was advertising breakfast any time. So I ordered
french toast in the renaissance.
- Steven Wright, comedian
#include <stdio.h>
int hdr_len = 0;
int byte (void)
{
hdr_len++;
return getchar ();
}
main()
{
int flags;
int i;
// Reads the GZIP file on stdin and returns the length of the header
i = byte(); i |= (byte () << 8);
if (i != 0x8b1f) { printf ("0\n"); exit (1); }
byte(); // Skip method
flags = byte();
byte();byte();byte();byte(); // Skip timestamp
i = byte(); // Extra flags
switch (i)
{
case 0:
printf ("-6\n");
break;
case 2:
printf ("-9\n");
break;
case 4:
printf ("-1\n");
break;
default:
printf ("%d\n", i);
}
byte(); // Skip OS type
if (flags & 0x04)
{
i = byte(); i |= (byte()<<8);
for (;i>0;i--)
byte();
} // Skip extra fields
if (flags & 0x08)
while (byte() != 0) ; // Skip orig name
if (flags & 0x10)
while (byte() != 0) ; // Skip comment
byte();byte();byte();byte(); // CRC
byte();byte(); // Size
printf ("%d\n", hdr_len);
exit (0);
}
Reply to: