commit:     741f6b4ca936e4fc82c99145bb8ced457149d28e
Author:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  2 08:46:32 2016 +0000
Commit:     Tobias Klausmann <klausman <AT> gentoo <DOT> org>
CommitDate: Sun Oct  2 08:48:39 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=741f6b4c

sys-process/cronbase: More fixes

The tr approach is racy, even with the test -r before it. Since tr can't
be told to read from a file and we can't redirect the subshell's warning
message, switch to sed and a file argument, then redirect stderr of
that.

 .../cronbase/{cronbase-0.3.7-r3.ebuild => cronbase-0.3.7-r4.ebuild}   | 0
 sys-process/cronbase/files/run-crons-0.3.7                            | 4 ++--
 2 files changed, 2 insertions(+), 2 deletions(-)

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

diff --git a/sys-process/cronbase/files/run-crons-0.3.7 
b/sys-process/cronbase/files/run-crons-0.3.7
index ce8ff76..958ef06 100755
--- a/sys-process/cronbase/files/run-crons-0.3.7
+++ b/sys-process/cronbase/files/run-crons-0.3.7
@@ -58,8 +58,8 @@ grab_lock() {
                # another run-crons process.
                # The tr call deletes null bytes so newer bash versions do not 
complain
                # about them.
-               cmdline1=$([ -r "/proc/${cronpid}/cmdline" ] && tr -d '\0'  < 
"/proc/${cronpid}/cmdline" 2>/dev/null) || :
-               cmdline2=$(tr -d '\0'  < /proc/$$/cmdline)
+               cmdline1=$(sed -e 's/\0/ /g' "/proc/${cronpid}/cmdline" 
2>/dev/null) || :
+               cmdline2=$(sed -e 's/\0/ /g' /proc/$$/cmdline)
                if [ "${cmdline1}" = "${cmdline2}" ] ; then
                        # Whoa, another run-crons is really running.
                        return 1

Reply via email to