feat(tar/unstable): add symlink support to TarStream#6976
feat(tar/unstable): add symlink support to TarStream#6976kt3k merged 2 commits intodenoland:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
| * 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
|
@BlackAsLight Thanks so much for your valuable review! I've fixed it in 822300b |
Adds
TarStreamSymlinktype andassertValidLinknameto support writing symbolic links inTarStream. Note thatUntarStreamalready supports reading symlinks.