Subject: Re: bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally

From: Pádraig Brady <[email-masked]>
Date: Fri, 15 Jul 2011 01:25:27 +0100

On 14/07/11 23:33, Paul Eggert wrote:
> [CC'ing bug-gnulib re <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9076>.]
> 
> On 07/13/11 23:54, Joachim Schmitz wrote:
> 
>> coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally and on HP
>> NonStop these don't exist.
> 
> Thanks for reporting this.  I think
> coreutils used to be portable to hosts lacking those symbols,
> and there's a bit of code in dd.c that still assumes the
> old backward-compatibility stuff:
> 
> static void
> interrupt_handler (int sig)
> {
>   if (! SA_RESETHAND)
>     signal (sig, SIG_DFL);
>   interrupt_signal = sig;
> }
> 
> but I guess it got ripped out at some point, under the mistaken
> assumption that everybody has SA_RESETHAND nowadays.  Here's a proposed patch
> to gnulib to address this porting problem.

I'm not sure about defining these to 0 in gnulib.
That will silently ignore the intent of a program on certain platforms.
Wouldn't it be better to fail to compile so that each program then does:

#ifndef SA_RESETHAND
/* do something else */
#endif

cheers,
Pádraig.