Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 524698 - app-admin/tmpwatch with dash - /etc/cron.daily/tmpwatch: 33: /etc/cron.daily/tmpwatch: [[: not found
Summary: app-admin/tmpwatch with dash - /etc/cron.daily/tmpwatch: 33: /etc/cron.daily/...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: nonbash
  Show dependency tree
 
Reported: 2014-10-07 14:03 UTC by Bruce Guenter
Modified: 2021-08-20 02:30 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
gentoo-bug-524698.patch (gentoo-bug-524698.patch,3.45 KB, patch)
2020-12-20 15:17 UTC, kfm
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bruce Guenter 2014-10-07 14:03:44 UTC
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
Comment 1 kfm 2020-12-20 15:17:02 UTC
Created attachment 678939 [details, diff]
gentoo-bug-524698.patch
Comment 2 Larry the Git Cow gentoo-dev 2021-08-20 02:18:25 UTC
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(-)
Comment 3 Larry the Git Cow gentoo-dev 2021-08-20 02:26:32 UTC
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(-)
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-08-20 02:30:23 UTC
Apologies for cocking up the application of the patch initially. Cheers!