From 97c3b5e3ff252b3399d10835d5c906886a7499f4 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 19 Jun 2021 15:28:10 +0200 Subject: hush: fix bkslash+newline handling and number validation in ${NN} and ${#NN} Entering "${1a}" into interactive shell was making it exit. function old new delta parse_dollar 824 958 +134 i_getch_and_eat_bkslash_nl - 44 +44 parse_expr 917 938 +21 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 199/0) Total: 199 bytes Signed-off-by: Denys Vlasenko --- shell/hush_test/hush-parsing/bkslash_newline4.right | 4 ++++ shell/hush_test/hush-parsing/bkslash_newline4.tests | 14 ++++++++++++++ shell/hush_test/hush-vars/var6.right | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 shell/hush_test/hush-parsing/bkslash_newline4.right create mode 100755 shell/hush_test/hush-parsing/bkslash_newline4.tests (limited to 'shell/hush_test') diff --git a/shell/hush_test/hush-parsing/bkslash_newline4.right b/shell/hush_test/hush-parsing/bkslash_newline4.right new file mode 100644 index 0000000..2110716 --- /dev/null +++ b/shell/hush_test/hush-parsing/bkslash_newline4.right @@ -0,0 +1,4 @@ +1:1 +22:22 +3:3 +Ok:0 diff --git a/shell/hush_test/hush-parsing/bkslash_newline4.tests b/shell/hush_test/hush-parsing/bkslash_newline4.tests new file mode 100755 index 0000000..c8f5037 --- /dev/null +++ b/shell/hush_test/hush-parsing/bkslash_newline4.tests @@ -0,0 +1,14 @@ +set -- 1 22 333 +echo 1:$\ +1 +echo 22:$\ +{\ +2\ +} +echo 3:$\ +{\ +#\ +3\ +} +echo Ok:$\ +? diff --git a/shell/hush_test/hush-vars/var6.right b/shell/hush_test/hush-vars/var6.right index 40e67fd..5e28d2f 100644 --- a/shell/hush_test/hush-vars/var6.right +++ b/shell/hush_test/hush-vars/var6.right @@ -1,2 +1,2 @@ -hush: invalid number '1q' +hush: syntax error: unterminated ${name} hush: syntax error: unterminated ${name} -- cgit v1.1