Summary
FT_RETURNNO is defined in FileCheck.h but never used. The XS handler pp_overload_ft_yes_no maps CHECK_IS_FALSE (0) to FT_RETURNUNDEF instead of FT_RETURNNO, making CHECK_IS_FALSE and CHECK_IS_NULL indistinguishable from the caller's perspective.
Impact
In Perl, file-test operators have two distinct "false" results:
- Defined false (
''): "check failed but file is known" — e.g., -f "/tmp" (a directory)
- Undef: "file not found / unknown" — e.g.,
-e "/nonexistent"
Users can distinguish these with defined(). With the current code:
mock_file_check('-f', sub { CHECK_IS_FALSE });
defined(-f "something") # returns false — WRONG, should be true
The XS comment at line 68-71 documents the intended behavior correctly:
* 0 check is false -> OP returns No
* -2 check is null -> OP returns undef
But the implementation at line 270 doesn't match:
if ( check_status == 0 ) FT_RETURNUNDEF; // should be FT_RETURNNO
Fix
PR #85
🤖 Created by Kōan from audit session
Summary
FT_RETURNNOis defined inFileCheck.hbut never used. The XS handlerpp_overload_ft_yes_nomaps CHECK_IS_FALSE (0) toFT_RETURNUNDEFinstead ofFT_RETURNNO, making CHECK_IS_FALSE and CHECK_IS_NULL indistinguishable from the caller's perspective.Impact
In Perl, file-test operators have two distinct "false" results:
''): "check failed but file is known" — e.g.,-f "/tmp"(a directory)-e "/nonexistent"Users can distinguish these with
defined(). With the current code:The XS comment at line 68-71 documents the intended behavior correctly:
But the implementation at line 270 doesn't match:
Fix
PR #85
🤖 Created by Kōan from audit session