1 |
commit: 7c266d7a1854b3b1b543fb35036d3e4e6c3135cf |
2 |
Author: Tobias Klausmann <klausman <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 30 07:22:54 2016 +0000 |
4 |
Commit: Tobias Klausmann <klausman <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 30 07:25:22 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c266d7a |
7 |
|
8 |
sys-process/cronbase: avoid bash complaining about null bytes |
9 |
|
10 |
Newer versions of bash warn about null bytes in command substitutions, |
11 |
so run-crons would generate mails with messages like this: |
12 |
|
13 |
/usr/sbin/run-crons: line 59: warning: command substitution: ignored null byte in input |
14 |
/usr/sbin/run-crons: line 59: warning: command substitution: ignored null byte in input |
15 |
/usr/sbin/run-crons: line 60: warning: command substitution: ignored null byte in input |
16 |
/usr/sbin/run-crons: line 60: warning: command substitution: ignored null byte in input |
17 |
|
18 |
Since the warning is not useful and the resultant string has its null |
19 |
bytes deleted, we might as well delete them with tr and get rid of the |
20 |
warning. |
21 |
|
22 |
.../cronbase/{cronbase-0.3.7-r1.ebuild => cronbase-0.3.7-r2.ebuild} | 0 |
23 |
sys-process/cronbase/files/run-crons-0.3.7 | 6 ++++-- |
24 |
2 files changed, 4 insertions(+), 2 deletions(-) |
25 |
|
26 |
diff --git a/sys-process/cronbase/cronbase-0.3.7-r1.ebuild b/sys-process/cronbase/cronbase-0.3.7-r2.ebuild |
27 |
similarity index 100% |
28 |
rename from sys-process/cronbase/cronbase-0.3.7-r1.ebuild |
29 |
rename to sys-process/cronbase/cronbase-0.3.7-r2.ebuild |
30 |
|
31 |
diff --git a/sys-process/cronbase/files/run-crons-0.3.7 b/sys-process/cronbase/files/run-crons-0.3.7 |
32 |
index c661c77..c5f2d9c 100755 |
33 |
--- a/sys-process/cronbase/files/run-crons-0.3.7 |
34 |
+++ b/sys-process/cronbase/files/run-crons-0.3.7 |
35 |
@@ -56,8 +56,10 @@ grab_lock() { |
36 |
|
37 |
# This is better than kill -0 because we can verify that it's really |
38 |
# another run-crons process. |
39 |
- cmdline1=$(cat "/proc/${cronpid}/cmdline" 2>/dev/null) || : |
40 |
- cmdline2=$(cat /proc/$$/cmdline) |
41 |
+ # The tr call deletes null bytes so newer bash versions do not complain |
42 |
+ # about them. |
43 |
+ cmdline1=$(tr -d '\0' < "/proc/${cronpid}/cmdline" 2>/dev/null) || : |
44 |
+ cmdline2=$(tr -d '\0' < /proc/$$/cmdline) |
45 |
if [ "${cmdline1}" = "${cmdline2}" ] ; then |
46 |
# Whoa, another run-crons is really running. |
47 |
return 1 |