summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2004-05-19 06:35:47 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2004-05-19 06:35:47 +0000
commit44c46f7978adec0845859286d9adb15eeae7d48f (patch)
tree0bb57ca76b067a38c9671a55e913e5eff52a0b50 /lib
parentab203c2d8c63234cd2dec87f34f346cbc21f7a70 (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libarchive/archive_read_support_format_tar.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/libarchive/archive_read_support_format_tar.c b/lib/libarchive/archive_read_support_format_tar.c
index 468de5a4542d..d4d31e55dc74 100644
--- a/lib/libarchive/archive_read_support_format_tar.c
+++ b/lib/libarchive/archive_read_support_format_tar.c
@@ -593,21 +593,32 @@ header_common(struct archive *a, struct tar *tar, struct archive_entry *entry,
*/
if (st->st_size > 0)
st->st_mode |= S_IFREG;
+
/*
- * A tricky point: Traditionally, tar programs have
+ * A tricky point: Traditionally, tar readers have
* ignored the size field when reading hardlink
- * entries. As a result, some programs write non-zero
- * sizes, even though the body is empty and expect the
- * reader to ignore that. POSIX.1-2001 broke this by
- * permitting hardlink entries to store valid bodies
- * in pax interchange format. Since there is no hard
- * and fast way to distinguish pax interchange from
+ * entries, and some writers put non-zero sizes even
+ * though the body is empty. POSIX.1-2001 broke with
+ * this tradition by permitting hardlink entries to
+ * store valid bodies in pax interchange format, but
+ * not in ustar format. Since there is no hard and
+ * fast way to distinguish pax interchange from
* earlier archives (the 'x' and 'g' entries are
* optional, after all), we need a heuristic. Here, I
* use the bid function to test whether or not there's
- * a valid header following.
+ * a valid header following. Of course, if we know
+ * this is pax interchange format, then we must obey
+ * the size.
+ *
+ * This heuristic will only fail for a pax interchange
+ * archive that is storing hardlink bodies, no pax
+ * extended attribute entries have yet occurred, and
+ * we encounter a hardlink entry for a file that is
+ * itself an uncompressed tar archive.
*/
- if (st->st_size > 0 && archive_read_format_tar_bid(a) > 50)
+ if (st->st_size > 0 &&
+ a->archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE &&
+ archive_read_format_tar_bid(a) > 50)
st->st_size = 0;
break;
case '2': /* Symlink */