1 |
commit: 741f6b4ca936e4fc82c99145bb8ced457149d28e |
2 |
Author: Tobias Klausmann <klausman <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Oct 2 08:46:32 2016 +0000 |
4 |
Commit: Tobias Klausmann <klausman <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 2 08:48:39 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=741f6b4c |
7 |
|
8 |
sys-process/cronbase: More fixes |
9 |
|
10 |
The tr approach is racy, even with the test -r before it. Since tr can't |
11 |
be told to read from a file and we can't redirect the subshell's warning |
12 |
message, switch to sed and a file argument, then redirect stderr of |
13 |
that. |
14 |
|
15 |
.../cronbase/{cronbase-0.3.7-r3.ebuild => cronbase-0.3.7-r4.ebuild} | 0 |
16 |
sys-process/cronbase/files/run-crons-0.3.7 | 4 ++-- |
17 |
2 files changed, 2 insertions(+), 2 deletions(-) |
18 |
|
19 |
diff --git a/sys-process/cronbase/cronbase-0.3.7-r3.ebuild b/sys-process/cronbase/cronbase-0.3.7-r4.ebuild |
20 |
similarity index 100% |
21 |
rename from sys-process/cronbase/cronbase-0.3.7-r3.ebuild |
22 |
rename to sys-process/cronbase/cronbase-0.3.7-r4.ebuild |
23 |
|
24 |
diff --git a/sys-process/cronbase/files/run-crons-0.3.7 b/sys-process/cronbase/files/run-crons-0.3.7 |
25 |
index ce8ff76..958ef06 100755 |
26 |
--- a/sys-process/cronbase/files/run-crons-0.3.7 |
27 |
+++ b/sys-process/cronbase/files/run-crons-0.3.7 |
28 |
@@ -58,8 +58,8 @@ grab_lock() { |
29 |
# another run-crons process. |
30 |
# The tr call deletes null bytes so newer bash versions do not complain |
31 |
# about them. |
32 |
- cmdline1=$([ -r "/proc/${cronpid}/cmdline" ] && tr -d '\0' < "/proc/${cronpid}/cmdline" 2>/dev/null) || : |
33 |
- cmdline2=$(tr -d '\0' < /proc/$$/cmdline) |
34 |
+ cmdline1=$(sed -e 's/\0/ /g' "/proc/${cronpid}/cmdline" 2>/dev/null) || : |
35 |
+ cmdline2=$(sed -e 's/\0/ /g' /proc/$$/cmdline) |
36 |
if [ "${cmdline1}" = "${cmdline2}" ] ; then |
37 |
# Whoa, another run-crons is really running. |
38 |
return 1 |