Skip to content

Expanded archives keep their original dates - #85

Merged
danifunker merged 2 commits into
mainfrom
archive-dates
Sep 25, 2026
Merged

danifunker merged 2 commits into
mainfrom
archive-dates

Conversation

@danifunker

Copy link
Copy Markdown
Owner

Summary

When an archive is expanded into an image (--expand-archives, --expand-gunzip, on every optical new CD builder and rb-cli import), anything the archive does not date itself used to take the day of the import. Found while indexing a set of NeXTSTEP CDs: files had their 1990s dates, but 1,763 of 18,877 directories were dated the build day.

Now, for every archive expansion and every target filesystem:

  • Undated directories take the archive file's date. That covers the folder an archive unpacks into (pkg.tar.gz -> pkg/) and implicit parents a tar only lists through a/b/file (Importer::implicit_dir_times; ensure_dir_at takes a date).
  • Undated tar members (mtime 0) take the archive file's date too.
  • Classic Mac archive members (.sit, .cpt, .hqx, ...) keep their own Mac dates. copy_into never carried dates; CopyOptions::preserve_times turns that on for archive expansion only, so rb-cli cp and Commander Mode still stamp the time of the copy.
  • --expand-gunzip output takes the original date in the gzip header, else the .gz file's date.

Entries that carry their own date in the archive already kept it, and still do.

Also

  • .gnutar.gz, .gtar.gz, .gnutar and .gtar are recognised when naming the unpack folder: MiscKit.2.0.5.s.gnutar.gz -> MiscKit.2.0.5.s/ (was the full file name).
  • ImportStats::perms_applied counted any non-empty override, so a date alone was reported as a permission applied. It now counts mode and owner only (AttrOverrides::has_permissions).

Testing

  • New tests: the unpack folder and implicit parents take the archive date while members keep theirs; an mtime-0 member takes the archive date; gunzip output uses the header date, and falls back to the .gz file's date; .gnutar / .gtar names strip.
  • scripts/preflight.sh green: cargo test --release, MiSTer feature set, Rust 1.73 floor, doc parity, rb-regress.
  • Rebuilt nine NeXTSTEP CD images with --expand-archives: all pass fsck with the same file / directory / symlink counts as before, directories dated the build day went from 1,763 to 0 apart from folders that come from the host tree itself, and files dated the build day went from 4 to 0.

🤖 Generated with Claude Code

danifunker and others added 2 commits September 25, 2026 12:04
Indexing the NeXTSTEP discs showed files with their 1990s dates but most
directories dated the day the discs were built. Anything an archive does
not date itself fell back to "now":

- the folder an archive unpacks into (`pkg.tar.gz` -> `pkg/`),
- implicit parents a tar lists only through `a/b/file`,
- every member of a classic-Mac archive: `copy_into` never carried dates.

Now, for every archive expansion and every target filesystem:

- Undated directories take the archive file's own modification date
  (`Importer::implicit_dir_times`, `ensure_dir_at` takes a date).
- Mac archive members keep their Mac dates: `CopyOptions::preserve_times`,
  on for archive expansion only, so `cp` / Commander still stamp the copy
  time.
- `--expand-gunzip` output takes the original date recorded in the gzip
  header, else the .gz file's date.

Directories and files that carry a date in the archive were already kept,
and still are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…unpack folders

Two leftovers from rebuilding the NeXTSTEP discs with archive dates:

- Tar members recorded with mtime 0 (four .nib files in
  MiscKit.2.0.5.s.gnutar.gz) still took the import day. They now take the
  archive file's date, like the archive's undated directories.
- `.gnutar.gz`, `.gtar.gz`, `.gnutar` and `.gtar` were expanded (tar is
  detected by content) but not recognised as archive suffixes, so the unpack
  folder kept the whole name: `MiscKit.2.0.5.s.gnutar.gz/`. They now strip
  like `.tar.gz` (`MiscKit.2.0.5.s/`).

`perms_applied` counted any non-empty override, so a member that carried
only a date was reported as a permission applied. It now counts mode and
owner only (`AttrOverrides::has_permissions`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danifunker
danifunker merged commit a635144 into main Sep 25, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant