`foo=1 foo=2 cmd' has an undefined behavior.

* acgeneral.m4 (_AC_COMPUTE_INT_COMPILE): Do not put two shell
variable assignments in one shell command.
* doc/autoconf.texi (Shell Substitutions): Document.
This commit is contained in:
Akim Demaille 2000-06-07 11:57:11 +00:00
parent 6802267be2
commit 1740faf5e0
4 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2000-06-07 Philippe De Muyter <phdm@macqel.be>
`foo=1 foo=2 cmd' has an undefined behavior.
* acgeneral.m4 (_AC_COMPUTE_INT_COMPILE): Do not put two shell
variable assignments in one shell command.
* doc/autoconf.texi (Shell Substitutions): Document.
2000-06-07 Steven G. Johnson <stevenj@alum.mit.edu> 2000-06-07 Steven G. Johnson <stevenj@alum.mit.edu>
* aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Fix problem on Cray due to * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Fix problem on Cray due to

View File

@ -3179,13 +3179,13 @@ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= 0])],
while true; do while true; do
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_try])], AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_try])],
[ac_hi=$ac_try; break], [ac_hi=$ac_try; break],
[ac_lo=`expr $ac_try + 1` ac_try=`expr 2 '*' $ac_try + 1`]) [ac_lo=`expr $ac_try + 1`; ac_try=`expr 2 '*' $ac_try + 1`])
done], done],
[ac_hi=-1 ac_try=-1 [ac_hi=-1 ac_try=-1
while true; do while true; do
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_try])], AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_try])],
[ac_lo=$ac_try; break], [ac_lo=$ac_try; break],
[ac_hi=`expr $ac_try - 1` ac_try=`expr 2 '*' $ac_try`]) [ac_hi=`expr $ac_try - 1`; ac_try=`expr 2 '*' $ac_try`])
done]) done])
# Binary search between lo and hi bounds. # Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do while test "x$ac_lo" != "x$ac_hi"; do

View File

@ -4718,6 +4718,11 @@ If the value is a literal string, it should be quoted:
otherwise some shells, such as on Digital Unix V 5.0, will die because otherwise some shells, such as on Digital Unix V 5.0, will die because
of a @emph{bad substitution}. of a @emph{bad substitution}.
When setting several variables in a row, be aware that the order of the
evaluation is undefined. For instance @samp{foo=1 foo=2; echo $foo}
gives @samp{1} with sh on Solaris, but @samp{2} with bash. You must use
@samp{;} to enforce the order: @samp{foo=1; foo=2; echo $foo}.
Contrary to a persistent urban legend, the Bourne shell does not Contrary to a persistent urban legend, the Bourne shell does not
systematically split variables and backquoted expressions, in systematically split variables and backquoted expressions, in
particular, the following code: particular, the following code:

View File

@ -3179,13 +3179,13 @@ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= 0])],
while true; do while true; do
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_try])], AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_try])],
[ac_hi=$ac_try; break], [ac_hi=$ac_try; break],
[ac_lo=`expr $ac_try + 1` ac_try=`expr 2 '*' $ac_try + 1`]) [ac_lo=`expr $ac_try + 1`; ac_try=`expr 2 '*' $ac_try + 1`])
done], done],
[ac_hi=-1 ac_try=-1 [ac_hi=-1 ac_try=-1
while true; do while true; do
AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_try])], AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_try])],
[ac_lo=$ac_try; break], [ac_lo=$ac_try; break],
[ac_hi=`expr $ac_try - 1` ac_try=`expr 2 '*' $ac_try`]) [ac_hi=`expr $ac_try - 1`; ac_try=`expr 2 '*' $ac_try`])
done]) done])
# Binary search between lo and hi bounds. # Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do while test "x$ac_lo" != "x$ac_hi"; do