[Top][All Lists]

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

FYI: AS_EXIT (Was: Backquotes in quotes in backquotes)

From: Akim Demaille
Subject: FYI: AS_EXIT (Was: Backquotes in quotes in backquotes)
Date: 30 Nov 2000 18:34:00 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

>>>>> "Akim" == Akim Demaille <address@hidden> writes:

Akim> Gimme a couple minutes :)

You can check now.

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * sh.m4 (AS_EXIT): Don't rely on false exiting 1.
        Actually, always use `(exit $val); exit', don't try smart stuff.
        * doc/autoconf.texi (Limitations of Builtins) <false>: new.

Index: m4sh.m4
RCS file: /cvs/autoconf/m4sh.m4,v
retrieving revision 1.15
diff -u -u -r1.15 m4sh.m4
--- m4sh.m4 2000/11/30 16:30:54 1.15
+++ m4sh.m4 2000/11/30 17:26:25
@@ -106,11 +106,7 @@
 # So we set $? by executing "exit N" in the subshell and then exit.
 # "false" is used for exit code 1 (default), ":" is used for 0
-[{ m4_case([$1],
-           [0], [:; exit],
-           [],  [false; exit],
-           [1], [false; exit],
-           [(exit $1); exit]); }])
+[{ (exit m4_default([$1], 1)); exit; }])
Index: doc/autoconf.texi
RCS file: /cvs/autoconf/doc/autoconf.texi,v
retrieving revision 1.400
diff -u -u -r1.400 autoconf.texi
--- doc/autoconf.texi 2000/11/30 14:48:03 1.400
+++ doc/autoconf.texi 2000/11/30 17:26:46
@@ -5515,11 +5515,15 @@
 @cindex @command{!}
 You can't use @command{!}, you'll have to rewrite your code.
 @item @command{break}
address@hidden ------------------
 @cindex @command{break}
 The use of @samp{break 2} etc. is safe.
 @item @command{case}
address@hidden -----------------
 @cindex @command{case}
 You don't need to quote the argument, no splitting is performed.
@@ -5545,7 +5549,9 @@
 @end example
 @item @command{echo}
address@hidden -----------------
 @cindex @command{echo}
 The simple @code{echo} is probably the most surprising source of
 portability troubles.
@@ -5562,7 +5568,9 @@
 problem is truly @command{echo}: all the shells understand @samp{'\n'}
 as the string composed of a backslash and an n.
 @item @command{exit}
address@hidden -----------------
 @cindex @command{exit}
 @c FIXME: A better merging between this item and `trap' is welcome.
 Some shell scripts, such as those generated by @command{autoconf}, use a
@@ -5576,7 +5584,9 @@
 @code{exit 1}.  Instead of calling @code{exit} directly, use the
 @code{AC_MSG_ERROR} macro that has a workaround for this problem.
 @item @command{export}
address@hidden -------------------
 @cindex @command{export}
 The builtin @command{export} dubs @dfn{environment variable} a shell
 variable.  Each update of exported variables corresponds to an update of
@@ -5606,7 +5616,16 @@
 Therefore you should @command{export} again each environment variable
 you update.
address@hidden @command{false}
address@hidden ------------------
address@hidden @command{false}
+Don't expect @command{false} to exit with status 1: The native Bourne
+shell of Solaris 2.8 exits with status 255.
 @item @command{for}
address@hidden ----------------
 @cindex @command{for}
 To loop over positional arguments, use
@@ -5656,6 +5675,7 @@
 @end example
 @item @command{set}
address@hidden ----------------
 @cindex @command{set}
 This builtin faces the usual problem with arguments starting with a
 dash.  Modern shells, such as Bash or Zsh understand @samp{--} to
@@ -5670,12 +5690,14 @@
 @end example
 @item @command{shift}
address@hidden ------------------
 @cindex @command{shift}
 Not only is @command{shift}ing a bad idea when there is nothing left to
 shift, but in addition it is not portable: the shell of @sc{mips
 risc/os} 4.52 refuses it.
 @item @command{test}
address@hidden -----------------
 @cindex @command{test}
 The @code{test} program is the way to perform many file and string
 tests.  It is often invoked by the alternate name @samp{[}, but using
@@ -5773,7 +5795,9 @@
 "address@hidden" | grep "address@hidden"}, because it avoids problems when
 @address@hidden contains backslashes.
 @item @command{trap}
address@hidden -----------------
 @cindex @command{trap}
 It is safe to trap at least the signals 1, 2, 13 and 15.  You can also
 trap 0, i.e., have the trap run when the script end (either via an
@@ -5825,6 +5849,7 @@
 Fortunately this bug affects only trap.
 @item @command{true}
address@hidden -----------------
 @cindex @command{true}
 @cindex @command{:}
 Don't worry: as far as we know @command{true} is portable.
@@ -5841,6 +5866,7 @@
 @item @command{unset}
address@hidden ------------------
 @cindex @command{unset}
 You cannot assume the support of @command{unset}, nevertheless, because
 it is extremely useful to disable embarrassing variables such as
@@ -5870,6 +5896,7 @@
 @table @asis
 @item @command{awk}
address@hidden ----------------
 @cindex @command{awk}
 Don't leave white spaces before the parentheses in user functions calls,
 @sc{gnu} awk will reject it:

reply via email to

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