[git commit] ash: PSSYNTAX: preserve \\ in addition to \$
Denys Vlasenko
vda.linux at googlemail.com
Sat Oct 10 16:28:51 UTC 2026
commit: https://git.busybox.net/busybox/commit/?id=aeaa7f547c0eecfe0d24a4f1f8f1243b293975aa
branch: https://git.busybox.net/busybox/log/?h=master
'\\t' in PS1 was incorrectly displayed as a timestamp instead of
the intended '\t' because '\\' was not preserved.
function old new delta
readtoken1 3072 3079 +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 7/0) Total: 7 bytes
Signed-off-by: Avi Halachmi (:avih) <avihpit at yahoo.com>
Signed-off-by: Ron Yorston <rmy at pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
shell/ash.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
index c35c53d37..df7e570a0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2873,7 +2873,8 @@ static const char *expandstr(const char *ps, int syntax_type);
#if ENABLE_ASH_EXPAND_PRMT
# define PSSYNTAX 4 /* prompt. never passed to SIT() */
#endif
-/* PSSYNTAX expansion is identical to DQSYNTAX, except keeping '\$' as '\$' */
+/* PSSYNTAX expansion is identical to DQSYNTAX, except keeping '\$' as '\$'
+ * and '\\' as '\\' */
/*
* called by editline -- any expansions to the prompt should be added here.
@@ -13233,7 +13234,7 @@ readtoken1(int c, int syntax, struct heredoc *eofmark)
USTPUTC('\\', out);
pungetc();
} else {
- if (pssyntax && c == '$') {
+ if (pssyntax && (c == '$' || c == '\\')) {
USTPUTC(CTLESC, out);
USTPUTC('\\', out);
}
More information about the busybox-cvs
mailing list