Commit Graph

207 Commits

Author SHA1 Message Date
Denys Vlasenko
3beab83e4f hush: fix for "while false && true; do echo BUG; break; done". closes 6170
function                                             old     new   delta
run_list                                             959     941     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-04-07 18:16:58 +02:00
Denys Vlasenko
88b532d59a hush: source builtin should override $N only if it has args
function                                             old     new   delta
builtin_source                                       174     184     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-17 14:11:04 +01:00
Denys Vlasenko
6e42b89b8d hush: fix remaining known two bugs with IFS expansion. Closes 4027.
function                                             old     new   delta
expand_vars_to_list                                 1054    1140     +86
parse_stream                                        2425    2479     +54
expand_on_ifs                                        258     310     +52
builtin_umask                                        133     132      -1
done_word                                            820     779     -41
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 192/-42)           Total: 150 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-01 18:16:43 +02:00
Denys Vlasenko
4fb53fb08c hush: partially fix wrong expansion on $IFS (bug 4027).
In the added testcase, before patch we failed 8 out of 9 tests,
now we fail only 2 (4th and 5th).

function                                             old     new   delta
expand_on_ifs                                        225     258     +33
expand_vars_to_list                                 1038    1054     +16
o_save_ptr_helper                                    115     119      +4
builtin_umask                                        132     133      +1
o_addQstr                                            165     161      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 54/-4)              Total: 50 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-01 14:06:20 +02:00
Denys Vlasenko
00ae989ee5 hush: fix a corner case of empty "do \n done" structure
The structure is:

    while cmd; do
    done

