/etc/init.d/nvidia-kernel contains bashisms

Bug #24672 reported by Debian Bug Importer
6
Affects Status Importance Assigned to Milestone
nvidia-kernel-common (Debian)
Fix Released
Unknown
nvidia-kernel-common (Ubuntu)
Invalid
High
Ben Collins

Bug Description

Automatically imported from Debian bug report #335976 http://bugs.debian.org/335976

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Automatically imported from Debian bug report #335976 http://bugs.debian.org/335976

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Wed, 26 Oct 2005 21:10:48 -0700
From: Jamie Heilman <email address hidden>
To: <email address hidden>
Subject: /etc/init.d/nvidia-kernel contains bashisms

Package: nvidia-kernel-common
Version: 20051025+1
Severity: grave

Setting up nvidia-kernel-common (20051025+1) ...
/etc/init.d/nvidia-kernel: 19: Syntax error: Bad for loop variable
invoke-rc.d: initscript nvidia-kernel, action "start" failed.

"for (( expr1 ; expr2 ; expr3 )) ; do list ; done" syntax is a bashism,
instead consider:

--- nvidia-kernel.orig 2005-10-26 20:58:30.000000000 -0700
+++ nvidia-kernel 2005-10-26 21:06:26.000000000 -0700
@@ -6,7 +6,7 @@
 [ -r /etc/default/nvidia-kernel ] && . /etc/default/nvidia-kernel

 # test if anything is requested
-if [ -z "$NVIDIA_CARDS" ] || [ "$NVIDIA_CARDS" = 0 ]; then
+if [ -z "$NVIDIA_CARDS" ] || [ "$NVIDIA_CARDS" -lt 1 ]; then
   # Nothing to do but exit.
   exit 0
 fi
@@ -16,8 +16,8 @@
     mknod -m 0660 /dev/nvidiactl c 195 255
     chgrp video /dev/nvidiactl
   fi
- for (( i=0; i < NVIDIA_CARDS && i < 4; i++ )); do
- if ! [ -e /dev/nvidia$i ]; then
+ for i in $(seq 0 $(($NVIDIA_CARDS - 1))); do
+ if ! [ -e /dev/nvidia$i ]; then
       mknod -m 0660 /dev/nvidia$i c 195 $i
       chgrp video /dev/nvidia$i
     fi

--
Jamie Heilman http://audible.transient.net/~jamie/
"Paranoia is a disease unto itself, and may I add, the person standing
 next to you may not be who they appear to be, so take precaution."
      -Sathington Willoughby

Revision history for this message
In , Randall Donald (rdonald) wrote : Bug#335976: fixed in nvidia-kernel-common 20051026+1

Source: nvidia-kernel-common
Source-Version: 20051026+1

We believe that the bug you reported is fixed in the latest version of
nvidia-kernel-common, which is due to be installed in the Debian FTP archive:

nvidia-kernel-common_20051026+1.dsc
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051026+1.dsc
nvidia-kernel-common_20051026+1.tar.gz
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051026+1.tar.gz
nvidia-kernel-common_20051026+1_all.deb
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051026+1_all.deb

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to <email address hidden>,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Randall Donald <email address hidden> (supplier of updated nvidia-kernel-common package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing <email address hidden>)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Wed, 26 Oct 2005 21:47:15 -0700
Source: nvidia-kernel-common
Binary: nvidia-kernel-common
Architecture: source all
Version: 20051026+1
Distribution: unstable
Urgency: low
Maintainer: Randall Donald <email address hidden>
Changed-By: Randall Donald <email address hidden>
Description:
 nvidia-kernel-common - NVIDIA binary kernel module common files
Closes: 335976
Changes:
 nvidia-kernel-common (20051026+1) unstable; urgency=low
 .
   * fix bashism in init script (closes: #335976)
Files:
 88ce5e3a7d77f126f590d9efb1544fc2 546 contrib/x11 optional nvidia-kernel-common_20051026+1.dsc
 531510135875c304c783a4a37ac88a02 3887 contrib/x11 optional nvidia-kernel-common_20051026+1.tar.gz
 6147a257bd9ed2f32ea4555c9176e400 4316 contrib/x11 optional nvidia-kernel-common_20051026+1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDYFxrU+6HYGwn3qsRAucWAJ49p5MFLNzQHLhKJFQ4cjY/s95YDACgjaKa
fvyxsWKpyil0rANtQsvyJvc=
=WJ8j
-----END PGP SIGNATURE-----

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <email address hidden>
Date: Thu, 27 Oct 2005 01:47:05 -0700
From: Randall Donald <email address hidden>
To: <email address hidden>
Subject: Bug#335976: fixed in nvidia-kernel-common 20051026+1

Source: nvidia-kernel-common
Source-Version: 20051026+1

We believe that the bug you reported is fixed in the latest version of
nvidia-kernel-common, which is due to be installed in the Debian FTP archive:

nvidia-kernel-common_20051026+1.dsc
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051026+1.dsc
nvidia-kernel-common_20051026+1.tar.gz
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051026+1.tar.gz
nvidia-kernel-common_20051026+1_all.deb
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051026+1_all.deb

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to <email address hidden>,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Randall Donald <email address hidden> (supplier of updated nvidia-kernel-common package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing <email address hidden>)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Wed, 26 Oct 2005 21:47:15 -0700
Source: nvidia-kernel-common
Binary: nvidia-kernel-common
Architecture: source all
Version: 20051026+1
Distribution: unstable
Urgency: low
Maintainer: Randall Donald <email address hidden>
Changed-By: Randall Donald <email address hidden>
Description:
 nvidia-kernel-common - NVIDIA binary kernel module common files
Closes: 335976
Changes:
 nvidia-kernel-common (20051026+1) unstable; urgency=low
 .
   * fix bashism in init script (closes: #335976)
Files:
 88ce5e3a7d77f126f590d9efb1544fc2 546 contrib/x11 optional nvidia-kernel-common_20051026+1.dsc
 531510135875c304c783a4a37ac88a02 3887 contrib/x11 optional nvidia-kernel-common_20051026+1.tar.gz
 6147a257bd9ed2f32ea4555c9176e400 4316 contrib/x11 optional nvidia-kernel-common_20051026+1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDYFxrU+6HYGwn3qsRAucWAJ49p5MFLNzQHLhKJFQ4cjY/s95YDACgjaKa
fvyxsWKpyil0rANtQsvyJvc=
=WJ8j
-----END PGP SIGNATURE-----

Revision history for this message
In , Jamie Heilman (jamie-audible) wrote :

New version is still broken. The way 20051026+1 is written, if
NVIDIA_CARDS is 0 then make_nodes is still run, possibly creating
/dev/nvidiactl needlessly. Also, expr in bash apparently lets you get
away with the form of variable expansion you used, but dash does not.
Look at the patch I gave you again, it was correct, and now here's
patch against version 20051026+1:

@@ -6,7 +6,7 @@
 [ -r /etc/default/nvidia-kernel ] && . /etc/default/nvidia-kernel

 # test if anything is requested
-if [ -z "$NVIDIA_CARDS" ] || [ "$NVIDIA_CARDS" -lt 0 ]; then
+if [ -z "$NVIDIA_CARDS" ] || [ "$NVIDIA_CARDS" -lt 1 ]; then
   # Nothing to do but exit.
   exit 0
 fi
@@ -16,7 +16,7 @@
     mknod -m 0660 /dev/nvidiactl c 195 255
     chgrp video /dev/nvidiactl
   fi
- for i in $(seq 0 $((NVIDIA_CARDS - 1))); do
+ for i in $(seq 0 $(($NVIDIA_CARDS - 1))); do
     if ! [ -e /dev/nvidia$i ]; then
       mknod -m 0660 /dev/nvidia$i c 195 $i
       chgrp video /dev/nvidia$i

--
Jamie Heilman http://audible.transient.net/~jamie/
"Most people wouldn't know music if it came up and bit them on the ass."
                                                        -Frank Zappa

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Fri, 28 Oct 2005 18:04:51 -0700
From: Jamie Heilman <email address hidden>
To: <email address hidden>
Cc: <email address hidden>
Subject: Re: /etc/init.d/nvidia-kernel contains bashisms

New version is still broken. The way 20051026+1 is written, if
NVIDIA_CARDS is 0 then make_nodes is still run, possibly creating
/dev/nvidiactl needlessly. Also, expr in bash apparently lets you get
away with the form of variable expansion you used, but dash does not.
Look at the patch I gave you again, it was correct, and now here's
patch against version 20051026+1:

@@ -6,7 +6,7 @@
 [ -r /etc/default/nvidia-kernel ] && . /etc/default/nvidia-kernel

 # test if anything is requested
-if [ -z "$NVIDIA_CARDS" ] || [ "$NVIDIA_CARDS" -lt 0 ]; then
+if [ -z "$NVIDIA_CARDS" ] || [ "$NVIDIA_CARDS" -lt 1 ]; then
   # Nothing to do but exit.
   exit 0
 fi
@@ -16,7 +16,7 @@
     mknod -m 0660 /dev/nvidiactl c 195 255
     chgrp video /dev/nvidiactl
   fi
- for i in $(seq 0 $((NVIDIA_CARDS - 1))); do
+ for i in $(seq 0 $(($NVIDIA_CARDS - 1))); do
     if ! [ -e /dev/nvidia$i ]; then
       mknod -m 0660 /dev/nvidia$i c 195 $i
       chgrp video /dev/nvidia$i

--
Jamie Heilman http://audible.transient.net/~jamie/
"Most people wouldn't know music if it came up and bit them on the ass."
                                                        -Frank Zappa

Revision history for this message
In , Randall Donald (rdonald) wrote : Bug#335976: fixed in nvidia-kernel-common 20051028+1

Source: nvidia-kernel-common
Source-Version: 20051028+1

We believe that the bug you reported is fixed in the latest version of
nvidia-kernel-common, which is due to be installed in the Debian FTP archive:

nvidia-kernel-common_20051028+1.dsc
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051028+1.dsc
nvidia-kernel-common_20051028+1.tar.gz
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051028+1.tar.gz
nvidia-kernel-common_20051028+1_all.deb
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051028+1_all.deb

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to <email address hidden>,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Randall Donald <email address hidden> (supplier of updated nvidia-kernel-common package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing <email address hidden>)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Fri, 28 Oct 2005 19:46:20 -0700
Source: nvidia-kernel-common
Binary: nvidia-kernel-common
Architecture: source all
Version: 20051028+1
Distribution: unstable
Urgency: low
Maintainer: Randall Donald <email address hidden>
Changed-By: Randall Donald <email address hidden>
Description:
 nvidia-kernel-common - NVIDIA binary kernel module common files
Closes: 335976
Changes:
 nvidia-kernel-common (20051028+1) unstable; urgency=low
 .
   * really fix script (closes: #335976)
Files:
 b1c5084ad0e90d5f68d870128d259a22 546 contrib/x11 optional nvidia-kernel-common_20051028+1.dsc
 56e9255b2ae232a3cd26d44e013292dc 3909 contrib/x11 optional nvidia-kernel-common_20051028+1.tar.gz
 5c627973caf09c91b02cf01dffb64bab 4332 contrib/x11 optional nvidia-kernel-common_20051028+1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDYuL8U+6HYGwn3qsRApS/AKCUgdyjoeWCETaUUM48SjWwDDu7wACffpfD
5XdpJvH6uiy+Uu5Gj3sjFfk=
=HLkW
-----END PGP SIGNATURE-----

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <email address hidden>
Date: Fri, 28 Oct 2005 20:02:05 -0700
From: Randall Donald <email address hidden>
To: <email address hidden>
Subject: Bug#335976: fixed in nvidia-kernel-common 20051028+1

Source: nvidia-kernel-common
Source-Version: 20051028+1

We believe that the bug you reported is fixed in the latest version of
nvidia-kernel-common, which is due to be installed in the Debian FTP archive:

nvidia-kernel-common_20051028+1.dsc
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051028+1.dsc
nvidia-kernel-common_20051028+1.tar.gz
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051028+1.tar.gz
nvidia-kernel-common_20051028+1_all.deb
  to pool/contrib/n/nvidia-kernel-common/nvidia-kernel-common_20051028+1_all.deb

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to <email address hidden>,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Randall Donald <email address hidden> (supplier of updated nvidia-kernel-common package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing <email address hidden>)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Fri, 28 Oct 2005 19:46:20 -0700
Source: nvidia-kernel-common
Binary: nvidia-kernel-common
Architecture: source all
Version: 20051028+1
Distribution: unstable
Urgency: low
Maintainer: Randall Donald <email address hidden>
Changed-By: Randall Donald <email address hidden>
Description:
 nvidia-kernel-common - NVIDIA binary kernel module common files
Closes: 335976
Changes:
 nvidia-kernel-common (20051028+1) unstable; urgency=low
 .
   * really fix script (closes: #335976)
Files:
 b1c5084ad0e90d5f68d870128d259a22 546 contrib/x11 optional nvidia-kernel-common_20051028+1.dsc
 56e9255b2ae232a3cd26d44e013292dc 3909 contrib/x11 optional nvidia-kernel-common_20051028+1.tar.gz
 5c627973caf09c91b02cf01dffb64bab 4332 contrib/x11 optional nvidia-kernel-common_20051028+1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDYuL8U+6HYGwn3qsRApS/AKCUgdyjoeWCETaUUM48SjWwDDu7wACffpfD
5XdpJvH6uiy+Uu5Gj3sjFfk=
=HLkW
-----END PGP SIGNATURE-----

Revision history for this message
In , matthieu (castet-matthieu) wrote : nvidia-kernel-common: syntax error: "NVIDIA_CARDS - 1"

Package: nvidia-kernel-common
Version: 20051026+1
Followup-For: Bug #335976

the if [ -z "$NVIDIA_CARDS" ] || [ "$NVIDIA_CARDS" -lt 0 ]; then part
wasn't changed...

Now I have /etc/init.d/nvidia-kernel: 40: arith: syntax error:
"NVIDIA_CARDS - 1" error.

Could the maintener check its package with dash as sh ?

thanks

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/dash
Kernel: Linux 2.6.13
Locale: LANG=fr_FR@euro, LC_CTYPE=fr_FR@euro (charmap=ISO-8859-15)

Versions of packages nvidia-kernel-common depends on:
ii module-init-tools 3.2-pre9-3 tools for managing Linux kernel mo
ii modutils 2.4.27.0-3 Linux module utilities

Versions of packages nvidia-kernel-common recommends:
ii nvidia-kernel-source 1.0.7664-1 NVIDIA binary kernel module source

-- no debconf information

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <email address hidden>
Date: Sat, 29 Oct 2005 09:44:17 +0200
From: matthieu castet <email address hidden>
To: Debian Bug Tracking System <email address hidden>
Subject: nvidia-kernel-common: syntax error: "NVIDIA_CARDS - 1"

Package: nvidia-kernel-common
Version: 20051026+1
Followup-For: Bug #335976

the if [ -z "$NVIDIA_CARDS" ] || [ "$NVIDIA_CARDS" -lt 0 ]; then part
wasn't changed...

Now I have /etc/init.d/nvidia-kernel: 40: arith: syntax error:
"NVIDIA_CARDS - 1" error.

Could the maintener check its package with dash as sh ?

thanks

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/dash
Kernel: Linux 2.6.13
Locale: LANG=fr_FR@euro, LC_CTYPE=fr_FR@euro (charmap=ISO-8859-15)

Versions of packages nvidia-kernel-common depends on:
ii module-init-tools 3.2-pre9-3 tools for managing Linux kernel mo
ii modutils 2.4.27.0-3 Linux module utilities

Versions of packages nvidia-kernel-common recommends:
ii nvidia-kernel-source 1.0.7664-1 NVIDIA binary kernel module source

-- no debconf information

Revision history for this message
Ben Collins (ben-collins) wrote :

We don't seem to have this script in nvidia-kernel-common.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.