You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Opening a file in append write only mode (>>) and attepting to read from it puts the file handle in some kind of invalid state. Following writes will have the intended effect, i.e. append bytes to the file, but return errors.
The change of behavior ("first bad commit") was observed at
commit 80c1f1e45e8ef8c27d170fae7ade41971fe20218
Author: Tony Cook <[email protected]>
AuthorDate: Tue Aug 16 15:52:04 2022 +1000
Commit: Tony Cook <[email protected]>
CommitDate: Wed Aug 31 10:51:09 2022 +1000
only clear the stream error state in readline() for glob()
Calling read() would also set the error flag on the stream, and always has.
$ ~/perl/5.10.0-debug/bin/perl -e 'open my $fh, ">>", "append"; read $fh, $buf, 10; print $fh "append only" or die "append $!"; close $fh or die "close $!"'
append Bad file descriptor at -e line 1.
The change @jkeenan listed simply prevented readline() from clearing the error state after an error.
Description
Opening a file in append write only mode (
>>
) and attepting to read from it puts the file handle in some kind of invalid state. Following writes will have the intended effect, i.e. append bytes to the file, but return errors.This behaviour started with 5.38 and broke the tests in Win32::LongPath rdboisvert/Win32-LongPath#14.
cc @shawnlaffan
Steps to Reproduce
Expected behavior
The code should run successfully as it did before.
Note that using sysread and syswrite does not trigger the issue.
Perl configuration
Observed on multiple platforms (Linux, Windows, macOS), for instance:
The text was updated successfully, but these errors were encountered: