Commit Graph

2378 Commits

Author SHA1 Message Date
Denys Vlasenko
63139b531f hush: if login shell, also source ~/.profile
function                                             old     new   delta
hush_main                                           1101    1151     +50

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-13 22:00:56 +01:00
Denys Vlasenko
49142d48bd hush: NOMMU fix for hush-psubst/tick6.tests
function                                             old     new   delta
hush_main                                           1759    1766      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-13 18:44:07 +01:00
Denys Vlasenko
9cabd17e55 hush: fix -c SCRIPT handling
function                                             old     new   delta
hush_main                                           1763    1759      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-13 18:24:11 +01:00
Denys Vlasenko
31df5a3eee ash: reset SIGHUP earlier: allows HUP traps in .profile, closes 13371
function                                             old     new   delta
ash_main                                            1188    1203     +15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-13 16:36:28 +01:00
Denys Vlasenko
965b795b87 decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly
text	   data	    bss	    dec	    hex	filename
1021988	    559	   5052	1027599	  fae0f	busybox_old
1021236	    559	   5052	1026847	  fab1f	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-30 13:03:03 +01:00
Cristian Ionescu-Idbohrn
ddfdf68ca1 fix warning: label 'out1' defined but not used
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-19 13:14:59 +01:00
Denys Vlasenko
4ac35a30db ash: make interactive ^C break out of PS2 mode
Based on patch by Joachim Nilsson <troglobit@gmail.com>

function                                             old     new   delta
pgetc                                                570     547     -23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-16 13:09:37 +01:00
Denys Vlasenko
dc9c10a7b2 hush: make interactive ^C break out of PS2 mode
function                                             old     new   delta
syntax_error_unterm_str                                -      26     +26
parse_stream                                        2238    2251     +13
fgetc_interactive                                    243     249      +6
parse_dollar                                         824     817      -7
syntax_error_unterm_ch                                29      21      -8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/2 up/down: 45/-15)             Total: 30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-16 13:00:44 +01:00
Denys Vlasenko
64981b4c8e hush: document bugs in [[ =~ ]] comparison
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-01 18:47:24 +01:00
Denys Vlasenko
a7c065354f shell: update comments on the status of [[ ]] compat
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-31 04:32:34 +01:00
Denys Vlasenko
b259e97d47 hush: add tests for unquoted < > in [[ ]]
They pass.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-31 03:51:37 +01:00
Denys Vlasenko
d2241f5902 shell: better support of [[ ]] bashism
Still rather rudimentary for ash

function                                             old     new   delta
binop                                                433     589    +156
check_operator                                        65     101     +36
done_word                                            736     769     +33
test_main                                            405     418     +13
parse_stream                                        2227    2238     +11
ops_texts                                            124     133      +9
ops_table                                             80      86      +6
run_pipe                                            1557    1562      +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/0 up/down: 269/0)             Total: 269 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-31 03:34:07 +01:00
Denys Vlasenko
e16f7eb596 hush: output bash-compat killing signal names
This significantly syncronises ash-signals and hush-signals tests.

function                                             old     new   delta
process_wait_result                                  449     450      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-24 04:26:43 +02:00
Denys Vlasenko
b65d6cb00f hush: do not print killing signal name in cmd_whihc_dies_on_signal
function                                             old     new   delta
process_wait_result                                  438     449     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-24 03:33:32 +02:00
Denys Vlasenko
2496616b0a avoid using strok - eliminates use of hidden global variable
function                                             old     new   delta
udhcp_str2optset                                     616     650     +34
setpriv_main                                         950     975     +25
switch_root_main                                     688     706     +18
parse                                                958     970     +12
getopt_main                                          622     628      +6
parse_resolvconf                                     302     306      +4
mpstat_main                                         1139    1142      +3
static.p                                               4       -      -4
cdcmd                                                717     702     -15
strtok                                               148       -    -148
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 7/1 up/down: 102/-167)          Total: -65 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-06 02:36:47 +02:00
Denys Vlasenko
841878e7ee shell: remove FAST_FUNC from a static function
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-01 00:57:05 +02:00
Denys Vlasenko
d4dd48f294 shell: add testsuite for "wait $pid" waiting for other tasks
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-09-29 22:36:36 +02:00
Denys Vlasenko
91e11eba6e ash: jobs: Fix waitcmd busy loop
Upstream commit:

    Date: Tue, 2 Jun 2020 23:46:48 +1000
    jobs: Fix waitcmd busy loop

    We need to clear gotsigchld in waitproc because it is used as
    a loop conditional for the waitcmd case.  Without it waitcmd
    may busy loop after a SIGCHLD.

    This patch also changes gotsigchld into a volatile sig_atomic_t
    to prevent compilers from optimising its accesses away.

    Fixes: 6c691b3e5099 ("jobs: Only clear gotsigchld when waiting...")
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

