"GNU.sparse.major", 1);
add_pax_attr_int(&(pax->pax_header),
"GNU.sparse.minor", 0);
+ /*
+ * Make sure to store the original path, since
+ * truncation to ustar limit happened already.
+ */
add_pax_attr(&(pax->pax_header),
- "GNU.sparse.name", entry_name.s);
+ "GNU.sparse.name", path);
add_pax_attr_int(&(pax->pax_header),
"GNU.sparse.realsize",
archive_entry_size(entry_main));
/*
* "file3" is sparse file and has hole size of which is
* 1024000 bytes, and has 8 bytes data after the hole.
+ *
+ * Pad the filename to make it larger than the ustar limit.
+ * It should still read back correctly.
*/
assert((ae = archive_entry_new()) != NULL);
archive_entry_set_atime(ae, 2, 20);
archive_entry_set_birthtime(ae, 3, 30);
archive_entry_set_ctime(ae, 4, 40);
archive_entry_set_mtime(ae, 5, 50);
- archive_entry_copy_pathname(ae, "file3");
+ archive_entry_copy_pathname(ae, "file3"
+ "_123456789_123456789_123456789_123456789_123456789"
+ "_123456789_123456789_123456789_123456789_123456789"
+ "_123456789_123456789_123456789_123456789_123456789");
archive_entry_set_mode(ae, S_IFREG | 0755);
archive_entry_set_size(ae, 1024008);
archive_entry_sparse_add_entry(ae, 1024000, 8);
assertEqualInt(40, archive_entry_ctime_nsec(ae));
assertEqualInt(5, archive_entry_mtime(ae));
assertEqualInt(50, archive_entry_mtime_nsec(ae));
- assertEqualString("file3", archive_entry_pathname(ae));
+ assertEqualString("file3"
+ "_123456789_123456789_123456789_123456789_123456789"
+ "_123456789_123456789_123456789_123456789_123456789"
+ "_123456789_123456789_123456789_123456789_123456789",
+ archive_entry_pathname(ae));
assert((S_IFREG | 0755) == archive_entry_mode(ae));
assertEqualInt(1024008, archive_entry_size(ae));
assertEqualInt(1, archive_entry_sparse_reset(ae));