[git commit] ash: [PARSER] Do not show prompts in expandstr

Denys Vlasenko vda.linux at googlemail.com
Tue Oct 25 19:17:52 UTC 2016


commit: https://git.busybox.net/busybox/commit/?id=2a6d29ad5ce652c03ed8324a0d14f62594f2dd84
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Upstream patch:

    Date: Thu, 27 Dec 2007 13:57:07 +1100
    [PARSER] Do not show prompts in expandstr

    Once I fixed the previous problem it became apparent that we never dealt
    with prompts with new-lines in them correctly.  The problem is that we
    showed a secondary prompt for each of them.

    This patch disables prompt generation in expandstr.

    Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>

function                                             old     new   delta
expandstr                                            102     127     +25

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/shell/ash.c b/shell/ash.c
index 527abc7..dc0f607 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12276,11 +12276,17 @@ static const char *
 expandstr(const char *ps)
 {
 	union node n;
+	int saveprompt;
 
 	/* XXX Fix (char *) cast. It _is_ a bug. ps is variable's value,
 	 * and token processing _can_ alter it (delete NULs etc). */
 	setinputstring((char *)ps);
+
+	saveprompt = doprompt;
+	doprompt = 0;
 	readtoken1(pgetc(), PSSYNTAX, nullstr, 0);
+	doprompt = saveprompt;
+
 	popfile();
 
 	n.narg.type = NARG;


More information about the busybox-cvs mailing list