When /bin/sh is a symlink to a shell other than bash, the tmpwatch cron job fails due to its use of the bash-specific [[ operator. This could be resolved either by making the cron job run with /bin/bash or by using the POSIX standard [ operator for tests. Reproducible: Always Steps to Reproduce: 1. ln -sf dash /bin/sh 2. /etc/cron.daily/tmpwatch Actual Results: /etc/cron.daily/tmpwatch: 33: /etc/cron.daily/tmpwatch: [[: not found
Created attachment 678939 [details, diff] gentoo-bug-524698.patch
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce830c8d6fc7869fd559d36c71cf3b8af3b4fd80 commit ce830c8d6fc7869fd559d36c71cf3b8af3b4fd80 Author: Sam James <sam@gentoo.org> AuthorDate: 2021-08-20 02:16:53 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2021-08-20 02:18:09 +0000 app-admin/tmpwatch: address bug 524698 (bashism) Remove the use of the [[ keyword in favour of the POSIX test command (SC3010). Don't hard-code pathnames to external programs and define silly variables such as TMPWATCH. Instead, define a sane PATH at the beginning of the script. Don't force the user to reason with whether certain variables need to be set or not. Instead, call out to portageq in the samples. Further, check the exit status of portageq, rather than blindly assume that it always succeeds. As a result, there are no more hard-coded paths, other than /tmp. Use pgrep in a less sloppy way. Query PORT_LOGDIR if the query for PORTAGE_LOGDIR fails. Closes: https://bugs.gentoo.org/524698 Signed-off-by: Kerin Millar <kfm@plushkava.net> Signed-off-by: Sam James <sam@gentoo.org> app-admin/tmpwatch/files/tmpwatch.cron | 40 ++++++++++------------ ...atch-2.11-r2.ebuild => tmpwatch-2.11-r3.ebuild} | 0 2 files changed, 19 insertions(+), 21 deletions(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b32a477eba2470c5137d5c2b2da0d28d45c4bdc0 commit b32a477eba2470c5137d5c2b2da0d28d45c4bdc0 Author: Kerin Millar <kfm@plushkava.net> AuthorDate: 2021-08-20 02:16:53 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2021-08-20 02:26:17 +0000 app-admin/tmpwatch: address bug 524698 (bashism) Remove the use of the [[ keyword in favour of the POSIX test command (SC3010). Don't hard-code pathnames to external programs and define silly variables such as TMPWATCH. Instead, define a sane PATH at the beginning of the script. Don't force the user to reason with whether certain variables need to be set or not. Instead, call out to portageq in the samples. Further, check the exit status of portageq, rather than blindly assume that it always succeeds. As a result, there are no more hard-coded paths, other than /tmp. Use pgrep in a less sloppy way. Query PORT_LOGDIR if the query for PORTAGE_LOGDIR fails. Closes: https://bugs.gentoo.org/524698 Signed-off-by: Kerin Millar <kfm@plushkava.net> Signed-off-by: Sam James <sam@gentoo.org> app-admin/tmpwatch/files/tmpwatch.cron | 40 ++++++++++------------ ...atch-2.11-r2.ebuild => tmpwatch-2.11-r3.ebuild} | 0 2 files changed, 19 insertions(+), 21 deletions(-) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08df76446cf4f5092b6aa2f77c76cdabdf4baaba commit 08df76446cf4f5092b6aa2f77c76cdabdf4baaba Author: Sam James <sam@gentoo.org> AuthorDate: 2021-08-20 02:25:34 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2021-08-20 02:25:34 +0000 Revert "app-admin/tmpwatch: address bug 524698 (bashism)" This reverts commit ce830c8d6fc7869fd559d36c71cf3b8af3b4fd80. Forgot to set git author when massaging git to apply the patch. Bug: https://bugs.gentoo.org/524698 Signed-off-by: Sam James <sam@gentoo.org> app-admin/tmpwatch/files/tmpwatch.cron | 40 ++++++++++++---------- ...atch-2.11-r3.ebuild => tmpwatch-2.11-r2.ebuild} | 0 2 files changed, 21 insertions(+), 19 deletions(-)
Apologies for cocking up the application of the patch initially. Cheers!