Re: subshell output swallowed (patch)



Hi,

> Your first post implied that it was SIGCHLD
> interrupting a write() call which is reponsible for the broken ouput of
> `ls'.

I'm not 100% sure that sigchld is the _direct_ cause of the short write.
Maybe sigchld causes something else which in turn leads to a short write.

> What worries me is that you don't understand well what is the cause of the
> problem that you see.

Hey! When I first saw this bug, I didn't even know whether it was a bug in
gnome-terminal (where I had previously fixed several similar screen
corruption bugs), a bug in ls, or in mc. Or maybe somewhere else. But in
less than half hour I was able to locate this heuristical bug, I was able to
roughly explain what happens there, and finally I was able to create a fix
(or workaround).

And now you come and tell me you're worried that I don't understand every
single detail. :-)

You may be right, but it still sounds very funny. Okay, go on, please create
a different patch that solves the problem in The Right Way, explain me in
more details what's _exactly_ happening when that bug occurs, why _exactly_
that write is only a short write. If it is directly caused by the sigchld
then why doesn't Linux work as FreeBSD is documented to work, also a patch
to the Linux kernel would be extremely appreciated :-), and then I'll say
thank you for showing me the nice way of doing this. But until then please
accept that I didn't want and still don't want to _investigate_ more into
the problem than the absolute minimum to create the first fix. But, of
course, I'd be happy to _hear_ a more detailed explanation and see a nicest
solution from you.

> The code in the subshell is fragile and should be
> touched with extra care.

I replaced all occurances of a write() call with a wrapper function that
restarts write() in the two described cases: EINTR and short write. It was
approximately the 20th occasion I coded such a wrapper function in C around
the read() or write() calls. I've tested mc before submitting the patch, and
heavily use mc with this patch since then. Do you see any chance that my
patch breaks anything or still leaves the bug?



-- 
Egmont



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]