[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionall
From: |
Paul Eggert |
Subject: |
bug#9076: coreutils-8.12 uses SA_RESETHAND and SA_RESTART unconditionally |
Date: |
Thu, 14 Jul 2011 15:33:00 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Thunderbird/3.1.11 |
[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.
* lib/signal.in.h (SA_RESETHAND, SA_RESTART): Default to 0.
* doc/posix-functions/sigaction.texi (sigaction): Document this,
and document NonStop portability issues. See Joachim Schmitz in
<http://lists.gnu.org/archive/html/bug-coreutils/2011-07/msg00062.html>.
diff --git a/doc/posix-functions/sigaction.texi
b/doc/posix-functions/sigaction.texi
index d03e516..583d112 100644
--- a/doc/posix-functions/sigaction.texi
+++ b/doc/posix-functions/sigaction.texi
@@ -11,6 +11,11 @@ Portability problems fixed by Gnulib:
@item
This function is missing on some platforms:
mingw.
+
address@hidden
+Some systems do not define the flag SA_NODEFER.
+NonStop does not define the flags SA_RESETHAND and SA_RESTART.
+Gnulib defines missing flags to zero, which means they have no effect.
@end itemize
Portability problems not fixed by Gnulib:
@@ -33,8 +38,12 @@ missing on some platforms:
mingw.
@item
+Support for SA_RESETHAND is missing on some platforms:
+NonStop.
+
address@hidden
Support for SA_RESTART is missing on some platforms:
-mingw.
+mingw, NonStop.
@item
In spite of having SA_SIGACTION, struct sigaction lacks the
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 93787f7..6765fa3 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -417,10 +417,16 @@ _GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
# endif
#endif
-/* Some systems don't have SA_NODEFER. */
+/* Some systems don't have flags. They default to 0, i.e., no effect. */
#ifndef SA_NODEFER
# define SA_NODEFER 0
#endif
+#ifndef SA_RESETHAND
+# define SA_RESETHAND 0
+#endif
+#ifndef SA_RESTART
+# define SA_RESTART 0
+#endif
#endif /* address@hidden@_SIGNAL_H */