Grep corrupt in BusyBox 1.15.2

Göran Hillebrink goran.hillebrink at transmode.com
Thu Dec 3 16:38:09 UTC 2009


Hi,

If I run the command:

echo "/var/test" | grep -o '[^/]*$'

I should get the result test but grep ends up in a forever loop.
See strace below.

Regards,
Goran


execve("/bin/grep", ["grep", "-o", "[^/]*$"], [/* 11 vars */]) = 0
uname({sys="Linux", node="local", ...}) = 0
brk(0)                                  = 0xc4000
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libcrypt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib", 0xaf98133c)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = -1 ENOENT (No such file or directory)
open("/lib/libcrypt.so.1", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0\300\r\0"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=17836, ...}) = 0
mmap2(NULL, 184768, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x3aabe000
mprotect(0x3aac2000, 168384, PROT_NONE) = 0
mmap2(0x3aac2000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1) = 0x3aac2000
mmap2(0x3aac6000, 152000, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3aac6000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0\274\250"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=856772, ...}) = 0
mmap2(NULL, 875488, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x3aaec000
mprotect(0x3abb8000, 39904, PROT_NONE)  = 0
mmap2(0x3abb8000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x65) = 0x3abb8000
mmap2(0x3abbe000, 15328, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3abbe000
close(3)                                = 0
getpid()                                = 1815
getpid()                                = 1815
brk(0)                                  = 0xc4000
brk(0xc4020)                            = 0xc4020
brk(0xc6000)                            = 0xc6000
getuid32()                              = 0
fstat64(0, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x3abc2000
read(0, "/var/test\n", 1024)            = 10
fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x3abc4000
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "test\n", 5test
)                   = 5
write(1, "\n", 1
)                       = 1
write(1, "\n", 1
)                       = 1
write(1, "\n", 1
)                       = 1
write(1, "\n", 1
)                       = 1
write(1, "\n", 1



More information about the busybox mailing list