/usr/sbin/run-crons has a bashism that makes it incompatible with mksh, which is annoying when using it as system shell. Attached is a simple fix. Reproducible: Always Steps to Reproduce: 1. set *ksh as system shell 2. run /usr/sbin/run-crons Actual Results: get syntax error: run-crons[40]: syntax error: '((' unexpected Expected Results: Run smoothly with other shells, as it does something rather simple.
Created attachment 390204 [details, diff] Remove a bashism that fails with *ksh.
What cron daemon do you use? $ qlist -ICv cronbase sys-process/cronbase-0.3.3 $ head -n1 /usr/sbin/run-crons #!/bin/bash
Created attachment 390214 [details, diff] remove a bashism that fails with *ksh I forgot to change the shebang, here's a new one. Notice that not all bashisms are replaced, only the one that was incompatible with *ksh.
(In reply to Alexander Tsoy from comment #2) > What cron daemon do you use? dcron > $ qlist -ICv cronbase > sys-process/cronbase-0.3.3 > $ head -n1 /usr/sbin/run-crons > #!/bin/bash I now changed the shebang.
(In reply to Alexander Tsoy from comment #2) oh and about: > $ qlist -ICv cronbase # equery b /usr/sbin/run-crons * Searching for /usr/sbin/run-crons ... sys-process/cronbase-0.3.3 (/usr/sbin/run-crons)
The question is why run-crons gets processed by mksh on your system. It has /bon/bash in shebang and should work fine. # grep run-crons /var/tmp/portage/sys-process/dcron-4.5-r1/image/etc/crontab */10 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons
(In reply to Alexander Tsoy from comment #6) > The question is why run-crons gets processed by mksh on your system. It has > /bon/bash in shebang and should work fine. > > # grep run-crons /var/tmp/portage/sys-process/dcron-4.5-r1/image/etc/crontab > */10 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons I see now. It gets processed by bash, that's not the problem. I _wanted_ it to run with mksh. And I think the proposed change to make it possible is so marginal that it shouldn't be a problem to adopt it. Apologies for the misunderstanding. If it is desired I can try to remove the remaining bashisms to make #!/bin/sh more justifiable.
(In reply to Alexander Hof from comment #7) Thanks for clarification. It wasn't clear from the bug description.
run-crons is clearly a bash script: $ head -1 /usr/sbin/run-crons #!/bin/bash forcing it to run under other shells is a user error. fixing a few random constructs to make it readable by other shells (like ksh derivatives) is a dead end imo -- people will still write & test only under bash. the only real route here is to convert it entirely to POSIX shell and use #!/bin/sh as the shebang. i don't think that process should be *too* hard.
and i've rewritten it in POSIX shell locally now
should be all set now in the tree; thanks for the report! Commit message: Rewrite run-crons in POSIX shell http://sources.gentoo.org/sys-process/cronbase/cronbase-0.3.6.ebuild?rev=1.1 http://sources.gentoo.org/sys-process/cronbase/files/run-crons-0.3.6?rev=1.1
(In reply to SpanKY from comment #11) > should be all set now in the tree; thanks for the report! > thanks for fixing!