Bug#464989: hibernate: bashism in /bin/sh script
tags 464989 fixed-upstream pending confirmed patch thanks also sprach Raphael Geissert [EMAIL PROTECTED] [2008.03.18.0442 +0100]: But latest checkbashisms' output (excluding the $RANDOM line): possible bashism in ./usr/sbin/hibernate line 693 (local foo=bar): local file_name=$1 possible bashism in ./usr/sbin/hibernate line 825 (local foo=bar): local pid=$1 envvar=$2 Index: hibernate.sh === --- hibernate.sh(revision 1173) +++ hibernate.sh(working copy) @@ -700,7 +700,7 @@ conffiles_read= ReadConfigFile() { local option params -local file_name=$1 +local file_name; file_name==$1 if [ ! -f ${file_name} ] ; then # Search in /etc/hibernate @@ -832,7 +832,8 @@ # processes identified by its PID. get_env_var_of_process() { -local pid=$1 envvar=$2 +local pid; pid=$1 +local envvar; envvar=$2 tr '\0' '\n' /proc/$pid/environ | sed -ne s/^$envvar=//p } -- .''`. martin f. krafft [EMAIL PROTECTED] : :' : proud Debian developer, author, administrator, and user `. `'` http://people.debian.org/~madduck - http://debiansystem.info `- Debian - when you have better things to do than fixing systems digital_signature_gpg.asc Description: Digital signature (see http://martin-krafft.net/gpg/)
Bug#464989: hibernate: bashism in /bin/sh script
severity 464989 important user [EMAIL PROTECTED] usertags 464989 -goal-dash thanks I missed the '$$' in the line where $RANDOM is used (some scripts do use $RANDOM 'just in case', and they do not strongly rely on it), so the $RANDOM bashism can be ignored. But latest checkbashisms' output (excluding the $RANDOM line): possible bashism in ./usr/sbin/hibernate line 693 (local foo=bar): local file_name=$1 possible bashism in ./usr/sbin/hibernate line 825 (local foo=bar): local pid=$1 envvar=$2 Cheers, -- Atomo64 - Raphael Please avoid sending me Word, PowerPoint or Excel attachments. See http://www.gnu.org/philosophy/no-word-attachments.html Earth Hour 2008 - Take action! http://www.earthhour.org/user/xJKk -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#464989: hibernate: bashism in /bin/sh script
tags 464989 patch upstream thanks Hi, I made a patch (attached) which works around this bashism in hibernate.sh. It's also reported upstream [1]. - Werner [1] http://bugzilla.tuxonice.net/show_bug.cgi?id=361 diff -ruN hibernate-1.97.orig/hibernate.sh hibernate-1.97/hibernate.sh --- hibernate-1.97.orig/hibernate.sh 2007-09-30 15:54:58.0 +0200 +++ hibernate-1.97/hibernate.sh 2008-02-21 16:15:54.967014034 +0100 @@ -389,10 +389,20 @@ local CNT local D local FN + local RND1 + local RND2 CNT=1 + if [ -z $RANDOM ] ; then + # A fix for shells that do not have this bash feature + RND1=$(dd if=/dev/urandom count=1 2/dev/null|cksum|cut -c1-5) + RND2=$(dd if=/dev/urandom count=1 2/dev/null|cksum|cut -c1-5) + else + RND1=$RANDOM + RND2=$RANDOM + fi while true ; do D=`date +%s` - FN=/tmp/tmp.hibernate.$$$D$RANDOM$RANDOM$CNT + FN=/tmp/tmp.hibernate.$$$D$RND1$RND2$CNT [ -f $FN ] continue touch $FN break CNT=$(($CNT+1))