Closed p5pRT closed 20 years ago
Test 7 of io/dup fails. Reading from the dup'd file handle fails with EBADF. Setting $|=1 doesn't make a difference but changing the open of R1 from \< or +\< *does* makes the test succeed\, which strikes me as odd. From a ktrace\, however\, I don't see the kernel returning EBADF at all. What I see is that the read\, before the dup\, from R1 slurps up both lines and the subsequent read from the dup'd handle returns 0 (since there are no bytes left to read). Now\, when we open R1 with +\< there *is* a line to read from R2. I have no idea why that would be\, but I'm not convinced that this test is at all legal since stdio is pretty much guaranteed to buffer things behind your back on some (most?) systems. There's even a warning about this in the perlfunc man page "Duping a filehandle does not take into account any existing contents of stdio buffers."
classify
Ciao Richard Foley
richard@perl.org | richard@rfi.net | Richard.Foley@m.dasa.de 'Ciao' - shorter than 'Aufwiedersehen'
Migrated from rt.perl.org#1272 (status was 'resolved')
Searchable as RT1272$