fix: Warn on print/say to read-only filehandle - Text::CSV 100% pass#439
Merged
fix: Warn on print/say to read-only filehandle - Text::CSV 100% pass#439
Conversation
When printing to a filehandle opened for reading only, the builtin print and say now set errno to Bad file descriptor, emit the warning (when warnings enabled via io category), and return undef. This was the last remaining Text::CSV failure: t/70_rt.t test 72. All 40 Text::CSV test files now pass (52723/52723 subtests). Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.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.
Summary
Filehandle opened only for inputand returns undef, matching Perl 5 behavioriocategory, respecting$^W,use warnings, andno warnings 'io'$!toBad file descriptor(errno 9 / EBADF)NonWritableChannelExceptionthrown by Java NIO when writing to a FileChannel opened for readingImpact
This was the last remaining Text::CSV failure: t/70_rt.t test 72 expected a warning when
$csv->print($fh, [...])writes to a read-only filehandle via IO::Handle->print.Text::CSV results: 40/40 test files pass, 52723/52723 subtests (100%)
Test plan
makepasses (all unit tests)print $fh ...to read-only fh warns with$^W=1IO::Handle->printto read-only fh warns with$^W=1$^W/use warningsGenerated with Devin