summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-02-14 16:51:58 +0000
committerDenis Vlasenko2008-02-14 16:51:58 +0000
commit94e87bc83d81e1226224e39c50b4eea8384bbdcf (patch)
tree7c26420347760134bc148ef14d68ace3bcdd0bcb
parent28bf671d6d92d0c2842bd5f4555f5af937a0a6db (diff)
downloadbusybox-94e87bc83d81e1226224e39c50b4eea8384bbdcf.zip
busybox-94e87bc83d81e1226224e39c50b4eea8384bbdcf.tar.gz
ash: explain why "set -o BOGUS" doesn't abort
-rw-r--r--shell/ash.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 6121720..10eb90d 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9075,6 +9075,23 @@ setparam(char **argv)
/*
* 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)