commit:     d2d619f187661a12b4ed0dfed504fba057251f92
Author:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  3 17:17:57 2016 +0000
Commit:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
CommitDate: Mon Oct  3 17:19:08 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2d619f1

sys-process/cronbase: Fix the parall-job check once and for all.

Thanks to Dan Goodliffe for suggesting this approach.

Gentoo-Bug: 595492

 .../cronbase/{cronbase-0.3.7-r4.ebuild => cronbase-0.3.7-r5.ebuild} | 0
 sys-process/cronbase/files/run-crons-0.3.7                          | 6 +-----
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/sys-process/cronbase/cronbase-0.3.7-r4.ebuild 
b/sys-process/cronbase/cronbase-0.3.7-r5.ebuild
similarity index 100%
rename from sys-process/cronbase/cronbase-0.3.7-r4.ebuild
rename to sys-process/cronbase/cronbase-0.3.7-r5.ebuild

diff --git a/sys-process/cronbase/files/run-crons-0.3.7 
b/sys-process/cronbase/files/run-crons-0.3.7
index 958ef06..902794e 100755
--- a/sys-process/cronbase/files/run-crons-0.3.7
+++ b/sys-process/cronbase/files/run-crons-0.3.7
@@ -56,11 +56,7 @@ grab_lock() {
 
                # This is better than kill -0 because we can verify that it's 
really
                # another run-crons process.
-               # The tr call deletes null bytes so newer bash versions do not 
complain
-               # about them.
-               cmdline1=$(sed -e 's/\0/ /g' "/proc/${cronpid}/cmdline" 
2>/dev/null) || :
-               cmdline2=$(sed -e 's/\0/ /g' /proc/$$/cmdline)
-               if [ "${cmdline1}" = "${cmdline2}" ] ; then
+               if diff -qs /proc/{${cronpid},$$}/cmdline > /dev/null 2>&1; then
                        # Whoa, another run-crons is really running.
                        return 1
                fi

Reply via email to