Explorar el Código

libdpkg: Set used signals in test suite to their default action

This fixes build failures when SIGINT, SIGTERM or SIGPIPE are set to
ignore the signals.
Guillem Jover hace 11 años
padre
commit
14dff6e0c3
Se han modificado 2 ficheros con 10 adiciones y 0 borrados
  1. 3 0
      debian/changelog
  2. 7 0
      lib/dpkg/t/t-subproc.c

+ 3 - 0
debian/changelog

@@ -59,6 +59,9 @@ dpkg (1.18.2) UNRELEASED; urgency=low
     - Future-proof tar invocations in Dpkg::Source::Archive for options that
     - Future-proof tar invocations in Dpkg::Source::Archive for options that
       might become positional in the future, and by always placing function
       might become positional in the future, and by always placing function
       options first.
       options first.
+  * Test suite:
+    - Set SIGINT, SIGTERM and SIGPIPE to their default actions to get
+      deterministic behavior.
   * Packaging:
   * Packaging:
     - Make the libdpkg-dev package Multi-Arch:same.
     - Make the libdpkg-dev package Multi-Arch:same.
     - Mark libio-string-perl as <!nocheck>.
     - Mark libio-string-perl as <!nocheck>.

+ 7 - 0
lib/dpkg/t/t-subproc.c

@@ -34,9 +34,16 @@
 static void
 static void
 test_subproc_fork(void)
 test_subproc_fork(void)
 {
 {
+	struct sigaction sa;
 	pid_t pid;
 	pid_t pid;
 	int ret;
 	int ret;
 
 
+	memset(&sa, 0, sizeof(sa));
+	sa.sa_handler = SIG_DFL;
+	sigaction(SIGINT, &sa, NULL);
+	sigaction(SIGTERM, &sa, NULL);
+	sigaction(SIGPIPE, &sa, NULL);
+
 	/* Test exit(). */
 	/* Test exit(). */
 	pid = subproc_fork();
 	pid = subproc_fork();
 	if (pid == 0)
 	if (pid == 0)