dd dies on SIGUSR1

Chris Rees utisoft at gmail.com
Tue Mar 22 17:27:53 UTC 2011

On 22 March 2011 14:57, Oliver Fromme <olli at lurza.secnetix.de> wrote:
> Chris Rees <utisoft at gmail.com> wrote:
>  > Maxim Konovalov <maxim.konovalov at gmail.com> wrote:
>  > > FreeBSD uses SIGINFO for such purposes for ages in many programs
>  > > apart from dd(1).  IMHO, nothing to fix here.
>  >
>  > Of course, and I'm not suggesting that FreeBSD is wrong in any way.
>  >
>  > My point was that it was rather a harsh punishment for using a GNU-ism
>  > where dd died after 30 minutes of chugging or so.
> Well, when it died, it did exactly what you told it to:
> Terminating the process is the default action for SIGUSR1,
> see signal(3), and the dd(1) manpage doesn't mention that
> SIGUSR1 is used for anything (in rather states that SIGINFO
> is used for the purpose that you intended), so the default
> action applies.
> I tend to agree with Maxim here.
>  > Would it hurt for dd to ignore the signal rather than die? I imagine a
>  > lot less than otherwise.
> But then -- for consistency -- you would have to apply the
> same patch to *all* programs that use SIGINFO, such as dump
> and tar.  And what should be done if a program uses SIGINFO
> for status display *and* SIGUSR1 for something completely
> unrelated, such as ftp(1)?
> Best regards
>   Oliver

Thanks very much for your feedback.

/* XXX
*  If I'm flogging a dead horse, please tell me to shut up, because I
probably won't otherwise.

Since POSIX has SIGUSR[12] as undefined, I think it's a POLA violation
to have processes die when provided.

As I see it, the advantages of changing the default behaviour of
SIGUSR[12] are as follows:

- It's often used by other platforms for other purposes; ignoring is
less astonishing than death

- Evidently it confuses many others, see the Wiki article [1], and I quote:
'Mac OS X's dd will break on USR1' [more astonishment]

The disadvantages:

- scripts relying on USR1 and USR2 for death break (is this remotely a
good idea??)

I then propose that for consistency between apps as you already
suggested, and to be less astonishing SIGUSR1 and SIGUSR2 could be
changed to ignore by default?

I'm happy to put a patch into the PR if necessary.

Most importantly, will this make any difference to anyone but refugees
from That Other OS, and will this difference be negative in any way?


[1] http://en.wikipedia.org/wiki/SIGUSR1_and_SIGUSR2

More information about the freebsd-standards mailing list