Age | Commit message (Collapse) | Author |
|
Since we check for '\' anyway when we determine whether we can look ahead,
we can just check for *and handle* it there.
function old new delta
parse_stream 2751 2740 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
newer bash does not drop it, most other shells too
function old new delta
unbackslash 39 57 +18
parse_stream 2753 2751 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 18/-2) Total: 16 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
encode_string 268 250 -18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2762 2753 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2780 2762 -18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2787 2780 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2919 2787 -132
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
done_word 790 767 -23
parse_stream 3018 2919 -99
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-122) Total: -122 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
remove_nested_vars - 77 +77
run_pipe 1756 1786 +30
pseudo_exec_argv 376 379 +3
leave_var_nest_level 98 32 -66
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 110/-66) Total: 44 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
hush_main 1714 1718 +4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Now shows PS2 in this case:
/path/to/dir $ a=b; echo $((
> _
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
"unset PS1/PS2" causes prompts to be empty strings
function old new delta
hush_main 1031 1089 +58
goto_new_line 27 33 +6
fgetc_interactive 244 245 +1
unset_local_var 155 149 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 65/-6) Total: 59 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
handle_changed_special_names 99 101 +2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
handle_changed_special_names - 99 +99
unset_local_var 256 155 -101
set_local_var 557 437 -120
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 99/-221) Total: -122 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
expand_one_var 1612 1604 -8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
hush_main 1015 1031 +16
packed_usage 32757 32745 -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 16/-12) Total: 4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
See added testcases
function old new delta
run_pipe 1723 1784 +61
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Cases like these:
var=val exec >redir
var=val `` >redir
function old new delta
run_pipe 1701 1723 +22
redirect_and_varexp_helper 56 55 -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 22/-1) Total: 21 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
run_pipe 1651 1701 +50
set_local_var 510 557 +47
pseudo_exec_argv 544 581 +37
redirect_and_varexp_helper 64 56 -8
set_vars_and_save_old 164 149 -15
unset_local_var 274 256 -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/3 up/down: 134/-41) Total: 93 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
run_pipe 1641 1651 +10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
unset_local_var 20 274 +254
leave_var_nest_level - 98 +98
set_vars_and_save_old 128 164 +36
enter_var_nest_level - 32 +32
builtin_local 46 50 +4
pseudo_exec_argv 554 544 -10
redirect_and_varexp_helper 77 64 -13
run_pipe 1890 1641 -249
unset_local_var_len 267 - -267
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/3 up/down: 424/-539) Total: -115 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Also, add code to abort at ~65000 function recursion depth.
SEGVing is not as nice as exiting with a message (and restoring termios!):
$ f() { echo -n .; f; }; f
....<many dots later>....hush: fatal recursion (depth 65281)
function old new delta
run_pipe 1826 1890 +64
pseudo_exec_argv 544 554 +10
parse_and_run_file 71 80 +9
i_getch 104 107 +3
done_command 99 102 +3
set_local_var 508 510 +2
helper_export_local 214 215 +1
builtin_local 49 46 -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/1 up/down: 92/-3) Total: 89 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Many other shells support this construct
function old new delta
parse_stream 2950 3018 +68
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
run_pipe 1820 1826 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
done_word 738 790 +52
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
run_list 1270 1053 -217
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
bb_die_memory_exhausted - 10 +10
xstrdup 28 23 -5
xsetenv 27 22 -5
xrealloc 32 27 -5
xputenv 22 17 -5
xmalloc 30 25 -5
xfdopen_helper 40 35 -5
xasprintf 44 39 -5
wget_main 2387 2382 -5
open_socket 54 49 -5
glob_brace 419 414 -5
bb_get_chunk_from_file 146 141 -5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/11 up/down: 10/-55) Total: -45 bytes
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
parse_stream 2787 2827 +40
builtin_type 117 115 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Testcase:
set -- a ""; space=" "; printf "<%s>\n" "$@"$space
Before:
<a >
After:
<a>
<>
It usually does not bite since bbox forces -funsigned-char build.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Based on a patch by Mark Marshall <mark.marshall@omicronenergy.com>
function old new delta
dup_CLOEXEC - 49 +49
fcntl_F_DUPFD 46 - -46
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
run_pipe 1589 1591 +2
pseudo_exec_argv 374 375 +1
builtin_type 114 115 +1
find_function 8 - -8
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 3/0 up/down: 4/-8) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
It turns out bkslash_in_varexp.tests was a bash bug :]
ash and hush fail "corrected" bkslash_in_varexp.tests as well,
just not as badly as I thought (hush gets half of the cases right).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Incidentally, this fixes LINENO bug here:
echo "1:${LINENO}"
echo "2:`echo; echo`" # was counting lines in the `cmd` output as LINENO++
echo "3:${LINENO}"
function old new delta
parse_and_run_file 53 71 +18
expand_vars_to_list 1187 1164 -23
setup_file_in_str 25 - -25
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 18/-48) Total: -30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
I don't have an example of mishandled script, but the logic looked wrong:
it could sometimes treat newlines as if they are spaces.
function old new delta
parse_stream 2788 2787 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Script triggering the bug:
t=0
echo "at line ${LINENO}"
while [ ${t} -lt 10 ]; do
echo "at line ${LINENO}" # LINENO was 3 instead of 4 here
t=$((t+1))
done
function old new delta
parse_stream 2754 2788 +34
done_word 711 738 +27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0) Total: 61 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
check_and_run_traps 211 236 +25
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
builtin_source 182 209 +27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
expand_one_var 1592 1618 +26
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_dollar 820 779 -41
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|