bug-coreutils
[Top][All Lists]
Advanced

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

Re: dd hangs with SIGINT


From: Paul Eggert
Subject: Re: dd hangs with SIGINT
Date: Thu, 07 Apr 2005 12:07:15 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]