There is a similar problem in csplit.c.  The simplest fix there is to
not print an error message when an interrupt occurs and a file can't
be removed afterwards, and I've prepared a draft patch to do that,
which I'd like to test a bit more before installing.

The resulting csplit program still calls strcpy, sprintf, and strlen
inside a signal handler, and then exits from the program by killing
the process before the handler returns.  POSIX doesn't say that these
three functions are async-signal-safe but I don't know of any host
where this method would fail, so I'm inclined to leave it alone even
if it's unportable in theory.

In looking over dd, I don't see such an easy fix as with csplit.  So I
think it's better to rewrite dd so that its signal handlers call only
functions that POSIX guarantees are async-signal-safe.  I've prepared
a draft patch to do that (the only function called from signal
handlers is 'signal'), but I'd like to test it a bit before submitting
it.  The downside is that the patch assumes the POSIX behavior where
read and write fail with errno==EINTR when interrupted, and so it
won't work on ancient hosts where there's no way to get the POSIX
behavior even with sigaction.  These days, though, I don't think we
need to worry about 4.3BSD hosts so I think this is OK.


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to