[slackware-alphadevel] Bug report: fortune

From: Jesper Juhl (juhl@eisenstein.dk)
Date: Fri Dec 01 2000 - 06:01:01 PST


The 'fortune' program does not work correctly - it generates no output:

root@odin:~# /usr/games/fortune
root@odin:~#

I cannot get the source to build (I must admit that I did not try very
hard), the configure script crashes with a segmentation fault after the
question about 'Binary group'.

A strace of fortune produces the following output:

root@odin:~# strace /usr/games/fortune
execve("/usr/games/fortune", ["/usr/games/fortune"], [/* 32 vars */]) = 0
brk(0) = 0x120104da8
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=39567, ...}) = 0
mmap(NULL, 39567, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2000001e000
close(3) = 0
open("/lib/libc.so.6.1", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=7827785, ...}) = 0
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0&\220\1\0\0\0\340\37"...,
8192) = 8192
mmap(NULL, 2309144, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =
0x20000120000
mprotect(0x20000244000, 1113112, PROT_NONE) = 0
mmap(0x20000340000, 57344, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED, 3, 0x120000) = 0x20000340000mmap(0x2000034e000,
23576, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2000034e000
close(3) = 0
munmap(0x2000001e000, 39567) = 0
personality(PER_LINUX) = 0
getxpid() = 865
getxgid(0x1) = 0
getxgid(0x1) = 0
setregid(0, 0) = 0
brk(0) = 0x120104da8
brk(0x120104df8) = 0x120104df8
brk(0x120106000) = 0x120106000
stat("/usr/games/lib/fortunes/fortunes", {st_mode=S_IFREG|0644,
st_size=582080, ...}) = 0
open("/usr/games/lib/fortunes/fortunes", O_RDONLY) = 3
access("/usr/games/lib/fortunes/fortunes.dat", R_OK) = 0
gettimeofday({975715398, 313249}, NULL) = 0
getxpid() = 865
open("/usr/games/lib/fortunes/fortunes.dat", O_RDONLY) = 4
read(4, "\0\0\0\1\0\0\r\326\0\0\10J\0\0\0\v\0\0\0\1%\0\0\0", 24) = 24
close(4) = 0
open("/usr/games/lib/fortunes/fortunes.dat", O_RDONLY) = 4
lseek(4, 19928, SEEK_SET) = 19928
read(4, "\0\0\0\0\0\6 \341\0\0\0\0\0\6!&", 16) = 16
fcntl(3, F_GETFL) = 0 (flags O_RDONLY)
fstat(3, {st_mode=S_IFREG|0644, st_size=582080, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x2000001e000
lseek(3, 0, SEEK_CUR) = 0
lseek(3, 541065216, SEEK_SET) = 541065216
read(3, "", 32) = 0
lseek(3, 32, SEEK_CUR) = 541065248
read(3, "", 8192) = 0
exit(0) = ?

If I read the above correctly, it succeeds in opening
/usr/games/lib/fortunes/fortunes.dat in read-only mode as filedescriptor
4 but then goes on to seek on descriptor 3 (stderr) - that seems like a
strange thing to do. I'd expect it to seek to some random position on
descriptor 4 to find the entry to display... Either some error occours
that it attempts to log to stderr (but in that case I'd expect a non-zero
exit status) or it gets its filedescriptors mixed up - in any case it
does not work right.

/Jesper Juhl - juhl@eisenstein.dk



This archive was generated by hypermail 2b30 : Fri May 09 2003 - 10:00:02 PDT