I have the following script:

----------------------------------------------------
#!/bin/hush

if false
then
        echo "test line 1"
        tmp=`ping -justawrongoption 127.0.0.1`
fi
----------------------------------------------------

if i execute i get:

/hdd/bustest # ./test.sh
ping: illegal option -- j
BusyBox v1.10.0 (2008-04-23 23:53:40 CEST) multi-call binary

Usage: ping [OPTION]... host

Send ICMP ECHO_REQUEST packets to network hosts

Options:
        -4, -6          Force IPv4 or IPv6 hostname resolution
        -c CNT          Send only CNT pings
        -s SIZE         Send SIZE data bytes in packets (default=56)
        -I iface/IP     Use interface or IP address as source
        -q              Quiet, only displays output at start
                        and when finished


(i understand that i cant use the -justawongoption, but its just for
testing)

The result is wrong
it should never run the 2e line "tmp=`ping -justawongoption 127.0.0.1`

is this a know bug?
do i make some error?


if i change the script to:

----------------------------------------------------
#!/bin/hush

if false
then
        echo "test line 1"
        tmp=`echo test`
fi
----------------------------------------------------

and a do a strace i get:

/hdd/bustest # strace ./test.sh
execve("./test.sh", ["./test.sh"], [/* 4 vars */]) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1ca0000
getcwd("/hdd/bustest", 192)             = 13
open("/etc/profile", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, TCGETS, 0x15bce58)             = -1 ENOTTY (Inappropriate ioctl for
device)
old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1cbe000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1cc3000
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
read(3, "# ~/.bashrc: executed by bash(1)"..., 4096) = 158
wait4(-1, 0x15bce30, WNOHANG|WUNTRACED, NULL) = -1 ECHILD (No child
processes)
read(3, "", 4096)                       = 0
close(3)                                = 0
open("./test.sh", O_RDONLY|O_LARGEFILE) = 3
ioctl(3, TCGETS, 0x15bce50)             = -1 ENOTTY (Inappropriate ioctl for
device)
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
read(3, "#!/bin/sh\n\nif false\nthen\n\techo \""..., 4096) = 66
pipe([4, 5])                            = 0
vfork()                                 = 94
--- SIGCHLD (Child exited) @ 0 (0) ---
close(5)                                = 0
fcntl(4, F_GETFL)                       = 0 (flags O_RDONLY)
ioctl(4, TCGETS, 0x15bcd24)             = -1 EINVAL (Invalid argument)
old_mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, 0, 0) =
0x1cb1000
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
read(4, "test\n", 4096)                 = 5
read(4, "", 4096)                       = 0
close(4)                                = 0
vfork()                                 = 95
wait4(-1, [WIFEXITED(s) && WEXITSTATUS(s) == 0], WUNTRACED, NULL) = 94
wait4(-1, [WIFEXITED(s) && WEXITSTATUS(s) == 1], WUNTRACED, NULL) = 95
--- SIGCHLD (Child exited) @ 0 (0) ---
wait4(-1, 0x15bcdbc, WNOHANG|WUNTRACED, NULL) = -1 ECHILD (No child
processes)
wait4(-1, 0x15bce30, WNOHANG|WUNTRACED, NULL) = -1 ECHILD (No child
processes)
read(3, "", 4096)                       = 0
_exit(1)                                = ?
/hdd/bustest #


config is attached


Attachment: .config
Description: Binary data

_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to