diff --git a/close-wait-program.patch b/close-wait-program.patch new file mode 100644 index 0000000..a9ef843 --- /dev/null +++ b/close-wait-program.patch @@ -0,0 +1,49 @@ +2018-07-06 Richard Biener + + * lib/remote.exp (close_wait_program): Use separate kill command + for each pid. + +Index: dejagnu-1.6.1/lib/remote.exp +=================================================================== +--- dejagnu-1.6.1.orig/lib/remote.exp ++++ dejagnu-1.6.1/lib/remote.exp +@@ -70,13 +70,16 @@ proc close_wait_program { program_id pid + # Tcl has no kill primitive, so we have to execute an external + # command in order to kill the process. + verbose "doing kill, pid is $pid" +- # Prepend "-" to generate the "process group ID" needed by +- # kill. +- set pgid "-$pid" + # Send SIGINT to give the program a better chance to interrupt + # whatever it might be doing and react to stdin closing. + # eg, in case of GDB, this should get it back to the prompt. +- exec sh -c "exec > /dev/null 2>&1 && (kill -2 $pgid || kill -2 $pid)" ++ # Do so separately for each PID in the list to avoid differences ++ # in return value behavior for kill between shells ++ foreach spid $pid { ++ # Prepend "-" to generate the "process group ID" needed by ++ # kill. ++ exec sh -c "exec > /dev/null 2>&1 && (kill -2 -$spid || kill -2 $spid)" ++ } + + # If the program doesn't exit gracefully when stdin closes, + # we'll need to kill it. But only do this after 'wait'ing a +@@ -86,9 +89,15 @@ proc close_wait_program { program_id pid + # PID reuse race. + set secs 5 + set sh_cmd "exec > /dev/null 2>&1" +- append sh_cmd " && sleep $secs && (kill -15 $pgid || kill -15 $pid)" +- append sh_cmd " && sleep $secs && (kill -9 $pgid || kill -9 $pid)" +- append sh_cmd " && sleep $secs" ++ append sh_cmd " && sleep $secs && (" ++ foreach spid $pid { ++ append sh_cmd "(kill -15 -$spid || kill -15 $spid);" ++ } ++ append sh_cmd ") && sleep $secs && (" ++ foreach spid $pid { ++ append sh_cmd "(kill -9 -$spid || kill -9 $spid);" ++ } ++ append sh_cmd ") && sleep $secs" + set exec_pid [exec sh -c "$sh_cmd" &] + } + verbose "pid is $pid" diff --git a/dejagnu.changes b/dejagnu.changes index affe1fd..48bf8e3 100644 --- a/dejagnu.changes +++ b/dejagnu.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jul 17 13:13:19 UTC 2018 - schwab@suse.de + +- close-wait-program.patch: Use separate kill command for each pid + (bsc#1100206) +- Use %license. + ------------------------------------------------------------------- Tue Oct 17 07:25:25 UTC 2017 - schwab@suse.de diff --git a/dejagnu.spec b/dejagnu.spec index cdf7f51..ddd7a16 100644 --- a/dejagnu.spec +++ b/dejagnu.spec @@ -1,7 +1,7 @@ # # spec file for package dejagnu # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,13 +20,14 @@ Name: dejagnu Version: 1.6.1 Release: 0 Summary: Framework for Running Test Suites on Software Tools -License: GPL-2.0+ +License: GPL-2.0-or-later Group: Development/Tools/Building Url: https://www.gnu.org/software/dejagnu/ Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz.sig Source2: http://savannah.gnu.org/project/memberlist-gpgkeys.php?group=dejagnu&download=1#/%{name}.keyring Source3: site.exp +Patch0: close-wait-program.patch BuildRequires: expect BuildRequires: fdupes BuildRequires: gcc-c++ @@ -65,6 +66,7 @@ suites themselves. %prep %setup -q +%patch0 -p1 %build %configure @@ -87,7 +89,8 @@ ln -s -f %{_sysconfdir}/dejagnu/site.exp %{buildroot}%{_datadir}/dejagnu/site.ex %files %defattr(-, root, root) -%doc ChangeLog COPYING NEWS README AUTHORS TODO +%license COPYING +%doc ChangeLog NEWS README AUTHORS TODO %dir %{_datadir}/dejagnu %dir %{_sysconfdir}/dejagnu %{_bindir}/runtest