Repository navigation
Read input symlinks for stdout and read-only modes - #5044
Merged
Merged
Conversation
jlee303
marked this pull request as ready for review
November 25, 2026 20:44
Cyan4973
approved these changes
Nov 26, 2026
Cyan4973
left a comment
Contributor
There was a problem hiding this comment.
Thanks, this looks good to me.
I built dev and this branch, and compared them on symbolic links given on the command line:
-c,-dc,-tand-lnow follow the link.--rm -ckeeps both the link and its target, since--rmis ignored when the output is stdout.- When a file would be written (
zstd link,-o out link,-d link.zst), the link is still refused. So is-r, even with-c, and links inside a directory are still skipped. - A dangling link now fails with "can't stat", exit code 1.
This is the same rule as gzip and xz: both follow links with -c, -t and -l, and refuse them when they would write a file. The only difference is gzip -rc, which follows a link to a directory; staying more conservative there is fine.
One non-blocking suggestion on the man page: the new section says links are followed "when no output file is written", but -b writes no file and still skips links. Naming the modes would be more accurate, for example:
### Symbolic Links
A symbolic link named on the command line is followed when the output is
standard output (`-c`, `--stdout`), and with `-t` and `-l`. Otherwise, or when
`-r` is used, symbolic links are skipped with a warning. `-f` overrides this
and follows all symbolic links.
Contributor
Author
|
Thanks for detailed review and verifying fix! I updated the man page :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Addresses #3627
-fwhen writing to stdout. When writing an output file to disk or with-r, it still refuses symlinks.Checklist
A gain in one configuration is not a general gain: see the Performance section of CONTRIBUTING.md.
Tools used
Use Claude to review original PR fix