[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test-sigaction vs SA_RESTORER test failure
From: |
Eric Blake |
Subject: |
Re: test-sigaction vs SA_RESTORER test failure |
Date: |
Mon, 23 Jun 2008 06:26:16 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080421 Thunderbird/2.0.0.14 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Jim Meyering on 6/23/2008 2:12 AM:
| 83 ASSERT (old_sa.sa_flags == 0);
|
| And the value of old_sa.sa_flags is 0x4000000,
| which happens to be SA_RESTORER.
Ah. An extension flag, not defined by POSIX. In short, gnulib can't make
any assumptions about the state of bits outside of what POSIX requires.
So I'm checking in this; let me know if it fixes the problem.
|
| I was about to make a snapshot, now that coreutils uses
| the "open" module to address a recent truncate test failure,
| but will hold off until this is fixed.
|
Hmm. Should the open-safer module depend on open?
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkhflmgACgkQ84KuGfSFAYBoKACgwZ5X55FWpHAtMBOXBozE4zQA
p4AAniHbA4OBuIqD4/h2I1naT7yUQ3Fr
=S4IU
-----END PGP SIGNATURE-----
>From bc1842b36da8d92e81eaf94b8e13d8f6e0afc63e Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 23 Jun 2008 06:24:53 -0600
Subject: [PATCH] Avoid test failure due to SA_RESTORER.
* tests/test-sigaction.c (SA_MASK): New macro.
(main): Avoid failing due to extension flags being set.
Reported by Jim Meyering.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 5 +++++
tests/test-sigaction.c | 17 ++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fe2dade..414c0df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2008-06-23 Eric Blake <address@hidden>
+ Avoid test failure due to SA_RESTORER.
+ * tests/test-sigaction.c (SA_MASK): New macro.
+ (main): Avoid failing due to extension flags being set.
+ Reported by Jim Meyering.
+
Revert use of sig-handler.h in sigprocmask.c.
* modules/sigprocmask (Files): Don't rely on sig-handler.h, since
it requires the existence of struct sigaction.
diff --git a/tests/test-sigaction.c b/tests/test-sigaction.c
index 81abe89..e009bf6 100644
--- a/tests/test-sigaction.c
+++ b/tests/test-sigaction.c
@@ -36,9 +36,24 @@
} \
while (0)
+#ifndef SA_NOCLDSTOP
+# define SA_NOCLDSTOP 0
+#endif
+#ifndef SA_ONSTACK
+# define SA_ONSTACK 0
+#endif
#ifndef SA_SIGINFO
# define SA_SIGINFO 0
#endif
+#ifndef SA_NOCLDWAIT
+# define SA_NOCLDWAIT 0
+#endif
+
+/* Define a mask of flags required by POSIX. Some implementations
+ provide other flags as extensions, such as SA_RESTORER, that we
+ must ignore in this test. */
+#define SA_MASK (SA_NOCLDSTOP | SA_ONSTACK | SA_RESETHAND | SA_RESTART \
+ SA_SIGINFO | SA_NOCLDWAIT | SA_NODEFER)
/* This test is unsafe in the presence of an asynchronous SIGABRT,
because we install a signal-handler that is intentionally not
@@ -80,7 +95,7 @@ main (int argc, char *argv[])
ASSERT (raise (SIGABRT) == 0);
sa.sa_flags = SA_RESETHAND | SA_NODEFER;
ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0);
- ASSERT (old_sa.sa_flags == 0);
+ ASSERT ((old_sa.sa_flags & SA_MASK) == 0);
ASSERT (old_sa.sa_handler == handler);
ASSERT (raise (SIGABRT) == 0);
sa.sa_handler = SIG_DFL;
--
1.5.6