fix: fix IO::Util test failures - select() with tied handles, syswrite, and more#507
Merged
fix: fix IO::Util test failures - select() with tied handles, syswrite, and more#507
Conversation
…e, and more Fix 6 bugs causing IO::Util CPAN module test failures (improved from 5/9 failing to 1/9, with only test_pod.t remaining due to POD encoding): - Propagate globName to TieHandle so select() returns "main::STDOUT" instead of "TIED_HANDLE(class)" when the handle is tied. This fixes IO::Util::capture's syswrite test which relies on select() returning the correct glob name for tie/untie round-trips. - Fix qr/./=> token splitting: after regex parser consumes /, merge remaining = with next > to form => fat comma operator. - Implement 1-argument open (open HANDLE) by reading filename from $_. - Fix syswrite on tied handles: move TieHandle check before ClosedIOHandle check since TieHandle's ioHandle is always closed. - Fix gethostbyname/getservbyname/etc. aliases field flattening: use empty string scalar instead of empty array to prevent field shifting in list context. - Fix sprintf zero-pad flag for missing arguments: %03d with no argument now produces "000" instead of " 0". 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
Fix 6 bugs causing IO::Util CPAN module test failures. Results improved from 5/9 test files failing to only 1/9 (the remaining
test_pod.tfails due to POD encoding, not our code).Bugs Fixed
select()returns wrong value for tied handles:select()was returning"TIED_HANDLE(test_tie)"instead of"main::STDOUT"when STDOUT was tied. This brokeIO::Util::capturewhich relies onselect()to get the current handle name and uses*{$name}to tie/untie it. Fixed by propagatingglobNamefrom the previous IO handle to theTieHandle, and updatingTieHandle.toString()to return globName when available.qr/./=>token splitting: Lexer greedily tokenized/=fromqr/./=>as divide-assign. After regex parser consumed/, the remaining=wasn't merged with next>to form=>fat comma. Added merge logic inStringParser.java.1-argument
opennot implemented:open HANDLE(1-arg form) was throwingPerlJavaUnimplementedException. Implemented by reading filename from$_.syswriteon tied handles:TieHandlecheck was afterClosedIOHandlecheck; sinceTieHandle's ioHandle is alwaysClosedIOHandle, tied handles were caught early and returned undef. Moved TieHandle check before closed-handle check.gethostbynamealiases field flattening: EmptyRuntimeArrayfor aliases field was flattening to zero elements in list context, shifting subsequent fields. Changed to empty string scalar in all 8 network functions.sprintfzero-pad flag for missing args:%03dwith missing argument produced" 0"instead of"000". Added check for0flag to choose pad character.Files Changed
TieOperators.java- propagate globName to TieHandleTieHandle.java- use globName in toString()StringParser.java-qr//=>token mergeIOOperator.java- 1-arg open, syswrite tie orderExtendedNativeUtils.java- network aliases flatteningSprintfOperator.java- sprintf zero-padRuntimeScalar.java- globDeref RuntimeIO lookupTest plan
makepasses (all unit tests)01_capture.tpasses 10/10 tests (was 7/10)tie_handle.tunit test passesGenerated with Devin