Age | Commit message (Collapse) | Author |
|
Upstream commit 1 for ash:
[ERROR] Allow the originator of EXERROR to set the exit status
Some errors have exit status values specified by POSIX and it is
therefore desirable to be able to set the exit status at the EXERROR
source rather than in main.c.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Upstream commit 2 for ash:
[INPUT] Use exit status 127 when the script to run does not exist
This commit makes dash exit with return code 127 instead of 2 if
started as non-interactive shell with a non-existent command_file
specified as argument (or a directory), as documented in
http://www.opengroup.org/onlinepubs/009695399/utilities/sh.html#tag_04_128_14
The wrong exit code was reported by Clint Adams and Jari Aalto through
http://bugs.debian.org/548743
http://bugs.debian.org/548687
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
NB: in fact, http://bugs.debian.org/548687 was not fixed by this:
"sh /dir/" thinks that EISDIR error on read is EOF, and exits 0.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The commit 'ash: eval: Return status in eval functions' changed how
exit status is handled in eval functions. The case of nofork
applets was missed, resulting in the incorrect status potentially
being returned for nofork applets when FEATURE_SH_NOFORK is enabled.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Previous commit probably introduced a bug:
non-matching size calculation in size counting and
actual copying caused by SHELL_ALIGN being applied differently!
This won't bite if string sizes are also SHELL_ALIGNed.
Thus fixing.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
calcsize 126 147 +21
funcstring_end - 4 +4
sizenodelist 28 24 -4
funcstringsize 4 - -4
funcstring 4 - -4
funcblocksize 4 - -4
nodeckstrdup 48 39 -9
evaltree 828 788 -40
------------------------------------------------------------------------------
(add/remove: 1/3 grow/shrink: 1/4 up/down: 25/-105) Total: -40 bytes
text data bss dec hex filename
943376 916 14292 958584 ea078 busybox_old
943344 916 14284 958544 ea050 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Planned to sync exitshell up to dash, turned out ours is better :)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Allocation addresses of malloc() are jittery,
thought I had a mem leak in hush, but it was malloc variability.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The construct such as this:
t=1
export t
t=new_value1
had a small probability of momentarily using free()d value.
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>
|
|
Upstream commit:
Date: Mon, 29 Sep 2014 22:53:53 +0800
[PARSER] Add nlprompt/nlnoprompt helpers
This patch adds the nlprompt/nlnoprompt helpers to isolate code
dealing with newlines and prompting.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
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>
|
|
It's pointless.
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>
|
|
dash has tokendlist[] array to decide which tokens end lists.
We store it as first byte of each tokname_array[i].
Switch to bit array, name it like dash (tokendlist), drop special
1st byte of tokname_array[i]. This brings us closer to dash, and
shrinks the binary, because many more string aliasing opportunities
are now open:
function old new delta
pstrcmp1 - 16 +16
readtoken1 2852 2858 +6
list 326 327 +1
pstrcmp 16 15 -1
tokname 45 42 -3
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/2 up/down: 23/-4) Total: 19 bytes
text data bss dec hex filename
943556 916 14292 958764 ea12c busybox_old
943463 916 14292 958671 ea0cf busybox_unstripped
^^^^^^^ note this!
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>
|
|
Upstream commit:
Date: Thu, 1 Jan 2015 07:53:10 +1100
expand: Fixed "$@" expansion when EXP_FULL is false
The commit 3c06acdac0b1ba0e0acdda513a57ee6e31385dce ([EXPAND]
Split unquoted $@/$* correctly when IFS is set but empty) broke
the case where $@ is in quotes and EXP_FULL is false.
In that case we should still emit IFS as field splitting is not
performed.
Reported-by: Juergen Daubert <jue@jue.li>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Both shells pass this test.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Currently it fails
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Wed, 8 Oct 2014 20:09:56 +0800
[EXPAND] Optimise nulonly away and just use quoted as before
This patch makes a small optimisation by using the same value for
quoted between evalvar and varvalue by eliminating nulonly and
passing along quoted instead.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream patch:
Date: Wed, 8 Oct 2014 15:42:08 +0800
[EXPAND] Do not split quoted VSLENGTH and VSTRIM
Currently VSLENGTH and VSTRIM* are field-split even within quotes.
This is obviously wrong. This patch fixes that.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Wed, 8 Oct 2014 15:24:23 +0800
[EXPAND] Split unquoted $@/$* correctly when IFS is set but empty
Currently we do not field-split $@/$* when it isn't quoted and IFS
is set but empty. This is obviously wrong. This patch fixes this.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit 1:
Date: Mon, 6 Oct 2014 20:45:04 +0800
[EVAL] Move common skipcount logic into skiploop
The functions evalloop and evalfor share the logic on checking
and updating skipcount. This patch moves that into the helper
function skiploop.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Upstream commit 2:
Date: Mon, 6 Oct 2014 21:22:43 +0800
[BUILTIN] Allow return in loop conditional to set exit status
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=332954
When return is used in a loop conditional the exit status will
be lost because we always set the exit status at the end of the
loop to that of the last command executed in the body.
This is counterintuitive and contrary to what most other shells do.
This patch fixes this by always preserving the exit status of
return when it is used in a loop conditional.
The patch was originally written by Gerrit Pape <pape@smarden.org>.
Reported-by: Stephane Chazelas <stephane_chazelas@yahoo.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
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>
|
|
Partially backported this commit:
Date: Thu, 2 Oct 2014 21:07:55 +0800
[ERROR] Set exitstatus in onint
Currently the exit status when we receive SIGINT is set in evalcommand
which means that it doesn't always get set. For example, if you press
CTRL-C at the prompt of an interactive dash, the exit status is not
set to 130 as it is in many other Bourne shells.
This patch fixes this by moving the setting of the exit status into
onint which also simplifies evalcommand.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
The part after "if (evalbltin(cmdentry.u.cmd, argc, argv, flags))"
causes testsuite failures in signal handling, so left unchanged.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Tue Aug 11 20:56:53 2009 +1000
[EVAL] Revert SKIPEVAL into EXEXIT
Now that eval handles EV_TESTED correctly, we can remove the
SKIPEVAL hack and simply use EXEXIT for set -e.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Tue Aug 11 20:48:15 2009 +1000
[EVAL] Pass EV_TESTED into evalcmd
This patch fixes the case where the eval command is used with
set -e and as part of a construct that should not cause the
shell to abort, e.g., as part of the condition of an if statement.
This is achieved by propagating the EV_TESTED flag into the
evalstring function through evalcmd. As this alters the prototype
of evalcmd it is now invoked explicitly by evalbltin. The built-in
infrastructure has been changed to accomodate this special case.
In order to ensure that the EXIT trap is properly executed this
patch clears evalskip in exitshell. This wasn't needed before
because of the broken way evalstring worked where it always clears
evalskip when called by minusc.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Although, I failed to create a reproducer for this.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|