[klibc] Shell scripts broken in klibc-0.114

Patrick J. LoPresti patl at users.sourceforge.net
Sun Feb 22 23:09:23 PST 2004


In klibc-0.114, any shell script like this:

======================================================================
#!/path/to/klibc-0.114/ash/sh

echo hi
======================================================================

...elicits the following error when executed:

  /var/tmp/hack.sh: Can't open /var/tmp/hack.sh

Running under strace, I get:

    execve("/var/tmp/hack.sh", ["/var/tmp/hack.sh"], [/* 37 vars */]) = 0
    sigaction(SIGCHLD, {SIG_DFL}, {SIG_DFL}, 0x420277b8) = 0
    getpid()                                = 4421
    getuid()                                = 10171
    mmap2(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0) = 0x40000000
    open(umovestr: Input/output error
    0x1, O_RDONLY)                     = -1 EFAULT (Bad address)
    write(2, "/var/tmp/hack.sh: Can\'t open /va"..., 46/var/tmp/hack.sh: Can't open
    /var/tmp/hack.sh
    ) = 46
    _exit(2)                                = ?

I suspect this has something to do with register parameters, since the
following patch fixes the problem for me:

--- klibc/arch/i386/MCONFIG~	2004-02-21 17:49:26.000000000 -0500
+++ klibc/arch/i386/MCONFIG	2004-02-22 17:59:58.000000000 -0500
@@ -9,7 +9,7 @@
 
 # Enable this to compile with register parameters; only safe for
 # gcc > 3
-REGPARM_OPT := -mregparm=3 -DREGPARM
+#REGPARM_OPT := -mregparm=3 -DREGPARM
 
 gcc_major := $(shell $(CC) -v 2>&1 | awk '/gcc version/{print int($$3)}')
 


This is a real downer when using klibc+ash for /linuxrc :-).

My GCC identifies itself as "gcc version 3.2.2 20030222 (Red Hat Linux
3.2.2-5)".

 - Pat



More information about the klibc mailing list