fix: use stat not lstat for -u, -g, -k in mock_all_from_stat#80
Draft
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Draft
fix: use stat not lstat for -u, -g, -k in mock_all_from_stat#80Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Conversation
The stat/lstat dispatch regex in _check_from_stat was missing u, g, k characters. This caused setuid/setgid/sticky checks to use lstat instead of stat, which doesn't follow symlinks — diverging from real Perl semantics where -u, -g, -k operate on the symlink target. Add ugk to the character class so these checks correctly use stat. Closes cpan-authors#61 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Fix stat/lstat dispatch for
-u,-g,-kchecks in_check_from_stat.Why
The regex controlling whether
statorlstatis called was missingu,g,k. This caused these operators to uselstat(which doesn't follow symlinks), diverging from real Perl where-u,-g,-kfollow symlinks. Amock_all_from_staton a symlink to a setuid binary would silently return the wrong result.How
Added
ugkto the character class at line 291:qr{^[sfdMXxzACORWeorwugk]$}.Testing
t/stat-dispatch-ugk.tverifying:-u/-g/-kdispatchstat(notlstat) to the mock callbackCloses #61
🤖 Generated with Claude Code