Skip to content

feat(tar/unstable): add symlink support to TarStream#6976

Merged
kt3k merged 2 commits intodenoland:mainfrom
magurotuna:yusuke/tar-symlink
Jan 30, 2026
Merged

feat(tar/unstable): add symlink support to TarStream#6976
kt3k merged 2 commits intodenoland:mainfrom
magurotuna:yusuke/tar-symlink

Conversation

@magurotuna
Copy link
Member

Adds TarStreamSymlink type and assertValidLinkname to support writing symbolic links in TarStream. Note that UntarStream already supports reading symlinks.

@magurotuna magurotuna requested a review from kt3k as a code owner January 29, 2026 09:43
@github-actions github-actions bot added the tar label Jan 29, 2026
@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.20%. Comparing base (4d438dc) to head (822300b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6976      +/-   ##
==========================================
+ Coverage   94.19%   94.20%   +0.01%     
==========================================
  Files         600      600              
  Lines       43290    43317      +27     
  Branches     6961     6973      +12     
==========================================
+ Hits        40776    40806      +30     
+ Misses       2459     2457       -2     
+ Partials       55       54       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

* format is compatible with most tar readers, the format has several
* limitations, including:
* - Paths must be at most 256 characters.
* - Paths must be at most 256 bytes.
Copy link
Member Author

Choose a reason for hiding this comment

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

Corrected this text because what the validation logic actually checks is the number of bytes, not the number of characters.
The ustar spec mentions that it only supports ASCII characters (in which case the number of characters == the number of bytes), but it seems like the existing validation for paths doesn't check if a path consists only of ASCII or not. Also, it appears that most tar utility tools (like gnu tar) can handle non-ASCII characters without any issue. So, although it's not strictly compliant with the ustar spec, TarStream can process non-ASCII characters.

Copy link
Contributor

Choose a reason for hiding this comment

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

The ustar spec, the one linked in the file, makes no mention of requiring any specific encoding for name, linkname, and prefix. It specifies that many of the other fields are to be written in ASCII, but does not for them. As long as they are within the byte limit they are compliant.

I have no problem with this change in wording though.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's right, thanks for the correction. I might have been confused with something else.

* format is compatible with most tar readers, the format has several
* limitations, including:
* - Paths must be at most 256 characters.
* - Paths must be at most 256 bytes.
Copy link
Contributor

Choose a reason for hiding this comment

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

The ustar spec, the one linked in the file, makes no mention of requiring any specific encoding for name, linkname, and prefix. It specifies that many of the other fields are to be written in ASCII, but does not for them. As long as they are within the byte limit they are compliant.

I have no problem with this change in wording though.

@magurotuna
Copy link
Member Author

@BlackAsLight Thanks so much for your valuable review! I've fixed it in 822300b

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

LGTM

@kt3k kt3k merged commit 91e808c into denoland:main Jan 30, 2026
19 checks passed
@magurotuna magurotuna deleted the yusuke/tar-symlink branch January 30, 2026 10:59
tomas-zijdemans pushed a commit to tomas-zijdemans/std_cb that referenced this pull request Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants