From: Andreas Sturmlechner Date: Wed, 20 May 2020 16:55:29 +0000 (+0200) Subject: sys-libs/libnih: Fix 1/2 broken tests X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f6fdb2630152ae7803932d9e13cbf1d11183fbae;p=gentoo.git sys-libs/libnih: Fix 1/2 broken tests Bug: https://bugs.gentoo.org/623930 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Andreas Sturmlechner --- diff --git a/sys-libs/libnih/files/libnih-1.0.3-expat-2.2.5.patch b/sys-libs/libnih/files/libnih-1.0.3-expat-2.2.5.patch new file mode 100644 index 000000000000..02b5e4c0a9e2 --- /dev/null +++ b/sys-libs/libnih/files/libnih-1.0.3-expat-2.2.5.patch @@ -0,0 +1,15 @@ +Description: Adapt test suite to expat 2.2.5 +Author: Axel Beckert +Bug-Debian: https://bugs.debian.org/886416 + +--- a/nih-dbus-tool/tests/test_parse.c ++++ b/nih-dbus-tool/tests/test_parse.c +@@ -7950,7 +7950,7 @@ + + TEST_EQ_P (node, NULL); + +- TEST_FILE_EQ (output, ("test:foo:2:0: " ++ TEST_FILE_EQ (output, ("test:foo:1:36: " + "Invalid object path in name attribute\n")); + TEST_FILE_END (output); + TEST_FILE_RESET (output); diff --git a/sys-libs/libnih/files/libnih-1.0.3-glibc-2.24.patch b/sys-libs/libnih/files/libnih-1.0.3-glibc-2.24.patch new file mode 100644 index 000000000000..9b90f3539d7c --- /dev/null +++ b/sys-libs/libnih/files/libnih-1.0.3-glibc-2.24.patch @@ -0,0 +1,57 @@ +With glibc >= 2.24, raise() temporarily blocks signals to make this +function async-signal-safe. This has the consequence that the SIGCONT +signal send by the call to PTRACE_CONT is delivered slightly later. In +turn it means the next ptrace event received is the SIGCONT signal +instead of the expected one. + +Unfortunately the libnih testsuite has very precise expectations, and +do not expect such an event. Fix that by catching it and waiting for the +following event. + +--- libnih-1.0.3.orig/nih/tests/test_child.c ++++ libnih-1.0.3/nih/tests/test_child.c +@@ -360,6 +360,14 @@ test_poll (void) + + waitid (P_PID, pid, &siginfo, WSTOPPED | WNOWAIT); + ++ /* ptrace might catch the SIGCONT emitted with PTRACE_CONT, catch it ++ and wait for the next event. ++ */ ++ if (siginfo.si_code == CLD_TRAPPED && siginfo.si_status == SIGCONT) { ++ assert0 (ptrace (PTRACE_CONT, pid, NULL, NULL)); ++ waitid (P_PID, pid, &siginfo, WSTOPPED | WNOWAIT); ++ } ++ + watch = nih_child_add_watch (NULL, pid, NIH_CHILD_TRAPPED, + my_handler, &watch); + +@@ -420,6 +428,14 @@ test_poll (void) + /* Wait for ptrace to stop the parent (signalling the fork) */ + waitid (P_PID, pid, &siginfo, WSTOPPED | WNOWAIT); + ++ /* ptrace might catch the SIGCONT emitted with PTRACE_CONT, catch it ++ and wait for the next event. ++ */ ++ if (siginfo.si_code == CLD_TRAPPED && siginfo.si_status == SIGCONT) { ++ assert0 (ptrace (PTRACE_CONT, pid, NULL, NULL)); ++ waitid (P_PID, pid, &siginfo, WSTOPPED | WNOWAIT); ++ } ++ + /* Will be able to get the child pid now, we have to do it here + * because we want to wait on it to ensure the test is synchronous; + * otherwise nih_child_poll() could actually eat the child event +@@ -489,6 +505,14 @@ test_poll (void) + + waitid (P_PID, pid, &siginfo, WSTOPPED | WNOWAIT); + ++ /* ptrace might catch the SIGCONT emitted with PTRACE_CONT, catch it ++ and wait for the next event. ++ */ ++ if (siginfo.si_code == CLD_TRAPPED && siginfo.si_status == SIGCONT) { ++ assert0 (ptrace (PTRACE_CONT, pid, NULL, NULL)); ++ waitid (P_PID, pid, &siginfo, WSTOPPED | WNOWAIT); ++ } ++ + watch = nih_child_add_watch (NULL, pid, NIH_CHILD_PTRACE, + my_handler, &watch); + diff --git a/sys-libs/libnih/libnih-1.0.3-r4.ebuild b/sys-libs/libnih/libnih-1.0.3-r4.ebuild index fae185404cc4..e66de55d9379 100644 --- a/sys-libs/libnih/libnih-1.0.3-r4.ebuild +++ b/sys-libs/libnih/libnih-1.0.3-r4.ebuild @@ -23,10 +23,12 @@ DEPEND="${RDEPEND} sys-devel/gettext virtual/pkgconfig" PATCHES=( - "${FILESDIR}"/${PN}-1.0.3-optional-dbus.patch - "${FILESDIR}"/${PN}-1.0.3-pkg-config.patch - "${FILESDIR}"/${PN}-1.0.3-signal-race.patch - "${FILESDIR}"/${PN}-1.0.3-fno-common.patch + "${FILESDIR}"/${P}-optional-dbus.patch + "${FILESDIR}"/${P}-pkg-config.patch + "${FILESDIR}"/${P}-signal-race.patch + "${FILESDIR}"/${P}-fno-common.patch + "${FILESDIR}"/${P}-expat-2.2.5.patch + "${FILESDIR}"/${P}-glibc-2.24.patch ) src_prepare() {