[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Error in kernel Configuration (problems with expr)



Hi guys, 

	Marcia Takagui <takagui@wslip1.if.usp.br> seems to have
 discovered a fairly significant defect in the 2.0.30 kernel
 Configuration scripts. Allow me to present the evidence:

	She needs to set a kernel Configuration variable, namely
 MSS_DMA, to 0. (There is no help on this item). However, 0 is a legal
 value according to the sound driver configuration file; as seen by:

__> egrep MSS_DMA drivers/sound/Config.in 
int 'PSS audio DMA 0, 1 or 3' PSS_MSS_DMA 3
int 'MSS/WSS DMA 0, 1 or 3' MSS_DMA 3

	Ok so far? Now, let us examine the function int in the file 
 scripts/Configure 
---------------------------------------------------------------------------
function int () {
        old=$(eval echo "\${$2}")
        def=${old:-$3}
        while :; do
          readln "$1 ($2) [$def] " "$def" "$old"
          if expr "$ans" : '0$\|\(-[1-9]\|[1-9]\)[0-9]*$' > /dev/null; then
            define_int "$2" "$ans"
            break
          else
            help "$2"
          fi
        done
}
---------------------------------------------------------------------------

	Now, examine, if you please, what happens when we reach the
 expr line. The correct value for $ans is 0, then the expr expression
 always fails. I have narrowed it down to this:

============================================================================
__> if expr "0" : '0$\|1$' > /dev/null; then echo Yes; else echo No; fi
Yes
__> if expr "0" : '0$\|\(1\)$' > /dev/null; then echo Yes; else echo No; fi
No
__> expr "0" : '0$\|1$'
1
__> echo $?
0
__> expr "0" : '0$\|\(1\)$'

__> echo $?
1
__> 
==========================================================================

	Why on earth is the regular expression failing as soon as we
 add the \(\) operators? Since expr says only one set of \(\)
 operators can be used in the first place, this behaviour of expr
 seems unreasonable. 

	Is this reason enough to file a bug against expr? We should
 either fix the kernel sources or put a big notice in the
 kernel-source package about this problem.

	manoj
-- 
 " 'Martyrdom' is the only way a person can become famous without
 ability" George Bernard Shaw
Manoj Srivastava               <url:mailto:srivasta@acm.org>
Mobile, Alabama USA            <url:http://www.datasync.com/%7Esrivasta/>


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: