[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8961: stdbuf has no effect on some programs
From: |
Bruno Haible |
Subject: |
bug#8961: stdbuf has no effect on some programs |
Date: |
Wed, 29 Jun 2011 22:59:13 +0200 |
User-agent: |
KMail/1.9.9 |
Hi,
The glibc 'iconv' program buffers its input, and some people don't like this.
I thought that the 'stdbuf' program could remove the buffering, but it does not
work.
How to reproduce:
Create this script and make it executable:
================================== producer ==================================
#!/bin/sh
echo Hello
/bin/sleep 3
echo World
==============================================================================
$ ./producer | /usr/bin/iconv -f ASCII
Hello
World
All the output comes at the end.
$ stdbuf -o 0 ./producer | /usr/bin/iconv -f ASCII
Hello
World
All the output comes at the end.
$ ./producer | stdbuf -i 0 /usr/bin/iconv -f ASCII
Hello
World
All the output comes at the end.
$ stdbuf -o 0 ./producer | stdbuf -i 0 /usr/bin/iconv -f ASCII
Hello
World
All the output comes at the end.
What do I need to do to get the output of the first line immediately?
/usr/bin/iconv is from glibc, but I get the same behaviour from libiconv's
'iconv' program too.
In $ ./producer | /bin/cat
I get the first line immediately, but the coreutils documentation
<http://www.gnu.org/software/coreutils/manual/html_node/stdbuf-invocation.html>
makes me think that 'stdbuf' is meant for those programs that do not work like
'cat'.
Bruno
--
In memoriam José Olaya <http://es.wikipedia.org/wiki/José_Olaya>
- bug#8961: stdbuf has no effect on some programs,
Bruno Haible <=