diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-26 15:56:53 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-26 15:56:53 +0200 |
commit | f15aa57a7f5edcbf3098873b8798c0ea7f496ed7 (patch) | |
tree | 5641162328f080297bd9a27cf50730dbb3a8f604 /shell/ash_test | |
parent | e19923f6652a638ac39c84012e97f52cf5a7568e (diff) | |
download | busybox-w32-f15aa57a7f5edcbf3098873b8798c0ea7f496ed7.tar.gz busybox-w32-f15aa57a7f5edcbf3098873b8798c0ea7f496ed7.tar.bz2 busybox-w32-f15aa57a7f5edcbf3098873b8798c0ea7f496ed7.zip |
ash: [PARSER] Fix parsing of ${##1}
Upstream commit:
Date: Thu, 4 Oct 2007 22:15:10 +0800
[PARSER] Fix parsing of ${##1}
Previously dash treated ${##1} as a length operation. This patch fixes that.
Test case:
set -- a
echo ${##1}OK
Old result:
1OK
New result:
OK
This was a real bug in ash (but not in hush).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test')
-rw-r--r-- | shell/ash_test/ash-vars/param_expand_len.right | 3 | ||||
-rwxr-xr-x | shell/ash_test/ash-vars/param_expand_len.tests | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/shell/ash_test/ash-vars/param_expand_len.right b/shell/ash_test/ash-vars/param_expand_len.right index 96e8cb59b..48d01d2fe 100644 --- a/shell/ash_test/ash-vars/param_expand_len.right +++ b/shell/ash_test/ash-vars/param_expand_len.right | |||
@@ -7,3 +7,6 @@ Make sure len parsing doesnt break arg count | |||
7 | Testing len op | 7 | Testing len op |
8 | 4 3 2 1 0 0 | 8 | 4 3 2 1 0 0 |
9 | 0 3 0 | 9 | 0 3 0 |
10 | Nothing: | ||
11 | Nothing: | ||
12 | One:1 | ||
diff --git a/shell/ash_test/ash-vars/param_expand_len.tests b/shell/ash_test/ash-vars/param_expand_len.tests index fe20a45e9..369c8d456 100755 --- a/shell/ash_test/ash-vars/param_expand_len.tests +++ b/shell/ash_test/ash-vars/param_expand_len.tests | |||
@@ -15,3 +15,10 @@ unset e | |||
15 | f=abc | 15 | f=abc |
16 | g= | 16 | g= |
17 | echo ${#e} ${#f} ${#g} | 17 | echo ${#e} ${#f} ${#g} |
18 | |||
19 | set -- a | ||
20 | # This must be interpreted as: $# ("1"), then remove trailing "1". | ||
21 | # IOW: empty result. | ||
22 | echo Nothing:${##1} | ||
23 | echo Nothing:${#%1} | ||
24 | echo One:${##x} | ||