Repository navigation
fix(macos-pkg): retain cpio hard-link contents - #15141
ShuaixinHuang wants to merge 4 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR appears safe to merge; the reported sidecar mix-up is addressed, and no new blocking issue was found. SummaryRetains file contents for cpio hard-link aliases inside macOS packages.
Reviews (4) · Last reviewed commit: "fix(macos-pkg): pair AppleDouble aliases..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b913d164fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
I reproduced a remaining extraction regression on |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 33c3b3b20d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Closing this implementation after reproducing a wrong-file extraction on the latest revision, I ran the compiled CLI from https://github.com/morluto/rea/actions/runs/46358705750 against three reduced flat packages. All entries use the same odc device, inode and link count of two.
Both controls pass in isolation. Joining them makes the second file inherit bytes from the first group. The AppleDouble header found later in the archive causes the parser to exclude an earlier ordinary The next implementation needs to preserve both controls when their inode is reused. If the archive does not identify which body belongs to a path, preserve that uncertainty instead of publishing another file's bytes. The regression and original report are linked from #15154. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79ecb91ffa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| !( | ||
| sidecars.size > 0 && | ||
| member.size === 0 && | ||
| appleDoubleSibling(member, names) |
There was a problem hiding this comment.
Preserve empty sidecars at a partial cpio boundary
If cpio parsing stops after ._original (valid AppleDouble), original (hello), and empty ._alias, but before alias, with all four records sharing a device/inode and nlink=2, this lookup misses the unparsed sibling. ._alias then enters dataRecords and is rewritten with hello; the complete-archive control leaves it empty. I reproduced this for both truncated decoded cpio and the default 4,096-member cutoff. Because MacosPkgArtifactReader.#expandArchive publishes members alongside partialFailure, the invented contents reach inventory digests and extraction. Preserve the unresolved sidecar rather than treating a sibling outside the parsed prefix as absent.
AGENTS.md reference: AGENTS.md:L76-L76
Useful? React with 👍 / 👎.
Problem
A macOS flat installer can store a regular file's body once in its odc cpio payload and give another path the same device and inode with a zero-size record. A reference libarchive read identified
alias.txtas a hard link tooriginal.txt. REA's CLI showed the original as 8 bytes and the alias as 0 bytes, and extraction wrote an empty alias.Change and scope
The odc parser groups multiply linked regular files by device and inode within each archive. A zero-size alias shares the observed bytes and size of a nonempty group member when the group has an unambiguous body. Extraction uses the existing bounded file materializer, which writes ordinary output files. No host hard links are created. An unrelated empty file still extracts as empty.
This corrects the existing macOS package reader. The standalone cpio proposal in #15083 serves a different reader. No corresponding issue was found in the targeted search.
Verification
Author readiness
Human owner: @ShuaixinHuang
Review follow-up
Commit
0eae1d1becharges resolved alias contents to the same package-wide allowance as the decoded archive before publishing entries. It retires inode groups at their declared link count. Tests cover forward aliases, inode reuse, archive isolation, and disagreeing recorded bodies. All 72 focused reader, CLI and MCP tests and the normal push gates passed locally. Package tests used synthetic fixtures on Linux.Commit
79ecb91ffuses the same leading-current-directory normalization as package entry publication to pair AppleDouble siblings. It excludes paired empty sidecars from data groups when the inode has a validated AppleDouble sibling, preserving the recorded sidecar bodies. The CLI regression covers mixed prefixes and an empty sidecar alongside a nonempty data file. Numeric reads now use BinaryReader, addressing the previous head's architecture guard failure. All 72 focused reader, CLI and MCP tests and the normal typecheck, lint, module boundary and architecture gates passed locally.