This change also incorporates other changes to bring us closer to upstream.

function                                             old     new   delta
dowait                                               553     636     +83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-09-29 20:35:55 +02:00
Denys Vlasenko
8d5f465a20 ash: jobs: Fix infinite loop in waitproc
Upstream commit:

    Date: Fri, 10 Apr 2020 21:03:09 +1000
    jobs: Fix infinite loop in waitproc

    After we changed the resetting of gotsigchld so that it is only
    done if jp is NULL, we can now get an infinite loop in waitproc
    if gotsigchld is set but there is no outstanding child because
    everything had been waited for previously without gotsigchld being
    zeroed.

    This patch fixes it by always zeroing gotsigchld as we did before.
    The bug that the previous patch was trying to fix is now resolved
    by switching the blocking mode to DOWAIT_NORMAL after the specified
    job has been completed so that we really do wait for all outstanding
    dead children.

    Reported-by: Harald van Dijk <harald@gigawatt.nl>
    Fixes: 6c691b3e5099 ("jobs: Only clear gotsigchld when waiting...")
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

function                                             old     new   delta
dowait                                               553     631     +78

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-09-29 20:21:27 +02:00
Denys Vlasenko
777a6357c0 ash: remove a tentative TODO, it's a wrong idea
Upstream tried it, and then reverted by:

    From: Herbert Xu <herbert@gondor.apana.org.au>
    Date: Tue, 26 May 2020 23:19:05 +1000
    parser: Fix double-backslash nl in old-style command sub

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-09-29 20:21:27 +02:00
Christian Eggers
39925026f6 shell: Fix "read -d ''" behavior
With bash's read builtin it is possible to read from a file (e.g.
device-tree) until the first '\0' character:

IFS= read -r -d '' VARIABLE < file

In busybox ash the -d extension is also implemented, but checking the
read character for '\0' has to be performed after comparing with the
delimiter.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-07-31 18:42:30 +02:00
Denys Vlasenko
67e1529b92 nologin: make it possible to build it as single applet
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24 15:05:22 +02:00
Denys Vlasenko
d5314e7129 suppress a few compile warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24 09:31:30 +02:00
Ron Yorston
9f3b410006 ash,hush: drop pointer check before calls to show_history
show_history() checks that its argument in non-null so there's
no need to repeat the test at call sites.

function                                             old     new   delta
historycmd                                            25      17      -8
builtin_history                                       29      21      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-16)             Total: -16 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-30 17:30:02 +02:00
Ron Yorston
da7a6dbfa5 ash: fix build failure when command built-in is disabled
Since commit 7eb8eecbb (ash: eval: Add assignment built-in support
again) building BusyBox with the 'command' built-in disabled fails.

parse_command_args() only needs to be called when the 'command'
built-in is run.  Which it won't be if it's disabled.

v2: Avoiding infinite loops is good, too.  Thanks, Harald van Dijk.

Reported-by: Deweloper <deweloper@wp.pl>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-30 16:42:58 +02:00
Denys Vlasenko
9aa751b08a shells: fix exitcode_trapN tests to avoid races
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-26 09:05:52 +01:00
Denys Vlasenko
1555895b4a ash: expand: Fix multiple issues with EXP_DISCARD in evalvar
Upstream commit:

    Date: Wed, 12 Sep 2018 14:27:16 +0800
    expand: Fix multiple issues with EXP_DISCARD in evalvar

    The commit 3cd538634f71538370f5af239f342aec48b7470b broke parameter
    expansion in multiple ways because the EXP_DISCARD flag wasn't set
    or tested for various cases:

            $ src/dash -c 'var=; echo ${var:+nonempty}'
            nonempty
            $ src/dash -u -c 'unset foo bar; echo ${foo+${bar}}'
            dash: 1: bar: parameter not set
            $ src/dash -c 'foo=bar; echo ${foo=BUG}; echo $foo'
            barBUG
            bar
            $

    This patch fixes them by introducing a new discard variable that
    tracks whether the extra word should be discarded or not when it
    is parsed.

    Reported-by: Martijn Dekker <martijn@inlv.org>
    Fixes: 3cd538634f71 ("expand: Do not reprocess data when...")
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Reported-by: Martijn Dekker <martijn@inlv.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-24 19:20:51 +01:00
Denys Vlasenko
823318822c ash: expand: Do not reprocess data when expanding words
Upstream patch:

    Date: Wed, 30 May 2018 02:06:03 +0800
    expand: Do not reprocess data when expanding words

    Currently various paths will reprocess data when performing word
    expansion.  For example, expari will skip backwards looking for
    the start of the arithmetic expansion, while evalvar will skip
    unexpanded words manually.

    This is cumbersome and error-prone.  This patch fixes this by
    making word expansions proceed in a linear fashion.  This means
    changing argstr and the various expansion functions such as expari
    and subevalvar to return the next character to be expanded.

    This is inspired by similar code from FreeBSD.  However, we take
    things one step further and completely remove the manual word
    skipping in evalvar.  This is accomplished by introducing a new
    EXP_DISCARD flag that tells argstr to only parse and not produce
    any actual expansions.

    Incidentally, argstr will now always NUL-terminate the expansion
    unless the EXP_WORD flag is set.  This is because all but one
    caller of argstr wants the result to be NUL-termianted.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Also includes two one-line follow-up fixes:

    expand: Eat closing brace for length parameter
            if (subtype == VSLENGTH) {
    +               p++;
                    if (flag & EXP_DISCARD)
    expand: Fix double-decrement in argstr
    -               newloc = expdest - (char *)stackblock() - end;
    +               newloc = q - (char *)stackblock() - end;

and changes in code for bash substring extensions.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-24 19:20:51 +01:00
Ron Yorston
6cda0b04a3 ash: move TRACE statement in evalcommand()
Following recent work on evalcommand() a TRACE statement to report
the status of a forked command was left in the wrong place.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-24 12:52:41 +01:00
Denys Vlasenko
7f19848552 ash: rename some function parameters to match dash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-24 12:48:33 +01:00
Denys Vlasenko
538ee4102b ash: rename stack_nputstr() back to stnputs() to match dash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-24 12:47:19 +01:00
Denys Vlasenko
c2058ec98c ash: Expand here-documents in the current shell environment
Upstream commit:

    Date: Sun, 11 Nov 2007 15:27:00 +0800
    Expand here-documents in the current shell environment

    Previously we always expanded here-documents in a subshell.  This is
    contrary to the POSIX specification and how other shells behave.  What's
    more this slows down many expansions due to the extra fork (however, it
    must be said that it is possible for it speed up certain expansions by
    running it simultaneously with the command on two CPUs).

    This patch move the expansion into the current shell environment.

    Test case:

            unset a
            cat <<- EOF > /dev/null
                    ${a=NOT}
            EOF
            echo ${a}BAD

    Old result:

            BAD

    New result:

            NOTBAD

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-22 20:29:36 +01:00
Denys Vlasenko
c08993f40c ash: parser: Do not push token back before parseheredoc
Upstream commit:

    Date: Mon, 19 Nov 2018 18:43:58 +0800
    parser: Do not push token back before parseheredoc

    When we read the first token in list() we use peektoken instead
    of readtoken as the following code needs to use the same token
    again.  However, this is wrong when we're in a here-document as
    it will clobber the saved token without resetting the tokpushback
    flag.

    This patch fixes it by doing the tokpushback after parseheredoc
    and setting lasttoken again if parseheredoc was called.

    Reported-by: Ron Yorston <rmy@frippery.org>
    Fixes: 7c245aa8ed33 ("[PARSER] Simplify EOF/newline handling in...")
    Fixes: ee5cbe9fd6bc ("[SHELL] Optimize dash -c "command" to avoid a fork")
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Tested-by: Simon Ser <contact@emersion.fr>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-22 17:26:23 +01:00
Denys Vlasenko
9a1a659707 ash: parser: Fix old-style command substitution here-document crash
Upstream commit:

    Date: Fri, 29 Mar 2019 13:49:59 +0800
    parser: Fix old-style command substitution here-document crash

    ... This is caused by the recent change to
    save/restore here-docment list around command substitutions.  In
    doing so we must finish existing here-documents prior to restoring
    the old here-document list.  This is done for new-style command
    substitutions but not for old-style.

    This patch fixes it by doing it for both.

    Fixes: 51e2d88d6e51 ("parser: Save/restore here-documents in...")
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-22 16:39:27 +01:00
Denys Vlasenko
e4a0612efd hush: fix negative_arith.tests: glob-protect dash in "$((arith))"
function                                             old     new   delta
expand_vars_to_list                                 1026    1082     +56
parse_dollar                                         810     811      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 57/0)               Total: 57 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-21 17:21:34 +01:00
Denys Vlasenko
45dd87aac0 ash: expand: Ensure result is escaped in cvtnum
Upstream commit:

    Date: Fri, 1 Jun 2018 18:25:29 +0800
    expand: Ensure result is escaped in cvtnum

    The minus sign generated from arithmetic expansion is currently
    unquoted which causes anomalies when the result is used in where
    the quoting matters.

    This patch fixes it by explicitly calling memtodest on the result
    in cvtnum.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-21 16:30:44 +01:00
