Minor bugfix: init script error

Post there if you plan to contribute to this SystemCd
argonavis
Posts: 9
Joined: 09 Apr 2008, 22:55

Minor bugfix: init script error

Postby argonavis » 19 Sep 2010, 20:48

Issue Type: Minor bug

Version: sysresccd-1.6.0

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

Cause:
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 ]
then
        DEVBIND=1
        mount -o bind ${NEWROOT}/dev /dev
fi
[ ! -e /dev/tty0 ] && ln -s /dev/tty1 /dev/tty0

sysresccd_chooseKeymap

[ "${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.

Resolution:
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 @@

                sysresccd_chooseKeymap

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

AN.

admin
Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Re: Minor bugfix: init script error

Postby admin » 21 Sep 2010, 06:54

Thanks for this detailed bug report with the fix. I have done the modification in sysresccd-1.6.1-beta004.


Return to “Contributions”

Who is online

Users browsing this forum: No registered users and 9 guests