[PATCH 2/2] Document ash and hush config options in more detail.

Kang-Che Sung explorer09 at gmail.com
Mon Jan 9 15:04:35 UTC 2017


Which of the bash-compatible extensions are supported in ash and hush
are now listed.

Also be precise about which of the builtins will be enabled in each
option.

(By the way, I didn't yet have an idea about what ash's "monitor"
(set -m) option will do when job control is disabled at build time.)

Signed-off-by: Kang-Che Sung <explorer09 at gmail.com>
---
 shell/ash.c  | 30 +++++++++++++++++++++---------
 shell/hush.c | 15 ++++++++++++++-
 2 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index 9c46a93e0..272682d78 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -72,7 +72,18 @@
 //config: default y
 //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
-//config:  Enable bash-compatible extensions.
+//config:  Enable bash-compatible extensions, which currently include:
+//config:  - 'source' builtin
+//config:  - '[[' builtin (if 'test' builtin is also enabled)
+//config:  - 'function' keyword
+//config:  - pipefail option ('set -o pipefail')
+//config:  - $'...' expansion
+//config:  - ${var:position:length} expansion
+//config:  - ${var/pattern/replacement} expansion
+//config:  - ${var//pattern/replacement} expansion
+//config:  - $HOSTNAME variable
+//config:  - $SHLVL variable
+//config:  - '&>' redirection ('&>file' equivalent to '>file 2>&1')
 //config:
 //config:config ASH_IDLE_TIMEOUT
 //config: bool "Idle timeout variable"
@@ -87,48 +98,49 @@
 //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
 //config:  Enable job control in the ash shell.
+//config:  Enable these builtins: bg, fg, jobs, kill
 //config:
 //config:config ASH_ALIAS
 //config: bool "Alias support"
 //config: default y
 //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
-//config:  Enable alias support in the ash shell.
+//config:  Enable support for 'alias' and 'unalias' builtins in ash.
 //config:
 //config:config ASH_GETOPTS
 //config: bool "Builtin getopt to parse positional parameters"
 //config: default y
 //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
-//config:  Enable support for getopts builtin in ash.
+//config:  Enable support for 'getopts' builtin in ash.
 //config:
 //config:config ASH_BUILTIN_ECHO
 //config: bool "Builtin version of 'echo'"
 //config: default y
 //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
-//config:  Enable support for echo builtin in ash.
+//config:  Enable support for 'echo' builtin in ash.
 //config:
 //config:config ASH_BUILTIN_PRINTF
 //config: bool "Builtin version of 'printf'"
 //config: default y
 //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
-//config:  Enable support for printf builtin in ash.
+//config:  Enable support for 'printf' builtin in ash.
 //config:
 //config:config ASH_BUILTIN_TEST
-//config: bool "Builtin version of 'test'"
+//config: bool "Builtin version of 'test' and '['"
 //config: default y
 //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
-//config:  Enable support for test builtin in ash.
+//config:  Enable support for 'test' and '[' builtins in ash.
 //config:
 //config:config ASH_HELP
 //config: bool "help builtin"
 //config: default y
 //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
 //config: help
-//config:  Enable help builtin in ash.
+//config:  Enable 'help' builtin in ash.
 //config:
 //config:config ASH_CMDCMD
 //config: bool "'command' command to override shell builtins"
@@ -3943,7 +3955,7 @@ fg_bgcmd(int argc UNUSED_PARAM, char **argv)
  } while (*argv && *++argv);
  return retval;
 }
-#endif
+#endif /* JOBS */

 static int
 sprint_status48(char *s, int status, int sigonly)
diff --git a/shell/hush.c b/shell/hush.c
index 5c5715b3f..fe9444181 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -100,7 +100,17 @@
 //config: default y
 //config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
 //config: help
-//config:  Enable bash-compatible extensions.
+//config:  Enable bash-compatible extensions, which currently include:
+//config:  - 'source' builtin
+//config:  - '[[' builtin ('test' and '[' builtin are always enabled
+//config:    regardless)
+//config:  - ${var:position:length} expansion (if math support is also
+//config:    enabled)
+//config:  - ${var/pattern/replacement} expansion
+//config:  - ${var//pattern/replacement} expansion
+//config:  - $HOSTNAME variable
+//config:  Brace expansion is available as a separate config option
+//config:  (HUSH_BRACE_EXPANSION).
 //config:
 //config:config HUSH_BRACE_EXPANSION
 //config: bool "Brace expansion"
@@ -136,6 +146,9 @@
 //config:  "cmd &" still works by simply spawning a process and immediately
 //config:  prompting for next command (or executing next command in a script),
 //config:  but no separate process group is formed.
+//config:
+//config:  Note: It is not yet able to disable job control at runtime
+//config:  ("set +m" won't work).
 //config:
 //config:config HUSH_TICK
 //config: bool "Process substitution"
-- 
2.11.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2-busybox-ash-hush-config-help.patch
Type: text/x-patch
Size: 5270 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20170109/11f915e3/attachment.bin>


More information about the busybox mailing list