svn commit: trunk/busybox/shell

vda at busybox.net vda at busybox.net
Thu Feb 14 16:51:59 UTC 2008


Author: vda
Date: 2008-02-14 08:51:58 -0800 (Thu, 14 Feb 2008)
New Revision: 21020

Log:
ash: explain why "set -o BOGUS" doesn't abort



Modified:
   trunk/busybox/shell/ash.c


Changeset:
Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2008-02-14 15:49:48 UTC (rev 21019)
+++ trunk/busybox/shell/ash.c	2008-02-14 16:51:58 UTC (rev 21020)
@@ -9075,6 +9075,23 @@
 /*
  * Process shell options.  The global variable argptr contains a pointer
  * to the argument list; we advance it past the options.
+ *
+ * SUSv3 section 2.8.1 "Consequences of Shell Errors" says:
+ * For a non-interactive shell, an error condition encountered
+ * by a special built-in ... shall cause the shell to write a diagnostic message
+ * to standard error and exit as shown in the following table:
+ * Error                                           Special Built-In 
+ * ...
+ * Utility syntax error (option or operand error)  Shall exit
+ * ...
+ * However, in bug 1142 (http://busybox.net/bugs/view.php?id=1142)
+ * we see that bash does not do that (set "finishes" with error code 1 instead,
+ * and shell continues), and people rely on this behavior!
+ * Testcase:
+ * set -o barfoo 2>/dev/null
+ * echo $?
+ *
+ * Oh well. Let's mimic that.
  */
 static int
 minus_o(char *name, int val)




More information about the busybox-cvs mailing list