Bug#554945: Autoflushing of stdout is broken with perl 5.10

2013-09-07 Thread Dominic Hargreaves
On Sat, Nov 07, 2009 at 03:05:23PM +0200, Eugene V. Lyubimkin wrote:
 Hi Roger,
 
 Roger Leigh wrote:
  Package: perl
  Version: 5.10.1-6
  Severity: normal
  
  This thread also describes the problem:

  http://coding.derkeiler.com/Archive/Perl/comp.lang.perl.misc/2009-06/msg00035.html
 Actually, the thread conclusion is the construction itself works. See three
 last messages. Personally, I use STDOUT flushing in one of my Perl programs
 and it works fine.
 
 Moreover, this program which uses dup() works perfectly fine:
 
 -8-
 #!/usr/bin/perl -w
 
 use strict;
 use warnings;
 
 use FileHandle;
 use POSIX;
 
 my $new_stdout = FileHandle-new_from_fd(dup(fileno(STDOUT)), 'w');
 $new_stdout-autoflush(1);
 
 while (1) {
   print { $new_stdout } 'a';
   sleep(1);
 }
 -8-
 
 Can you construct a small program to reproduce?

Hi Roger,

Do you find that this is still an issue for you with current versions
of perl? With the lack of a reproducible test case there's not much
we can do about this report, so I would like to either get some more
information about the issue, or close the report.

Thanks!
Dominic.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#554945: Autoflushing of stdout is broken with perl 5.10

2013-09-07 Thread Roger Leigh
On Sat, Sep 07, 2013 at 06:43:12PM +0100, Dominic Hargreaves wrote:
 Do you find that this is still an issue for you with current versions
 of perl? With the lack of a reproducible test case there's not much
 we can do about this report, so I would like to either get some more
 information about the issue, or close the report.

--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -2120,7 +2120,7 @@ sub open_build_log {
}
 
# Manual flushing due to Perl 5.10 bug.  Should autoflush.
-   $saved_stdout-flush();
+   #$saved_stdout-flush();
}
if (!$nolog  $log) {
print CPLOG $_;

In sbuild I was working around it by explicitly flushing the output
stream.  I've tested by commenting out the explicit flushing and doing
a few builds.  Output does not appear to be unduly buffered, so it's
possible that this issue has been resolved somehow.  However, the
perl code has changed slightly in the meantime, and I'm now using a
newer system, so it's possible that isn't simply not manifesting with
the setup I have.  There's certainly no lag/choppiness in the live
build output.

In the absence of being able to reproduce with the code which previously
demonstrated the problem, I'd say this could be closed.  If anyone can
properly reproduce it, it can be reopened.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?   http://gutenprint.sourceforge.net/
   `-GPG Public Key: 0x25BFB848   Please GPG sign your mail.


signature.asc
Description: Digital signature


Bug#554945: Autoflushing of stdout is broken with perl 5.10

2009-11-07 Thread Roger Leigh
Package: perl
Version: 5.10.1-6
Severity: normal

This thread also describes the problem:
  
http://coding.derkeiler.com/Archive/Perl/comp.lang.perl.misc/2009-06/msg00035.html

In sbuild, we use the following routine to print log messages:

while (STDIN) {
if ($nolog) {
print $saved_stdout $_;
} else {
if ($log) {
print CPLOG $_;
}
if ($verbose) {
print $saved_stdout $_;
}
}
}

in a child logger process which reads from a pipe.  Taken from the sub
open_build_log from
http://git.debian.org/?p=buildd-tools/sbuild.git;a=blob;f=lib/Sbuild/Build.pm;h=5c408976f20969823b619c770ba41c503541d86c;hb=HEAD

This is using standard buffered I/O on $saved_stdout, which is just a
dup'd reference to STDOUT.

if I add these changes:

 
@@ -2585,12 +2586,14 @@ sub open_build_log {
+   $saved_stdout-autoflush(1);
while (STDIN) {
if ($nolog) {
print $saved_stdout $_;
+   $saved_stdout-flush();
} else {
if ($log) {
print CPLOG $_;
}
if ($verbose) {
print $saved_stdout $_;
+   $saved_stdout-flush();
}
}
}

What I see is that if I just set autoflushing, the output is still
buffered.  If I (additionally or separately) add the explicit
flushing after print, then I do see correct flushing.

The conclusion I've drawn is that autoflushing does not work on
stdout.  The other handle, CPLOG, has set autoflushing without
any problems at all.  The above thread from comp.lang.perl.misc
shows the same behaviour.


Regards,
Roger

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (550, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages perl depends on:
ii  libbz2-1.0 1.0.5-3   high-quality block-sorting file co
ii  libc6  2.10.1-5  GNU C Library: Shared libraries
ii  libdb4.7   4.7.25-8  Berkeley v4.7 Database Libraries [
ii  libgdbm3   1.8.3-7   GNU dbm database routines (runtime
ii  perl-base  5.10.1-6  minimal Perl system
ii  perl-modules   5.10.1-6  Core Perl modules
ii  zlib1g 1:1.2.3.3.dfsg-15 compression library - runtime

Versions of packages perl recommends:
ii  make  3.81-7 An utility for Directing compilati
ii  netbase   4.37   Basic TCP/IP networking system

Versions of packages perl suggests:
pn  libterm-readline-gnu-perl | l none (no description available)
ii  perl-doc  5.10.1-6   Perl documentation

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#554945: Autoflushing of stdout is broken with perl 5.10

2009-11-07 Thread Eugene V. Lyubimkin
Hi Roger,

Roger Leigh wrote:
 Package: perl
 Version: 5.10.1-6
 Severity: normal
 
 This thread also describes the problem:
   
 http://coding.derkeiler.com/Archive/Perl/comp.lang.perl.misc/2009-06/msg00035.html
Actually, the thread conclusion is the construction itself works. See three
last messages. Personally, I use STDOUT flushing in one of my Perl programs
and it works fine.

Moreover, this program which uses dup() works perfectly fine:

-8-
#!/usr/bin/perl -w

use strict;
use warnings;

use FileHandle;
use POSIX;

my $new_stdout = FileHandle-new_from_fd(dup(fileno(STDOUT)), 'w');
$new_stdout-autoflush(1);

while (1) {
print { $new_stdout } 'a';
sleep(1);
}
-8-

Can you construct a small program to reproduce?

-- 
Eugene V. Lyubimkin aka JackYF, JID: jackyf.devel(maildog)gmail.com
C++/Perl developer, Debian Developer



signature.asc
Description: OpenPGP digital signature