[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#540141: bashisms in /etc/cron.daily/apt



On 2009-08-06 08:26 +0200, Yves-Alexis Perez wrote:

> Package: apt
> Version: 0.7.22.1
> Severity: important
> User: debian-release@lists.debian.org
> Usertags: goal-dash
>
>
> Hey,
>
> seems that apt has a bashism in /etc/cron.daily/apt, by using $RANDOM which
> doesn't exist on dash:
>
> corsac@hidalgo: checkbashisms /etc/cron.daily/apt
> possible bashism in /etc/cron.daily/apt line 297 ($RANDOM):
>     if [ -z "$RANDOM" ] ; then
> possible bashism in /etc/cron.daily/apt line 301 ($RANDOM):
>     TIME=$(($RANDOM % $RandomSleep))
>

These are false positives.

> Suggested solution is to use /dev/urandom like:
>
> random="$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")"

If you read the code, you will notice that it does just that if /bin/sh
does not define RANDOM by itself.

Sven



Reply to: