From 741f6b4ca936e4fc82c99145bb8ced457149d28e Mon Sep 17 00:00:00 2001 From: Tobias Klausmann Date: Sun, 2 Oct 2016 10:46:32 +0200 Subject: 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. --- sys-process/cronbase/cronbase-0.3.7-r3.ebuild | 33 --------------------------- sys-process/cronbase/cronbase-0.3.7-r4.ebuild | 33 +++++++++++++++++++++++++++ sys-process/cronbase/files/run-crons-0.3.7 | 4 ++-- 3 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 sys-process/cronbase/cronbase-0.3.7-r3.ebuild create mode 100644 sys-process/cronbase/cronbase-0.3.7-r4.ebuild (limited to 'sys-process') diff --git a/sys-process/cronbase/cronbase-0.3.7-r3.ebuild b/sys-process/cronbase/cronbase-0.3.7-r3.ebuild deleted file mode 100644 index d263aeb11e0e..000000000000 --- a/sys-process/cronbase/cronbase-0.3.7-r3.ebuild +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 1999-2015 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -EAPI="5" - -inherit user - -DESCRIPTION="base for all cron ebuilds" -HOMEPAGE="https://www.gentoo.org/" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" -IUSE="" - -S=${WORKDIR} - -pkg_setup() { - enewgroup cron 16 - enewuser cron 16 -1 /var/spool/cron cron -} - -src_install() { - newsbin "${FILESDIR}"/run-crons-${PV} run-crons - - diropts -m0750 - keepdir /etc/cron.{hourly,daily,weekly,monthly} - - keepdir /var/spool/cron/lastrun - diropts -m0750 -o root -g cron - keepdir /var/spool/cron -} diff --git a/sys-process/cronbase/cronbase-0.3.7-r4.ebuild b/sys-process/cronbase/cronbase-0.3.7-r4.ebuild new file mode 100644 index 000000000000..d263aeb11e0e --- /dev/null +++ b/sys-process/cronbase/cronbase-0.3.7-r4.ebuild @@ -0,0 +1,33 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +inherit user + +DESCRIPTION="base for all cron ebuilds" +HOMEPAGE="https://www.gentoo.org/" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" +IUSE="" + +S=${WORKDIR} + +pkg_setup() { + enewgroup cron 16 + enewuser cron 16 -1 /var/spool/cron cron +} + +src_install() { + newsbin "${FILESDIR}"/run-crons-${PV} run-crons + + diropts -m0750 + keepdir /etc/cron.{hourly,daily,weekly,monthly} + + keepdir /var/spool/cron/lastrun + diropts -m0750 -o root -g cron + keepdir /var/spool/cron +} diff --git a/sys-process/cronbase/files/run-crons-0.3.7 b/sys-process/cronbase/files/run-crons-0.3.7 index ce8ff76e98bb..958ef06c1ef7 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 -- cgit v1.2.3-65-gdbad