bash doesn't accept it at all. We were accepting it but execution
was buggy.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-31 17:35:45 +02:00
Denys Vlasenko
29f9b7268a hush: fix misparsing of "... do eval a= ...". Closes 3721
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-14 11:27:36 +02:00
Denys Vlasenko
bcf1fa80f3 hush: add tests for interrupting read
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-09 01:05:33 +02:00
Denys Vlasenko
c162bcdcd1 hush: document a bug about aborting on sourced file error when non-interactive
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-24 05:38:51 +01:00
Denys Vlasenko
68d5cb5dac hush: fix a case where return in sourced file has no effect
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-24 02:50:03 +01:00
Denys Vlasenko
bac0a25f72 slightly better wording in comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-21 03:47:50 +01:00
Denys Vlasenko
b12553faa8 ash: fix ash-signals/signal8 testcase failure
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>
2011-02-21 03:22:20 +01:00
Denys Vlasenko
8ee2adab21 echo: do not retry on write errors
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>
2011-02-07 02:03:51 +01:00
Denys Vlasenko
7b4c0fd5f4 hush: fix improper handling of newline and hash chars in few corner cases
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-11-22 17:58:14 +01:00
Denys Vlasenko
6696eac274 hush: add support for "set -o pipefail"
function                                             old     new   delta
checkjobs                                            467     517     +50
builtin_set                                          259     286     +27
o_opt_strings                                          -      10     +10
hush_main                                           1011    1013      +2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 89/0)               Total: 89 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-14 02:01:50 +01:00
Denys Vlasenko
2bcba5cc53 hush: add brace expansion testcase
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03 17:07:57 +02:00
Denys Vlasenko
bed7c81ea2 shell/math: deconvolute and explain ?: handling. Give better error message
function                                             old     new   delta
arith_apply                                         1271    1283     +12

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-16 11:50:46 +02:00
Denys Vlasenko
063847d6bd shell/math: return string error indicator, not integer
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>
2010-09-15 13:33:02 +02:00
Denys Vlasenko
a110c90de2 hush: fix EXIT trap display inside exit trap handler
function                                             old     new   delta
hush_exit                                             84      78      -6

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:38:04 +02:00
Denys Vlasenko
acd5bc8f64 hush: fix handling of \" in quoted/unquoted cmd
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:05:39 +02:00
Denys Vlasenko
4f870496e7 hush: do fewer strdups in % and hash expansions
function                                             old     new   delta
builtin_umask                                        133     132      -1
expand_one_var                                      1552    1543      -9

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 11:06:01 +02:00
Denys Vlasenko
cc461736d6 hush: fixes to testsuite
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 10:19:22 +02:00
Denys Vlasenko
ebee410fe2 hush: fix var_bash5.tests failure
function                                             old     new   delta
expand_one_var                                      1513    1552     +39
expand_pseudo_dquoted                                118     135     +17
expand_string_to_string                              110     126     +16
setup_heredoc                                        298     308     +10
expand_and_evaluate_arith                             69      79     +10
parse_stream_dquoted                                 233     241      +8
setup_redirects                                      220     225      +5
run_list                                             956     961      +5
expand_assignments                                    76      81      +5
run_pipe                                            1587    1590      +3
parse_stream                                        2371    2374      +3
builtin_umask                                        132     133      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 12/0 up/down: 122/0)            Total: 122 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 10:17:53 +02:00
Denys Vlasenko
101a4e3e21 hush: make parse_dollar flag quited status regardless of glob escaping status
function                                             old     new   delta
parse_stream_dquoted                                 228     233      +5
parse_stream                                        2369    2371      +2
parse_dollar                                         730     717     -13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 7/-13)              Total: -6 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-09 14:04:57 +02:00
Denys Vlasenko
c3adfacd22 hush: fix another corner case with backslashes in heredocs
function                                             old     new   delta
parse_stream                                        2395    2432     +37

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 11:46:03 +02:00
Denys Vlasenko
77b32ccbf2 hush: fix backslash and terminator handling in <<[-]["]heredoc["]
function                                             old     new   delta
parse_stream                                        2339    2395     +56
expand_pseudo_dquoted                                104     118     +14
parse_stream_dquoted                                 296     300      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 74/0)               Total: 74 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 11:27:32 +02:00
Denys Vlasenko
c49d2d9793 hush: fix globbing+backslashes in unquoted $var expansion
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 10:26:37 +02:00
Denys Vlasenko
36f774a0cd hush: add support for ${var/pattern/repl}, conditional on bash compat
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>
2010-09-05 14:47:58 +02:00
Denys Vlasenko
e298ce69ba hush: fix handling of backslashes in variable assignment
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-04 19:52:44 +02:00
Denys Vlasenko
ba2dcccd79 *: trailing empty lines removed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:49:12 +02:00
Alexander Shishkin
ccb9771861 ash: fix $! value when traps are set
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-25 13:07:39 +02:00
Denys Vlasenko
29082231d0 hush: fix multimple dependent variable expansion cases
function                                             old     new   delta
get_local_var_value                                  100     171     +71
expand_assignments                                    46      76     +30
reset_traps_to_defaults                              229     238      +9
maybe_set_to_sigexit                                  47      50      +3
init_sigmasks                                        211     214      +3
builtin_trap                                         462     465      +3
expand_vars_to_list                                 2412    2408      -4
run_pipe                                            1568    1533     -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/2 up/down: 119/-39)            Total: 80 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-16 13:52:32 +02:00
Denys Vlasenko
e85248afa2 hush: fix segfault in ${?:N:M}
function                                             old     new   delta
expand_vars_to_list                                 2374    2409     +35
builtin_umask                                        132     133      +1
builtin_exit                                          47      48      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 37/0)               Total: 37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 06:20:26 +02:00
Denys Vlasenko
8a33679694 hush: fix "hush -c 'echo $#'" showing -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 06:05:02 +02:00
Denys Vlasenko
1e811b1231 hush: support ${var:EXPR:EXPR}!
function                                             old     new   delta
handle_dollar                                        574     681    +107
expand_and_evaluate_arith                              -      77     +77
expand_vars_to_list                                 2302    2374     +72
add_till_closing_bracket                             359     368      +9
builtin_exit                                          48      47      -1
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 265/-1)            Total: 264 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 03:12:29 +02:00
Denys Vlasenko
a6ad397ea9 hush: fix more obscure ${var%...} cases
function                                             old     new   delta
add_till_closing_paren                               313     359     +46
builtin_exit                                          48      47      -1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 00:26:06 +02:00
Denys Vlasenko
7436950a75 hush: fix a=abc; c=c; echo ${a%${c}}
function                                             old     new   delta
expand_vars_to_list                                 2229    2302     +73
add_till_closing_paren                               286     313     +27
handle_dollar                                        623     574     -49
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 100/-49)            Total: 51 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 19:52:01 +02:00
Denys Vlasenko
3f78cec347 hush: handle expansions in ${var?expanded_word} constructs
function                                             old     new   delta
expand_vars_to_list                                 2209    2229     +20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 17:54:46 +02:00
Denys Vlasenko
73e013fca7 hush: handle ${var:NUM:} too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 15:24:12 +02:00
Denys Vlasenko
4d8e5fdc1d hush: optional support for ${var:N:M} bashism
function                                             old     new   delta
expand_vars_to_list                                 1999    2183    +184
handle_dollar                                        682     623     -59

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-21 01:15:42 +02:00
Denys Vlasenko
cddbb610cb hush: fix var=exit 2 not setting $? to 2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-20 14:27:09 +02:00
Denys Vlasenko
3227d3f982 hush: fix hush-bugs/parse_err.tests
function                                             old     new   delta
parse_stream                                        2325    2339     +14
builtin_umask                                        121     123      +2
builtin_type                                         116     114      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 09:49:47 +02:00
Denys Vlasenko
0f01b00d74 add two more tests which currently fail
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 04:57:55 +02:00
Denys Vlasenko
3581c62515 whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-25 13:39:24 +01:00
Denys Vlasenko
03dad22f8a hush: use ash's read builtin
function                                             old     new   delta
shell_builtin_read                                     -    1000   +1000
set_local_var_from_halves                              -      24     +24
setvar2                                                -       7      +7
...
popstring                                            140     134      -6
ash_main                                            1375    1368      -7
setvar                                               184     174     -10
arith_set_local_var                                   36       -     -36
builtin_read                                        1096     185    -911
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 5/23 up/down: 1038/-1007)        Total: 31 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 23:29:57 +01:00
Denys Vlasenko
e89a241b9e hush: fix subshell.tests failure on NOMMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 15:19:31 +01:00
Denys Vlasenko
b70cef71eb hush: two NOMMU fixes for bugs 877 and 883
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 13:45:45 +01:00
Denys Vlasenko
385cc59117 hush: plug a memory leak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 06:47:39 +01:00
Denys Vlasenko
a4899efd03 hush: fix exitcodes of killed processes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 11:37:09 +01:00
Denys Vlasenko
f3e2818895 hush: improve HUSH_BRACE_EXP code (still disabled). ~0 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-17 03:35:31 +01:00
Denys Vlasenko
d8389ad760 hush: fix handling of words with braces. +65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-16 03:18:46 +01:00