Age | Commit message (Collapse) | Author |
|
This used to work but doesn't now:
foo () {
cat <<EOF && { echo "$1" ; }
$1
EOF
}
foo "bar"
Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Commit 503a0b8 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu says:
>The parsebackquote flag is only used in a test where it always has the
>value zero. So we can remove it altogether.
The first statement is incorrect: parsebackquote is non-zero when
backquotes (as opposed to $(...)) are used for command substitution.
It is possible for the test to be executed with parsebackquote != 0 in
that case.
The test is question checks whether quotes have been closed, raising
the error "unterminated quoted string" if they haven't. There seems
to be no good reason to allow unclosed quotes within backquotes. Bash,
hush and dash (after commit 503a0b8) all treat the following as an error:
XX=`"pwd`
whereas BusyBox ash doesn't. It just ignores the unclosed quote and
executes pwd.
So, parsebackquote should be removed but not for the reason stated.
function old new delta
parsebackquote 1 - -1
readtoken1 3222 3182 -40
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-41) Total: -41 bytes
Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Because the parser does not recursively parse parameter expansion
with respect to quotes, we can't accurately determine quote status at
parse time. This patch works around this by moving the quote detection
to run-time where we do interpret it recursively.
Test case:
foo=\\ echo "<${foo#[\\]}>"
Old result:
<\>
New result:
<>
Do not quote back slashes in parameter expansions outside quotes.
Test case:
a=/b/c/*
b=\\
echo ${a%$b*}
Old result:
/b/c/*
New result:
/b/c/
Based on commits 880d952, 7cfd8be, 0d7d660 and a7c21a6 from
git://git.kernel.org/pub/scm/utils/dash/dash.git by Herbert Xu
function old new delta
argstr 1164 1193 +29
memtodest 147 174 +27
subevalvar 1153 1177 +24
redirect 1279 1282 +3
dolatstr 5 7 +2
static.spclchars 10 9 -1
expandarg 962 960 -2
evalcase 273 271 -2
evalcommand 1204 1197 -7
rmescapes 236 227 -9
preglob 27 8 -19
evalvar 604 582 -22
cmdputs 389 334 -55
readtoken1 3163 3061 -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/9 up/down: 85/-219) Total: -134 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Collapsing arithmetic expansion is incorrect when the inner arithmetic
expansion is a part of a parameter expansion.
Test case:
unset a
echo $((3 + ${a:=$((4 + 5))}))
echo $a
Old result:
12
(4 + 5)
New result:
12
9
Based on commit bb777a6 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu
function old new delta
readtoken1 3180 3163 -17
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Test case:
unset a
echo "${a:-~root}"
Old result:
/root
New result:
~root
Based on commit 170f44d from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu
function old new delta
evalvar 598 604 +6
parse_command 1440 1443 +3
localcmd 325 327 +2
readtoken1 3199 3200 +1
argstr 1180 1164 -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 12/-16) Total: -4 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Previously tilde expansion was not carried out for =?#% expansion words.
Test case:
a=~root:~root
echo ${a#~root}
Old result:
/root:/root
New result:
:/root
Based on commit dd721f71 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu
function old new delta
subevalvar 1152 1153 +1
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
killcmd 109 224 +115
kill_main 882 910 +28
changepath 194 195 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 144/0) Total: 144 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
echo_main 297 336 +39
stpcpy - 22 +22
run_pipe 1561 1566 +5
pseudo_exec_argv 187 192 +5
hush_exit 75 80 +5
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 4/0 up/down: 98/0) Total: 76 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
arith_apply 1271 1283 +12
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
function old new delta
expand_and_evaluate_arith 87 106 +19
expand_one_var 1563 1570 +7
arith 12 18 +6
evaluate_string 678 680 +2
arith_apply 1269 1271 +2
builtin_umask 133 132 -1
ash_arith 118 75 -43
expand_vars_to_list 1094 1038 -56
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/3 up/down: 36/-100) Total: -64 bytes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
function old new delta
expand_vars_to_list 2386 2833 +447
expand_string_to_string 69 110 +41
parse_dollar 681 721 +40
hush_main 963 945 -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 528/-18) Total: 510 bytes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
But it _still_ doesn't pass! quoted case is a tough nut to crack
function old new delta
redirect 1281 1286 +5
subevalvar 1141 1142 +1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
changepath 195 192 -3
subevalvar 1204 1200 -4
readtoken1 3247 3240 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-14) Total: -14 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
subevalvar 1152 1178 +26
readtoken1 3267 3275 +8
redirect 1284 1286 +2
expandarg 957 958 +1
expdir 4 - -4
evalcommand 1219 1209 -10
expmeta 481 469 -12
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/2 up/down: 37/-26) Total: 11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Andreas Bühmann <buehmann@users.berlios.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
+ document the bug better
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
trapcmd 271 277 +6
localcmd 277 275 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
trapcmd 236 271 +35
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
evalvar 1373 1371 -2
builtin_trap 457 441 -16
trapcmd 260 236 -24
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|