fix: correct -e false negative for stat results with mode 0#83
Draft
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Draft
fix: correct -e false negative for stat results with mode 0#83Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Conversation
Contributor
|
@Koan-Bot rebase |
The -e handler in _check_from_stat checked $stat[ST_MODE] in addition to @stat array length for existence. A file with mode 0 (all permission bits clear) would incorrectly report as non-existent, since mode 0 is falsy in Perl. In Unix semantics, stat() success alone implies existence regardless of mode value. Also tighten the XS-level stat array size validation: arrays with exactly 1 element slipped through the > 0 check (AvFILL returns 0 for 1-element arrays). Changed to >= 0 to reject all invalid sizes except -1 (empty) and 12 (13 elements).
Contributor
Author
Rebase with requested adjustmentsBranch StatsActions performed
CI statusCI will be checked asynchronously. Automated by Kōan |
65344af to
2215d69
Compare
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
-ereturning false for mocked files whose stat has mode 0.Why
The
-ehandler in_check_from_stattestedscalar @stat && $stat[ST_MODE].Since mode 0 is falsy in Perl, any file mocked with all-zero stat fields
(or just mode 0) would incorrectly report as non-existent. In Unix semantics,
stat()success alone implies existence — mode is irrelevant for that check.Also fixes a gap in the XS stat array size validation where a 1-element array
(
AvFILL == 0) slipped through the> 0guard undetected.How
-ehandler to_to_bool(scalar @stat)— existence depends only on stat successav_size > 0toav_size >= 0with improved error message[(0) x 13]means "file exists with all-zero fields"Testing
Full test suite passes (
make test).🤖 Generated with Claude Code