#619864 dash: package description does not explain goals well

#619864#5
Date:
2011-03-21 01:53:56 UTC
From:
To:
Hi,

After upgrading to squeeze and answering "yes" to install question of
using dash as default shell for non-interactive users, all my cronjobs
that use $RANDOM variable to delay some random seconds of running time
stopped working.

Please implement this in dash.

Example of a simple cronjob which runs with a random delay of
0 ~ 327 seconds (to prevent network peaks of all the machines):

  */30 * * * * sleep $(($RANDOM/100)) && do_something_network_related

Thanks,
Pedro

#619864#10
Date:
2011-03-27 06:51:56 UTC
From:
To:
(resending because I can't spell. :/  Sorry for the noise.)

Hi Pedro,

Pedro Zorzenon Neto wrote:

I don't think this functionality belongs in dash.  For example, I
find that the "sleep" command in

is better written (more portably and more intuitively) as

	sleep $(awk 'BEGIN {srand(); printf "%d\n", rand()*327}')

or

	awk 'BEGIN { srand(); system("sleep " int(rand() * 327)) }'

even though this is a little longer.

On the other hand, I would definitely like a way for users to be able
to easily choose a different shell to be used by cron, so they would
be less at the mercy of the cruel sysadmin.  What do you think?

Thanks for writing,
Jonathan

#619864#17
Date:
2011-03-28 01:52:42 UTC
From:
To:
nice idea...
  */30 * * * * perl -e "sleep rand(327)"; do_something_network_related
for the ones that like perl :-)

I think that is "dash" is supposed to replace bash, it should implement
$RANDOM... but this is only my personal opinion :-)
SHELL=/bin/something
at the begining of your crontab, all the lines will be run with your
prefered shell.

Thanks,
Pedro

#619864#22
Date:
2011-03-28 02:14:46 UTC
From:
To:
clone 619082 -1
retitle -1 dash: package description does not explain goals well
severity -1 minor
submitter -1 !
quit

Pedro Zorzenon Neto wrote:
[out of order for convenience]

Ah, that's excellent!  I should have checked crontab(5).

Ah, interesting --- dash is not intended to replace bash but now that
I check I see the current package description suggests it might be.
By contrast, Herbert's webpage says:

 DASH is a POSIX-compliant implementation of /bin/sh that aims to be as
 small as possible. It does this without sacrificing speed where
 possible. In fact, it is significantly faster than bash (the GNU
 Bourne-Again SHell) for most tasks.

From this we see that dash is meant to to be

 * POSIX-compliant
 * small
 * reasonably fast

Meanwhile bash is more powerful and definitely has its place
(especially for features like programmatic completion imho).

The package could use some help from a wordsmith to convey:

 - for a full-featured, bash-compatible shell, see the "bash" package. :)
 - for a POSIX compliance checker, see the "posh" package.

Thanks for a useful reminder.