]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* doc/autoconf.texi (Assignments): Don't read $? after an
authorAkim Demaille <akim@epita.fr>
Thu, 30 Nov 2000 17:48:50 +0000 (17:48 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 30 Nov 2000 17:48:50 +0000 (17:48 +0000)
assignment.

ChangeLog
doc/autoconf.texi

index 46ec04f1a6cf80e96fe88152dc3e061cbb52f1c8..e153ab06b4b92b46b3cad0178cd3d63a26349b9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-30  Akim Demaille  <akim@epita.fr>
+
+       * doc/autoconf.texi (Assignments): Don't read $? after an
+       assignment.
+
 2000-11-30  Akim Demaille  <akim@epita.fr>
 
        * sh.m4 (AS_EXIT): Don't rely on false exiting 1.
index d3027d97d38d9a3531ef7245e1bcb722c0709f97..cac52fd75d1c356d6fd006c71ef5f437e6cb4000 100644 (file)
@@ -5074,15 +5074,6 @@ should workaround them, since version 0.2 is still shipped with many
 To be compatible with @command{ash} 0.2
 
 @itemize @bullet
-@item
-don't rely on variable assignment setting @samp{$?} unless the
-assignment involves command substitution:
-
-@example
-false || foo=bar && echo "Not portable"
-false || foo=`bar` && echo "Portable"
-@end example
-
 @item
 don't use @samp{$?} after expanding empty or unset variables:
 
@@ -5345,6 +5336,24 @@ 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}.
 
+Don't rely on the exit status of an assignment: Ash 0.2 does not change
+the status and propagates that of the last statement:
+
+@example
+$ false || foo=bar; echo $?
+1
+$ false || foo=`:`; echo $?
+0
+@end example
+
+@noindent
+and to make things even worse, @sc{qnx 4.25} just sets the exit status
+to 0 in any case:
+
+@example
+$ foo=`exit 1`; echo $?
+0
+@end example
 
 To assign default values follow this algorithm: