Mail Archives: djgpp/1994/07/16/06:17:27
About my problem with timestamps and djtart/x: I looked at the
djtart.c code, and I probably found the cause of the problem.
In djtart.c the following structure is defined:
>typedef struct {
> char name[100];
> char operm[8];
> char ouid[8];
> char ogid[8];
> char osize[11]; <<<---****
> char otime[12];
> char ocsum[8];
> char flags[2];
> char filler[355];
>} TARREC;
Unix man pages say the following (I checked three different Unix
systems and I got the same results):
> The header block looks like:
>
> #define TBLOCK 512
> #define NAMSIZ 100
> union hblock {
> char dummy[TBLOCK];
> struct header {
> char name[NAMSIZ];
> char mode[8];
> char uid[8];
> char gid[8];
> char size[12]; <<<---****
> char mtime[12];
> char chksum[8];
> char linkflag;
> char linkname[NAMSIZ];
> } dbuf;
> };
It seems to me that the problem is caused by the `osize' field
which should have a length of 12 instead of 11. Normally this
doesn't cause any problem because the `osize' and `otime' fields
should be blank separated, so the
> sscanf(header.otime, "%lo", &ftime);
(line 71 of djtart.c) skips an initial blank, and correctly reads
ftime. Unfortunately I found several tar archives where the
`osize' and `otime' fields are NULL separated: in this cases the
sscanf doesn't read anything, so the resulting timestamp is
random.
I changed the size of `osize' to 12, reduced the size of `filler'
to 354, and now djtart seems to work correctly on all tar
archives.
Bruno
- Raw text -