Denys Vlasenko
da2e46dff6 ash: memalloc: Avoid looping in growstackto
Upstream commit:

    Date: Thu, 31 May 2018 01:51:48 +0800
    memalloc: Avoid looping in growstackto

    Currently growstackto will repeatedly call growstackblock until
    the requisite size is obtained.  This is wasteful.  This patch
    changes growstackblock to take a minimum size instead.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-21 15:25:37 +01:00
Denys Vlasenko
3ced804e31 hush: make "exit" in trap use pre-trap exitcode - fix for nested trap
function                                             old     new   delta
check_and_run_traps                                  276     278      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-21 02:55:53 +01:00
Denys Vlasenko
cc9ecd9af1 hush: make "exit" in trap use pre-trap exitcode
function                                             old     new   delta
check_and_run_traps                                  259     276     +17
builtin_exit                                          42      53     +11
hush_main                                           1086    1096     +10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 38/0)               Total: 38 bytes

Fixes exitcode_trap2.tests.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-21 02:18:06 +01:00
Denys Vlasenko
f977e004ce ash: eval: Only restore exit status on exit/return
Upstream commit:

    Date: Fri, 14 Dec 2018 13:52:02 +0800
    eval: Only restore exit status on exit/return

    We unconditionally restore the saved status in exitreset, which
    is incorrect as we only want to do it for exitcmd and returncmd.
    This patch fixes the problem by introducing EXEND.

    Reported-by: Martijn Dekker <martijn@inlv.org>
    Fixes: da30b4b78769 ("[BUILTIN] Exit without arguments in a trap...")
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-20 16:54:29 +01:00
Denys Vlasenko
cd24a50633 ash: Return without arguments in a trap should use status outside traps
Fixes exitcode_trap4.tests.
Upstream commit:

    Date: Mon, 6 Oct 2014 21:51:26 +0800
    Return without arguments in a trap should use status outside traps

    POSIX now requires that return without arguments in a trap should
    return the last command status prior to executing traps.  This
    patch implements this behaviour.

    Incidentally this also changes the behaviour of return without
    arguments in a loop conditional to use the last exit status in
    the body as opposed to the last command in the conditional when
    there is one.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-20 16:47:01 +01:00
