-
Notifications
You must be signed in to change notification settings - Fork 10
bug: seek() to negative position doesn't set $! to EINVAL #342
Copy link
Copy link
Open
Description
Problem
In Test::MockFile::FileHandle, when seek() attempts to seek to a negative position, it returns 0 (failure) but does NOT set $! to EINVAL.
# FileHandle.pm, SEEK method
if ( $new_pos < 0 ) {
return 0; # Missing: $! = EINVAL
}Expected behavior
Real Perl's seek() sets $! to EINVAL when the resulting position would be negative.
Reproduction
use Test::MockFile;
use Errno qw(EINVAL);
my $file = Test::MockFile->file('/mock/test', 'hello');
open my $fh, '<', '/mock/test' or die;
my $result = seek($fh, -10, 0); # Seek to negative position
# $result is 0 (correct), but $! is not EINVAL (bug)Severity
🟢 Low — incorrect error reporting, but the operation itself correctly fails.
🤖 Created by Kōan from audit session
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels