[Bug 4670] New: fopencookie custom IO stream behaviour without buffering differs from GNU C

bugzilla at busybox.net bugzilla at busybox.net
Wed Jan 4 15:48:19 UTC 2012


https://bugs.busybox.net/show_bug.cgi?id=4670

           Summary: fopencookie custom IO stream behaviour without
                    buffering differs from GNU C
           Product: uClibc
           Version: 0.9.32
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: stdio
        AssignedTo: unassigned at uclibc.org
        ReportedBy: farago1 at zonnet.nl
                CC: uclibc-cvs at uclibc.org
   Estimated Hours: 0.0


Created attachment 3944
  --> https://bugs.busybox.net/attachment.cgi?id=3944
small example file; expected behaviour as in GNU C lib.

I use a custom stream writer. Under uClibc every parameter is output to a new
line in syslog if buffering is turned off[*]. See attachment for a short
example. The same code on a GNU C library works as expected. If buffering is
kept on, behaviour is as expected.

[*] setvbuf(stream, NULL, _IONBF, 0);

On GNU C after a call to fprintf() the expanded string is passed to the write
function.
Output is:
size '16'; buffer 'TEST::test::TEST'

See stacktrace:
#0  log_writer (cookie=0x804a060, buffer=0xbfffd0c0 "TEST::test::TEST",
size=16) at test2.c:12
#1  0xb7ebaaf4 in ?? () from /lib/i386-linux-gnu/libc.so.6
#2  0xb7ec5514 in ?? () from /lib/i386-linux-gnu/libc.so.6
#3  0xb7ec624a in _IO_file_xsputn () from /lib/i386-linux-gnu/libc.so.6
#4  0xb7ea1137 in ?? () from /lib/i386-linux-gnu/libc.so.6
#5  0xb7e9c383 in vfprintf () from /lib/i386-linux-gnu/libc.so.6
#6  0xb7ea619f in fprintf () from /lib/i386-linux-gnu/libc.so.6
#7  0x080485a9 in main () at test2.c:28

on uClibc-0.9.32 on my ARM machine after a call to fprintf() the non-expanded
string is passed to the write function, with several calls for each section of
the string.
Output is:
size '6'; buffer 'TEST::%s::TEST'
size '4'; buffer 'test'
size '6'; buffer '::TEST'

See stacktrace:
#0  log_writer (cookie=0x107e8, buffer=0x86b0 "TEST::%s::TEST", size=6) at
test2.c:12
#1  0x400386a4 in ?? () from /ffp/lib/libc.so.0
...
#0  log_writer (cookie=0x107e8, buffer=0x86c0 "test", size=4) at test2.c:12
#1  0x400386a4 in ?? () from /ffp/lib/libc.so.0
...
#0  log_writer (cookie=0x107e8, buffer=0x86b8 "::TEST", size=6) at test2.c:12
#1  0x400386a4 in ?? () from /ffp/lib/libc.so.0

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the uClibc-cvs mailing list