[PATCH] ash: allow Ctrl-C to abort PS2, like Bash and Dash

Joachim Nilsson troglobit at gmail.com
Sat May 9 10:03:45 UTC 2020


Prior to patch:

    $ '
    > Ctrl-C
    >

I.e., not possible to breaḱ out from PS2 prompt, unless inputing final
quote character.   Ctrl-D works, but this patch makes ash behave like
Bash and Dash:

    $ '
    > Ctrl-C
    ash: syntax error: unterminated quoted string
    $

Signed-off-by: Joachim Nilsson <troglobit at gmail.com>
---
 shell/ash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index 2a4c839a7..f401a095f 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10629,8 +10629,8 @@ preadfd(void)
 				return 1;
 			}
 			exitstatus = 128 + SIGINT;
-			bb_putchar('\n');
-			goto retry;
+			raise(SIGINT);
+			return -1;
 		}
 		if (nr < 0) {
 			if (errno == 0) {
-- 
2.25.1



More information about the busybox mailing list