Denys Vlasenko
bb095f4838 hush: implement "return NUM in trap sets $? after trap"
function                                             old     new   delta
builtin_return                                        47      67     +20
check_and_run_traps                                  243     259     +16
run_pipe                                            1583    1597     +14
hush_main                                           1076    1086     +10
run_list                                            1054    1055      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 61/0)               Total: 61 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-20 16:37:59 +01:00
Ron Yorston
d5bfe26c45 ash: return exit status of nofork applets (again)
Since commit d81af7216 (ash: eval: Reap zombies after built-in commands
and functions) if the shell is compiled with SH_STANDALONE and SH_NOFORK
enabled nofork applets potentially return the incorrect status.

The status value returned by evalcommand() in this case is obtained from
exitstatus in a call to waitforjob(NULL).  This overwrites the status
set for nonfork applets.

If this commit seems familiar it's essentially a reversion of commit
5ccb0e92fa (ash: return exit status of nofork applets).  What was correct
in 2016 is wrong in 2020 and vice versa.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-20 10:39:46 +01:00
Denys Vlasenko
ecc85832f8 ash: expand: Merge syntax/quotes in memtodest with flags
Upstream commit:

    Date: Mon, 28 May 2018 00:17:39 +0800
    expand: Merge syntax/quotes in memtodest with flags

    The function arguments syntax and quotes are both derived from
    the expansion flags.  As syntax is only used by memtodest we do
    not need to maintain it outside of the function at all.

    The only place that uses something other than BASESYNTAX or DQSYNTAX
    is exptilde.  However in that case DQSYNTAX has exactly the same
    effect as SQSYNTAX.

    This patch merges these two arguments into a single flags.  The
    macro QUOTES_KEEPNUL has been renamed to EXP_KEEPNUL in order
    to keep the namespace separate.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-20 10:37:30 +01:00
Denys Vlasenko
e2dd2afc8e ash: eval: Always set localvar_stop
Upstream commit:

    Date: Thu, 31 May 2018 01:15:34 +0800
    eval: Always set localvar_stop

    The variable localvar_stop is set iff vlocal is true.  gcc doesn't
    get this so we get a spurious warning.

    This patch fixes this by always calling pushlocalvars with vlocal
    and making it only actually do the push if vlocal is non-zero.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-20 10:37:30 +01:00
Denys Vlasenko
3e729102a8 ash: eval: Replace with listsetvar with mklocal/setvareq
Upstream commit:

    Date: Sat, 19 May 2018 02:39:55 +0800
    eval: Replace with listsetvar with mklocal/setvareq

    This patch replaces listsetvar with mklocal/setvareq.  As we now
    determine special built-in status prior to variable assignment, we
    no longer have to do a second pass listsetvar.  Instead we will
    call setvareq directly instead of mklocal when necessary.

    In order to do this mklocal can now take a flag in order to mark
    a variable for export.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-20 09:36:51 +01:00
Denys Vlasenko
54bef2a8ef ash: eval: Fail immediately with redirections errors for simple command
Upstream commit:

    Date: Sat, 19 May 2018 02:39:54 +0800
    eval: Fail immediately with redirections errors for simple command

    Previously, dash would continue to perform variable expansions
    even if a redirection error occured.  This patch changes it so
    that it fails immediately.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-20 09:36:51 +01:00
Denys Vlasenko
7eb8eecbbc ash: eval: Add assignment built-in support again
Upstream commit:

    Date: Sat, 19 May 2018 02:39:52 +0800
    eval: Add assignment built-in support again

    This patch adds assignment built-in support that used to exist
    in dash prior to 0.3.8-15.  This is because it will soon be part
    of POSIX, and the semantics are now much better defined.

    Recognition is done at execution time, so even "command -- export"
    or "var=export; command $var" should work.

    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-20 09:36:51 +01:00
Denys Vlasenko
c91950f315 ash,hush: testcase for "exit" without arguments in a trap
hush fails this one

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-19 12:10:41 +01:00
Denys Vlasenko
23bc562a05 ash,hush: add comment about masked SIGCHLD, handle SIG_IGNed SIGHUP as in bash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-18 16:46:01 +01:00