Re: grep 2.3-7 is broken (was Re: compiler issues and some booboos)
Package: libc6
Version: 2.1.2-4
We have a problem on at sparc64 with grep, newest potato version
(2.3-7), whenver grepping over binary files (or some report on any
files). Normally, that pacakge is defined with HAVE_MMAP, as one
would expect. However, that seems to result in a bad build somehow.
Strace says:
fstat(3, {st_mode=S_IFREG|0644, st_size=7399840, ...}) = 0
mmap(NULL, 0, PROT_NONE, MAP_FILE, 0, 0) = -1 EINVAL (Invalid argument)
read(3, 0x34000, 32768) = -1 EFAULT (Bad address)
See full strace log below.
If we do '#undef HAVE_MMAP' then grep works fine.
We originally thought this was a grep bug, but ...
Wichert Akkerman <wakkerma@cs.leidenuniv.nl> writes:
> This has to be a libc6 or autobuilder-bug. Between -5 and -7 absolutely
> nothing was changed in the grep-code, only in the way the package is
> installed..
More vital stats:
Linux arroz 2.2.12 #1 Sun Sep 12 03:02:07 EDT 1999 sparc64 unknown
ii gcc 2.95.2-0pre1 The GNU C compiler.
--
.....Adam Di Carlo....adam@onShore.com.....<URL:http://www.onShore.com/>
execve("/bin/grep", ["grep", "foo", "/amnt/burrito-home/apharris/uls/sunsparc-arws-40.tar.gz"], [/* 48 vars */]) = 0
brk(0) = 0x2f708
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=15273, ...}) = 0
mmap(ptrace: umoven: Input/output error
) = 0x7001a000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=970476, ...}) = 0
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\2\0\0\0\1\0\1\342"..., 8192) = 8192
mmap(ptrace: umoven: Input/output error
) = 0x7002a000
mprotect(0x70112000, 95096, PROT_NONE) = 0
mmap(NULL, 0, PROT_NONE, MAP_FILE, 0, 0) = 0x7011a000
mmap(NULL, 0, PROT_NONE, MAP_FILE, 0, 0) = 0x70126000
close(3) = 0
mmap(ptrace: umoven: Input/output error
) = 0x7001e000
munmap(0x7001a000, 15273) = 0
personality(PER_LINUX) = 0
getpid() = 24403
getpagesize() = 0x2000
brk(0) = 0x2f708
brk(0x2f8a8) = 0x2f8a8
brk(0x30000) = 0x30000
brk(0x32000) = 0x32000
open("/amnt/burrito-home/apharris/uls/sunsparc-arws-40.tar.gz", O_RDONLY) = 3
brk(0x40000) = 0x40000
fstat(3, {st_mode=S_IFREG|0644, st_size=7399840, ...}) = 0
mmap(NULL, 0, PROT_NONE, MAP_FILE, 0, 0) = -1 EINVAL (Invalid argument)
read(3, 0x34000, 32768) = -1 EFAULT (Bad address)
write(2, "grep: /amnt/burrito-home/apharri"..., 75grep: /amnt/burrito-home/apharris/uls/sunsparc-arws-40.tar.gz: Bad address
) = 75
close(3) = 0
close(1) = 0
exit(2) = ?
Reply to: