Release Engineering

Tasklist

FS#13180 - /arch/setup fails on bad input while auto-preparing the hard drive

Attached to Project: Release Engineering
Opened by Alessandro Doro (adoroo) - Monday, 09 February 2009, 22:11 GMT
Last edited by Dieter Plaetinck (Dieter_be) - Saturday, 14 February 2009, 15:49 GMT
Task Type Bug Report
Category AIF
Status Closed
Assigned To Aaron Griffin (phrakture)
Gerhard Brauer (GerBra)
Dieter Plaetinck (Dieter_be)
Architecture All
Severity Medium
Priority Normal
Reported Version 2009.02-RC
Due in Version 2009.08-alpha
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

line 401:
if [ "$SWAP_PART_SIZE" = "" -o "$SWAP_PART_SIZE" -le "0" ]; then

line 414:
if [ "$ROOT_PART_SIZE" = "" -o "$ROOT_PART_SIZE" -le "0" ]; then

If I leave the input box empty while setting the swap o root partition size the script aborts.

Test cases:
$ a=""; b=""; if [ "$a" = "" -o "$b" -eq "3" ]; then echo yes; fi
-bash: [: b: integer expression expected

$ a=""; b=""; if test "$a" == "" -o "$b" -eq "3" ; then echo yes; fi
-bash: test: : integer expression expected

$ a=""; b=""; if test "$a" == "" || "$b" -eq "3" ; then echo yes; fi
yes
but the second test is omitted and this isn't the desired behaviour, so the minimum size check should stay alone.

archlinux-2009.02-RC1-ftp-i686.iso
This task depends upon

Closed by  Dieter Plaetinck (Dieter_be)
Saturday, 14 February 2009, 15:49 GMT
Reason for closing:  Fixed
Additional comments about closing:  Closing this because it works in aif. it doesn't in /arch/setup though.
Comment by Dieter Plaetinck (Dieter_be) - Saturday, 14 February 2009, 15:47 GMT
Indeed, you can't do integer comparisons on strings with bash/test.
AIF has a function ask_number for this, it checks if the input really is a number with [[ $ANSWER_NUMBER = *[^0-9]* ]]
Thanks for the report, but since we will deprecate /arch/setup in favor of AIF I'm not sure anyone will fix it in /arch/setup...
However aif has the correct behavior, I hope that satisfies you :)

Loading...