6 Commits
Author SHA1 Message Date
Zhaofeng Li 0685c77e83 Add test for macOS metadata reading in tar archives
Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
2025-05-24 16:42:26 -06:00
Zhaofeng Li 5bb36db5e1 tar: Reset accumulated header state after reading macOS metadata blob
AppleDouble extension entries are present as separate files immediately
preceding the corresponding real files. In libarchive, we process the
entire metadata file (headers + data) as if it were a header in the real
file. However, the code forgets to reset the accumulated header state
before parsing the real file's headers. In one code path, this causes
the metadata file's name to be used as the real file's name.

Specifically, this can be triggered with a tar containing two files:

1. A file named `._badname` with pax header containing the `path` attribute
2. A file named `goodname` _with_ a pax header but _without_ the `path` attribute

libarchive will list one file, `._badname` containing the data of `goodname`.

This code is pretty brittle and we really should let the client deal with
it :(

Fixes #2510.

Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
2025-05-24 14:33:08 -06:00
Zhaofeng Li 6b2c5e0ba4 autotools: Fix iconv issues in generated .pc file
The goal is to make everyone (including msys2) happy.

Fixes #1766 and #1819.

Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
2025-05-17 13:50:16 -06:00
Zhaofeng Li 00d559e4b9 bsdtar: Disallow multiple --files-from/-T options 2025-05-16 11:35:36 -06:00
Zhaofeng Li 6b97a57e8e Support @-prefixed Unix epoch timestamps as date strings
Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
2025-05-15 09:59:33 -06:00
Zhaofeng LiandDustin L. Howett c26f037745 bsdtar: Support --mtime and --clamp-mtime (#2601)
Hi,

This PR adds support for setting a forced mtime on all written files
(`--mtime` and `--clamp-mtime`) in bsdtar.

The end goal will be to support all functionalities in
<https://reproducible-builds.org/docs/archives/#full-example>, namely
`--sort` and disabling other attributes (atime, ctime, etc.).

Fixes #971.

## History

- [v1](https://github.com/zhaofengli/libarchive/tree/forced-mtime-v1):
Added `archive_read_disk_set_forced_mtime` in libarchive. As a result,
it was only applied when reading from the filesystem and not from other
archives.
- [v2](https://github.com/zhaofengli/libarchive/tree/forced-mtime-v2):
Refactored to apply the forced mtime in `archive_write`.
- v3 (current): Reduced libarchive change to exposing
`archive_parse_date`, moved clamping logic into bsdtar.

---------

Signed-off-by: Zhaofeng Li <hello@zhaofeng.li>
Co-authored-by: Dustin L. Howett <dustin@howett.net>
2025-05-15 14:08:14 +02:00