bug-coreutils
[Top][All Lists]
Advanced

[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: Thu, 30 Jun 2011 01:42:16 +0200
User-agent: KMail/1.9.9

Pádraig Brady wrote:
> The following shows I think that iconv is bypassing stdio and buffering 
> internally?
> 
> (echo; sleep 3; echo) | ltrace iconv -f ASCII

This is true for the glibc 'iconv' program. But stdbuf also does not work with
'iconv' from GNU libiconv, and this program uses stdio in a very simple form:
It reads from stdin using fread(). It does *not* call setvbuf explicitly.

$ (echo; sleep 3; echo) | ltrace iconv -f ASCII
__libc_start_main(0x804a250, 3, 0xffe20264, 0x804b3c0, 0x804b420 <unfinished 
...>
strrchr("iconv", '/')                                                           
                 = NULL
setlocale(0, "")                                                                
                 = "de_DE.UTF-8"
setlocale(5, "")                                                                
                 = "de_DE.UTF-8"
bindtextdomain("libiconv", "/packages/gnu/share/locale")                        
                 = "/packages/gnu/share/locale"
textdomain("libiconv")                                                          
                 = "libiconv"
strlen("-f")                                                                    
                 = 2
libiconv_open(0x804c262, 0xffe206d7, 0xffe206d4, 0xffe206d4, 0)                 
                 = 0x804f4a0
iconv_canonicalize(0x804c262, 0xffe206d7, 0xffe206d4, 0xffe206d4, 0)            
                 = 0xf7effecc
iconv_canonicalize(0xffe206d7, 0xffe206d7, 0xffe206d4, 0xffe206d4, 0)           
                 = 0xf7efff38
libiconvctl(0x804f4a0, 6, 0xffe201a0, 0xffe206d7, 0)                            
                 = 0
libiconvctl(0x804f4a0, 5, 0xffe20190, 0x804f4a0, 0)                             
                 = 0
dcgettext(0, 0x804c27e, 5, 0, 0)                                                
                 = 0x8057b50
libiconv(0x804f4a0, 0, 0, 0, 0)                                                 
                 = 0
fread(0xffe1f110, 1, 4096, 0xf7df5420)                                          
                 = 2
libiconv(0x804f4a0, 0xffe1d100, 0xffe1d104, 0xffe1d108, 0xffe1d10c)             
                 = 0
__errno_location()                                                              
                 = 0xf7cb5688
fwrite("\n\n", 1, 2, 0xf7df54c0

)                                                                 = 2
fread(0xffe1f110, 1, 4096, 0xf7df5420)                                          
                 = 0
libiconv(0x804f4a0, 0, 0, 0xffe1d0f4, 0xffe1d0f8)                               
                 = 0
ferror(0xf7df5420)                                                              
                 = 0
libiconv_close(0x804f4a0, 0xf7df5420, 0x8057b50, 0, 0)                          
                 = 0
ferror(0xf7df54c0)                                                              
                 = 0
fclose(0xf7df54c0)                                                              
                 = 0
exit(0 <unfinished ...>
+++ exited (status 0) +++

$ (echo Hello; sleep 3; echo World) | stdbuf iconv -f ASCII
Hello
World

All output comes after 3 seconds - stdbuf has no effect.

I'm using glibc-2.8.

Bruno
-- 
In memoriam José Olaya <http://es.wikipedia.org/wiki/José_Olaya>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]