diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-12-22 02:35:37 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-12-22 02:35:37 +0000 |
commit | 15dfe78baaefd19ac569500360e645c1b595ece6 (patch) | |
tree | 364c62d6af721d740bda395d8385cab18925e6ae /lib/libarchive | |
parent | 66ddfc8a7863b6b83b01f1a61dd6e6d285048bce (diff) | |
download | FreeBSD-src-15dfe78baaefd19ac569500360e645c1b595ece6.zip FreeBSD-src-15dfe78baaefd19ac569500360e645c1b595ece6.tar.gz |
Don't truncate major/minor numbers written to the legacy
ustar fields. Later, we're going to permit numeric extensions
for these fields, so we can support large values here. In particular,
this allows GNU tar to correctly extract such entries even
though it doesn't support the pax extended attributes.
Note: r1.18 and r1.17.2.1 of this file allowed similar treatment
of the uid/gid fields.
Thanks to: Ben Mesander
Diffstat (limited to 'lib/libarchive')
-rw-r--r-- | lib/libarchive/archive_write_set_format_pax.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/libarchive/archive_write_set_format_pax.c b/lib/libarchive/archive_write_set_format_pax.c index 8593eb7..94e608a 100644 --- a/lib/libarchive/archive_write_set_format_pax.c +++ b/lib/libarchive/archive_write_set_format_pax.c @@ -466,7 +466,17 @@ archive_write_pax_header(struct archive *a, if (rdevmajor >= (1 << 18)) { add_pax_attr_int(&(pax->pax_header), "SCHILY.devmajor", rdevmajor); - archive_entry_set_rdevmajor(entry_main, (1 << 18) - 1); + /* + * Non-strict formatting below means we don't + * have to truncate here. Not truncating improves + * the chance that some more modern tar archivers + * (such as GNU tar 1.13) can restore the full + * value even if they don't understand the pax + * extended attributes. See my rant below about + * file size fields for additional details. + */ + /* archive_entry_set_rdevmajor(entry_main, + rdevmajor & ((1 << 18) - 1)); */ need_extension = 1; } @@ -477,7 +487,9 @@ archive_write_pax_header(struct archive *a, if (rdevminor >= (1 << 18)) { add_pax_attr_int(&(pax->pax_header), "SCHILY.devminor", rdevminor); - archive_entry_set_rdevminor(entry_main, (1 << 18) - 1); + /* Truncation is not necessary here, either. */ + /* archive_entry_set_rdevminor(entry_main, + rdevminor & ((1 << 18) - 1)); */ need_extension = 1; } } @@ -513,7 +525,7 @@ archive_write_pax_header(struct archive *a, * The following items are handled differently in "pax * restricted" format. In particular, in "pax restricted" * format they won't be added unless need_extension is - * already set (we're already generated an extended header, so + * already set (we're already generating an extended header, so * may as well include these). */ if (a->archive_format != ARCHIVE_FORMAT_TAR_PAX_RESTRICTED || |