GNU coreutils-8.9 Command line: echo '3:0:0:' | cut -d : -f 2 Correct output: 0 Compiled with uClibc, output is: 30 I think it is not uClibc bug but coreutils. In coreutils file lib/freadseek.c function freadptrinc looks like stdio hack with a lot of #ifdefs for different libs. stream becomes broken after "fp->__bufpos += increment;" code.
I confirm that I am able to reproduce the problem with uClibc, but not with glibc. I reported the bug to upstream uClibc, see http://lists.uclibc.org/pipermail/uclibc/2015-August/049026.html. We'll see if the uClibc developers have some clue.
Hi, tried on Qemu/arm with coreutils 8.24 and uClibc-ng 1.0.6. No problem. best regards
Hi, okay, found the reason. It seems following options in uClibc config fixes the problem: UCLIBC_HAS_STDIO_GETC_MACRO=y UCLIBC_HAS_STDIO_PUTC_MACRO=y They are both disabled in the default config in Buildroot. In OpenADK, which I used to verify the issue, the options are on. So no difference which uClibc version is in use. best regards Waldemar
(In reply to comment #3) > Hi, > > okay, found the reason. > It seems following options in uClibc config fixes the problem: > UCLIBC_HAS_STDIO_GETC_MACRO=y > UCLIBC_HAS_STDIO_PUTC_MACRO=y > > They are both disabled in the default config in Buildroot. > In OpenADK, which I used to verify the issue, the options are on. > > So no difference which uClibc version is in use. Thanks for the investigation. In other words, you suggest to enable these options in Buildroot as well? The help text of these options says "Most people will answer Y." (It still seems to be a bug in gnulib to assume that uClibc is always built with those options enabled...)
Fixed by commits 26ae113d1186951c4969000f5de2ec67e7f1ba3e and e07cc92491080289188b3618d687b06bb9aa6041. Thanks Waldemar!
A couple of points. This gnulib code is quite the layering violation, which results in issues like these. It's always worth reporting GNU coreutils bugs to bug-coreutils@gnu.org The change to uClibc config is a fine workaround, especially since it will generally speedup operations, though the actual fix is probably the following in gnulib: http://lists.gnu.org/archive/html/bug-gnulib/2015-12/msg00003.html