[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bash 2.05 infinite loop on 64-bit bigendian platforms
From: |
Paul Eggert |
Subject: |
Bash 2.05 infinite loop on 64-bit bigendian platforms |
Date: |
Wed, 2 May 2001 19:05:35 -0700 (PDT) |
Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.7
Compiler: cc -xarch=v9
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc'
-DCONF_OSTYPE='solaris2.7' -DCONF_MACHTYPE='sparc-sun-solaris2.7'
-DCONF_VENDOR='sun' -DSHELL -DHAVE_CONFIG_H -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -I.. -I../include -I../lib
-I/tmp/prefix/include -g
uname output: SunOS sic.twinsun.com 5.7 Generic_106541-15 sun4u sparc
SUNW,UltraSPARC-IIi-Engine
Machine Type: sparc-sun-solaris2.7
Bash Version: 2.05
Patch Level: 0
Release Status: release
Description:
Bash 2.05 fails the "make check" on 64-bit Solaris 7 (sparc);
it reports bogus line numbers and eventually goes into an
infinite loop. (See the Repeat-By below.)
The problem is that Bash uses one method (a union) to convert
an integer to a char * in unwind_protect_int, and a different
method (a cast) to convert back in restore_variable. These
two methods are equivalent when sizeof (int) == sizeof (char *),
and they are also equivalent on little-endian platform like an
Alpha even when sizeof (int) < sizeof (char *); but they are
not equivalent when you are using a big-endian platform where
sizeof (int) < sizeof (char *).
Repeat-By:
$ make check
Testing /net/knick/project/reb/src/base/bash/sunos57v9/bash
version: 2.05.0(1)-release
versinfo: 2 05 0 1 release sparc-sun-solaris2.7
HOSTTYPE = sparc
OSTYPE = solaris2.7
MACHTYPE = sparc-sun-solaris2.7
Any output from any test, unless otherwise noted, indicates a possible
anomaly
run-arith
run-arith-for
67,68c67,68
< ./arith-for.tests: line 35: syntax error: arithmetic expression
required
< ./arith-for.tests: line 35: syntax error: `(( i=0; "i < 3" ))'
---
> ./arith-for.tests: line 77: syntax error: arithmetic expression
required
> ./arith-for.tests: line 77: syntax error: `(( i=0; "i < 3" ))'
70,71c70,71
< ./arith-for.tests: line 41: syntax error: `;' unexpected
< ./arith-for.tests: line 41: syntax error: `(( i=0; i < 3; i++; 7 ))'
---
> ./arith-for.tests: line 83: syntax error: `;' unexpected
> ./arith-for.tests: line 83: syntax error: `(( i=0; i < 3; i++; 7 ))'
run-array
warning: all of these tests will fail if arrays have not
warning: been compiled into the shell
run-array2
warning: all of these tests will fail if arrays have not
warning: been compiled into the shell
run-braces
run-builtins
[At this point Bash goes into an infinite loop, chewing up CPU time.]
Fix:
2001-05-02 Paul Eggert <eggert@twinsun.com>
* unwind_prot.c (restore_variable): Use the reverse of the
method used by unwind_protect_int in the case where the size
equals sizeof (int). This fix is needed on bigendian hosts
where sizeof (int) < sizeof (char *), e.g. 64-bit Solaris
sparc.
===================================================================
RCS file: RCS/unwind_prot.c,v
retrieving revision 2.5
retrieving revision 2.5.0.1
diff -pu -r2.5 -r2.5.0.1
--- unwind_prot.c 2001/02/14 22:00:55 2.5
+++ unwind_prot.c 2001/05/03 01:55:33 2.5.0.1
@@ -299,7 +299,11 @@ restore_variable (sv)
free (sv->desired_setting);
}
else
- *(sv->variable) = (int)sv->desired_setting;
+ {
+ UWP u;
+ u.s = sv->desired_setting;
+ *(sv->variable) = u.i;
+ }
free (sv);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Bash 2.05 infinite loop on 64-bit bigendian platforms,
Paul Eggert <=