[BusyBox] Re: init revision 1.170, 1.169

Erik Andersen andersen at codepoet.org
Mon Sep 16 02:50:04 UTC 2002


On Mon Sep 16, 2002 at 12:29:49PM +0400, Vladimir N. Oleynik wrote:
> Erik,
>  
> > On Mon Sep 16, 2002 at 12:17:23PM +0400, Vladimir N. Oleynik wrote:
> > > > Either way works, though "%m" is a GNU extension, and is not
> > > > supported by all C libraries.
> > >
> > > I know. But:
> > > busybox-0.61pre $ grep "%m" `find . -name "*.c"` | wc -l
> > >      26
> > >
> > > Require changes? :(
> > 
> > I just checked, and contrary to what I believed, Linux libc5
> > does support '%m'.  
> 
> This false.

I wrote a quick test app to check libc '%m' support.
    $ cat ./test.c 
    #include<stdio.h>
    #include<fcntl.h>
    #include <stdlib.h>

    int main(void)
    {
	if (open("/etc/shadow", O_RDWR) <0)
	    printf("error: %m\n");
	return 0;
    }

First test glibc:

    $ gcc -Wall -O2 ./test.c -o test
    $ ldd ./test
	    libc.so.6 => /lib/libc.so.6 (0x40021000)
	    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
    $ ./test 
    error: Permission denied
So glibc works perfectly.


Next test libc5:
    $ /usr/i486-linuxlibc1/bin/gcc -Wall -O2 ./test.c -o test
    $ ldd ./test
	    libc.so.5 => /lib/libc.so.5 (0x40015000)
    $ ./test 
    error: Permission denied
So libc5 works perfectly.

Next test uClibc:
    $ /usr/i386-linux-uclibc/bin/i386-uclibc-gcc -Wall -O2 ./test.c -o test
    $ ldd ./test
	    libc.so.0 => /usr/i386-linux-uclibc/lib/libc.so.0 (0x0x40006000)
	    ld-uClibc.so.0 => /usr/i386-linux-uclibc/lib/ld-uClibc.so.0 (0x0x40000000)
    $ ./test 
    error: Permission denied
So uClibc works perfectly.

Next test dietlibc:
    $ ~/libc/dietlibc/bin-i386/diet gcc -Wall ./test.c -o test
    /home/andersen/libc/dietlibc/bin-i386/dietlibc.a(vprintf.o): In function `vprintf':
    vprintf.o(.text+0x3d): warning: the printf functions add several kilobytes of bloat.
    [andersen at dillweed tmp]$ ./test 
    error: 
Compiles, but does not work as expected.  I'm not too worried
about this failure though.

> "%m" may be not support from libc4?

I don't know for sure.  I have not had a libc4 based Linux system
for about 7 years.  Does anyone use the old a.out libc4 anymore?

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the busybox mailing list