dwww: cat and file (pipe race condition)
Hi,
I'm reading my system documentation with dwww. However, with current
potato/woody versions of dwww and file I have trouble for some files
(i.e the web server hangs and reports a timeout)
Examples for "bad" files are
http://localhost/cgi-bin/dwww?type=file&location=/usr/doc/menu/html/ch3.html
or
http://localhost/cgi-bin/dwww?type=file&location=/usr/doc/menu/html/ch6.html
while
http://localhost/cgi-bin/dwww?type=file&location=/usr/doc/menu/html/ch2.html
works fine.
It seems, that the problem only occurs with longer (more than 10000 chars)
files. Looking for the cause of this problem, I found that the line
"$decompress $file | file -b - | magic2mime" in dwww-convert is responsible.
Apparently the $decompress command (which is actually 'cat') is not
finished when file has its job already done. I can find a 'dangling'
cat process with 'ps'. So the pipe is not closed and the system would
wait forever (actually just until the timeout is reached or cat is
killed).
I downloaded the source of the file package, but I don't know what
I need to change. How are such pipe problems normally handled?
Thanks,
Ulf
Reply to: