On Mon, Dec 9, 2013 at 12:57 PM, Philip Guenther <[email protected]> wrote: > On Mon, Dec 9, 2013 at 12:10 PM, Miod Vallat <[email protected]> wrote: >> Since the switch to 64-bit time_t, our tar(1) can not archive files >> which timestamp are before 1970. >> >> Assuming these files: >> $ ls -l *gz >> -rw-r--r-- 1 miod dmg 34827 Jul 1 1904 comandr.mod.gz >> -rw-r--r-- 1 miod dmg 119280 Dec 3 1969 gbusa.mod.gz >> >> tar will fail to archive them: >> $ tar cf - *gz >> tar: Ustar header field is too small for gbusa.mod.gz >> tar: Ustar header field is too small for comandr.mod.gz
Grr, flubbed the send. What I meant to say was that the POSIX pax RATIONALE includes this blurb: > The time values are included as extended header records for those > implementations needing more than the eleven octal digits allowed by the > ustar format. > Portable file timestamps cannot be negative. If pax encounters a file with a > negative timestamp in copy > or write mode, it can reject the file, substitute a non-negative timestamp, > or generate a > non-portable timestamp with a leading '-'. Right now it does the former, you're suggesting the middle (in a way that matches historical behavior?). Amusingly, the field is actually a 36bit field by virtue of being 12 characters wide in octal, so simply converting the 32bit twos-complement value into that won't even have the top bit of the field set, no? Oh the joys of oddly specified file formats. Still, that seems less likely to explode than the insane suggestions of adding a leading '-'. >> Since the ustar file format stores the timestamp a width-limited octal >> value, which is expected to match a signed 32-bit value, it makes sense >> to handle the ustar timestamp as a 32-bit value (and switch to a >> different tar flavour by default at some point before 2038). The good news is that pax extended records let you specify timestamps with an arbitrary number of digits, and with a decimal fraction of arbitrary precision, and it's defined to override the fixed-size field, so simply inserting those for all dates after 2^31-1 may be the best way to resolve the "negative or >2^31?" ambiguity. Philip
