Hi Alexander,

Alexander Jones wrote:
Could this be a race condition? I don't believe "true" actually reads
from stdin, so perhaps it's finishing execution before the piped
output is written to its stdin? That would cause the SIGPIPE.

Thanks! This is exactly the problem. The ed filter assumes that when it has finished reading the output of the shell command, the shell command would have consumed its input. This is false for any command that does not read from its standard input, not only ':' or 'true':

$ ed ed-1.22/doc/ed.info
73192
1,1600!:
$ ed ed-1.22/doc/ed.info
73192
1,1600!lzip -V

I couldn't reproduce it before because the test file is too small. With a large enough file, ed is reliably terminated by SIGPIPE.

Now I need to think about how to fix this reliably without ignoring SIGPIPE for commands that do read from their standard input.

Best regards,
Antonio.

Reply via email to