[git commit] ash: fix help builtin and tab completion of builtins

Denys Vlasenko vda.linux at googlemail.com
Sat Feb 28 10:25:05 UTC 2026


commit: https://git.busybox.net/busybox/commit/?id=b59b00323181d5d450a92959b9bbfe3585c6786b
branch: https://git.busybox.net/busybox/log/?h=master

Commit 56143ea63 (ash: code shrink: eliminate pstrcmp1()) changed
the layout of struct builtincmd so the name member points to the
start of the name, not the flag in the first element of the string.
This broke the help builtin and tab completion of builtins.

Remove the unnecessary '+ 1' in ash_command_name() and helpcmd().

ash_command_name                                      92      91      -1
helpcmd                                              106     102      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-5)               Total: -5 bytes

Signed-off-by: Ron Yorston <rmy at pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index 19623a9a0..62f185354 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10855,7 +10855,7 @@ ash_command_name(int i)
 	int n;
 
 	if (/*i >= 0 &&*/ i < ARRAY_SIZE(builtintab))
-		return builtintab[i].name + 1;
+		return builtintab[i].name;
 	i -= ARRAY_SIZE(builtintab);
 
 	for (n = 0; n < CMDTABLESIZE; n++) {
@@ -14395,7 +14395,7 @@ helpcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
 		"------------------\n");
 	for (col = 0, i = 0; i < ARRAY_SIZE(builtintab); i++) {
 		col += out1fmt("%c%s", ((col == 0) ? '\t' : ' '),
-					builtintab[i].name + 1);
+					builtintab[i].name);
 		if (col > 60) {
 			out1fmt("\n");
 			col = 0;


More information about the busybox-cvs mailing list