Skip to content

Write file data into archive only for regular files - #1403

Merged
wlan0 merged 2 commits into
apple:mainfrom
adityaramani:build-context-symlink
Apr 8, 2026
Merged

Write file data into archive only for regular files#1403
wlan0 merged 2 commits into
apple:mainfrom
adityaramani:build-context-symlink

Conversation

@adityaramani

Copy link
Copy Markdown
Contributor

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Closes #1375

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Signed-off-by: Aditya Ramani <a_ramani@apple.com>
@adityaramani
adityaramani force-pushed the build-context-symlink branch from 72d177a to 995169a Compare April 7, 2026 22:21

@wlan0 wlan0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix for the archive write path

The digest logic gets broken however.

compress() hashes ArchiveEntryInfo, which doesn't include fileType or symlinkTarget. In case of symlinks, no bytes are hashed either.

This means, symlink target paths can change without changing the entire digest's hash.

A clean fix would be to either add fileType/symlinkTarget fields to ArchiveEntryInfo, or hash entry.symlinkTarget in _compressFile() for symlinks.

@adityaramani

Copy link
Copy Markdown
Contributor Author

@wlan0 Thanks for catching that. Updated the compress method to also account for the metadata of the file / link / directory by hashing on the archive header

@wlan0
wlan0 merged commit 6b950f4 into apple:main Apr 8, 2026
3 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.

[Bug]: builds fail with 'Error: unable to write data to the archive, code 0'

2 participants