Subject: bug#8961: stdbuf has no effect on some programs

From: Bruno Haible <[email-masked]>
Date: Sun, 3 Jul 2011 14:17:54 +0200

Pádraig Brady wrote:
> +Disabling buffering for input will not influence the responsiveness
> +or blocking behavior of the stream input functions.

OK, but then what is the effect of "-i0"?

It has only an effect on programs that use stdio. On these programs, it has no
effect on the interface between the program and the FILE buffers, only an effect
on the interface between the FILE buffers and the kernel. More precisely:
  - Without -i0, for refilling the buffers, the stdio makes a call to
    read(0,buf,N) and receives the available n bytes (n <= N).
  - With -i0, the stdio makes repeated calls to read(0,..,1) and
    receives the available n bytes one after the other.

The only change in behaviour that I can see in such programs is that its
throughput is reduced, from 35 MB/sec to 2 MB/sec in my tests.

So, "-i0" has no useful effect on any program. I therefore suggest that you
remove this option. Likewise for "-o0". Because if you keep it, other users will
- like me - spend time, trying to make use of this option. When in fact they
are always useless.

Bruno
-- 
In memoriam Yuri Shchekochikhin <http://en.wikipedia.org/wiki/Yuri_Shchekochikhin>