bug-global
[Top][All Lists]
Advanced

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

Re: error in globash.rc


From: Jason Hood
Subject: Re: error in globash.rc
Date: Thu, 07 Feb 2002 07:01:40 +1000

Marcello Nuccio wrote:
> 
> The check for bash version in globash.rc of global-4.3.1 (but the same
> bug is in version 4.1.1) fails if BASH_VERSINFO[1] contains letters.
> I have bash version 2.05a.0(1)-release, and I get:
> 
> address@hidden:~/local/src/global-4.3.1$ bash --rcfile globash.rc
> bash: 05a: value too great for base (error token is "05a")
> Segmentation fault
[snip]

For further future-proofing, this will also fail on 2.08 (same error
as above) and 3.00 (3 is greater than 2, but 00 is still less than 4).
Here's a different patch to overcome those problems:

--- globash.rc.orig     Tue Jan 22 16:30:58 2002
+++ globash.rc  Tue Feb  5 22:10:12 2002
@@ -27,10 +27,12 @@
 # $ bash --rcfile <this file>
 # [/usr/src/sys] ghelp<RET>
 #
-if !(( BASH_VERSINFO[0] >= 2 && BASH_VERSINFO[1] >= 4 )); then
+bash_minorversion=$(expr ${BASH_VERSINFO[1]} : "\([[:digit:]]\+\)" \>= 4)
+if !(( BASH_VERSINFO[0] > 2 || BASH_VERSINFO[0] == 2 && bash_minorversion == 1 
)); then
        echo "GloBash needs Bash version 2.04 or later."
        exit 1
 fi
+unset bash_minorversion
 ###########################################################################
 # Global variables and utilities.
 ###########################################################################

I'm not sure about the portability of \+ in expr - perhaps a combination
of sed and expr should be used.

Jason.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]