New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IO::Handle setvbuf bug #3523
Comments
From me-01@ton.iguana.beI Was doing some straces of perl's output: strace perl -wle 'print STDERR "hoi", "wow"' gives(as expected): write(2, "hoi", 3) = 3 Because I needed lines in my application, I wanted line buffering, so I strace perl -wle 'use IO::Handle '_IOLBF'; STDERR->setvbuf($buffer_var, _IOLBF, 1024); print STDERR "hoidyhu", "wowgrrr"' which gives (totally unexpected): write(2, "h", 1) = 1 However, this: strace perl -wle 'use IO::Handle '_IOLBF'; STDERR->setvbuf(my $buffer_var, _IOLBF, 1024); print STDERR "hoidyhu", "wowgrrr"' gives the expected: write(2, "hoidyhuwowgrrr\n", 15) = 15 I think there's something very wrong if it matters if the buffer Perl Info
|
From @gannett-ggreerThis isn't "PerlIO" per se because the documentation notes: - - - 8< - - - 8< - - - Indeed on Linux I get: -- |
From @HugmeirOn Wed Jul 28 20:27:39 2010, greerga wrote:
How would I need to compile Perl to test if this is still present? |
From @tonycozOn Sat, May 05, 2012 at 04:59:02AM -0700, Brian Fraser via RT wrote:
You'd have to build perl without perlio, but Configure now always Tony |
From @nwc10On Tue, May 08, 2012 at 09:54:20AM +1000, Tony Cook wrote:
"Now" as in post 5.15.0 If I build 5.14.0 like this: ./Configure -de -Uuseperlio && make -j5 test_prep I see the same confusing difference: $ strace -oout -ewrite ./perl -Ilib -wle 'use IO::Handle '_IOLBF'; STDERR->setvbuf(my $buffer_var, _IOLBF, 1024); print STDERR "hoidyhu", "wowgrrr"' $ strace -oout -ewrite ./perl -Ilib -wle 'use IO::Handle '_IOLBF'; STDERR->setvbuf($buffer_var, _IOLBF, 1024); print STDERR "hoidyhu", "wowgrrr"' Nicholas Clark |
From @nwc10On Tue, May 08, 2012 at 02:51:51PM +0100, Nicholas Clark wrote:
Ho ho ho. $ strace -ofixed -ewrite ./perl -Ilib -wle 'use IO::Handle '_IOLBF'; STDERR->setvbuf($buffer_var, _IOLBF, 1024); print STDERR "hoidyhu", "wowgrrr"; 0 if $buffer_var;' From the C library man page: Except for unbuffered files, the buf argument should point to a buffer What's going wrong in the test case is that the used only once warning is IO::Handle's documentation says. You should only change the buffer before any I/O, or immediately after This actually seems to be erroneous, as calling flush on the handle *doesn't* $ strace -obug -ewrite ./perl -Ilib -wle 'use IO::Handle '_IOLBF'; STDERR->flush or die; STDERR->setvbuf($buffer_var, _IOLBF, 1024); print STDERR "hoidyhu", "wowgrrr";' Looks like a fix to IO::Handle's documentation is needed. Also, I guess that we should take this part out of its synopsis: # setvbuf is not available by default on Perls 5.8.0 and later. as it's really not useful any more. Nicholas Clark |
I think we can close this as WONTFIX? |
Yes, the setvbuf() being unavailable is documented so I think it's closable (and closed). |
Migrated from rt.perl.org#5971 (status was 'open')
Searchable as RT5971$
The text was updated successfully, but these errors were encountered: