Page 1 of 1

Minor bugfix: init script error

Posted: 19 Sep 2010, 20:48
by argonavis
Issue Type: Minor bug

Version: sysresccd-1.6.0

During the boot process, after the keymap selection, the shell error "sh: bad number" is sometimes printed on the boot log.

In the initram.igz init script, the sysresccd_setup_keymap() function contains the following code, which is interpreted by the BusyBox ash command:

Code: Select all

if [ ! -e /dev/vc/0 -a ! -e /dev/tty0 ]
        mount -o bind ${NEWROOT}/dev /dev
[ ! -e /dev/tty0 ] && ln -s /dev/tty1 /dev/tty0


[ "${DEVBIND}" -eq '1' ] && umount /dev
When DEVBIND is set to "1", this section of code executes as intended. But when DEVBIND is uninitialized, the last statement:

Code: Select all

[ "${DEVBIND}" -eq '1' ] && umount /dev
causes the error: sh: bad number.

Any number of possible modifications are possible. For example, DEVBIND could simply be initialized prior to the if statement. The fix I've currently implemented is to modify the last statement, above, as follows:

Code: Select all

[ "${DEVBIND:-0}" -eq '1' ] && umount /dev
In the spirit of complete overkill, expounding on the obvious, kicking a dead dog, and belaboring a point... here is a patch (:-)...

Code: Select all

--- ird-3/init  2010-09-18 23:17:25.318317091 +0000
+++ ird-5/init  2010-09-19 00:53:51.284995460 +0000
@@ -80,7 +80,7 @@


-               [ "${DEVBIND}" -eq '1' ] && umount /dev
+               [ "${DEVBIND:-0}" -eq '1' ] && umount /dev
        else # "setkmap=xx" option was used
                sysresccd_useKeymap $SETKMAP

Re: Minor bugfix: init script error

Posted: 21 Sep 2010, 06:54
by admin
Thanks for this detailed bug report with the fix. I have done the modification in sysresccd-1.6.1-beta004.