| Commit message (Collapse) | Author | Files | Lines |
|
function old new delta
write2pipe - 133 +133
.rodata 105992 106009 +17
readtoken1 3101 3111 +10
cmdtxt 631 641 +10
nodesize 27 28 +1
redirect 961 916 -45
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/1 up/down: 171/-45) Total: 126 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 3063 3075 +12
done_word 777 784 +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 19/0) Total: 19 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
done_word 766 777 +11
static.reserved_match 16 12 -4
reserved_list 240 168 -72
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 11/-76) Total: -65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
For some reason, it was only happening in interactive use
function old new delta
initialize_context 39 54 +15
parse_stream 3077 3063 -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 15/-14) Total: 1 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
done_word 790 766 -24
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
die_if_script 28 34 +6
hush_main 1146 1150 +4
run_list 1031 1028 -3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 10/-3) Total: 7 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
reserved_list - 240 +240
parse_stream 2923 3077 +154
done_word 771 790 +19
.rodata 105975 105992 +17
static.reserved_match 12 16 +4
static.reserved_list 168 - -168
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 4/0 up/down: 434/-168) Total: 266 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2940 2923 -17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2857 2940 +83
i_peek 55 69 +14
i_free_alias_buffer 33 37 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 101/0) Total: 101 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
print_pfx_escaped_nl - 83 +83
builtin_alias 216 218 +2
.rodata 105985 105975 -10
parse_stream 2873 2857 -16
builtin_set 301 259 -42
builtin_readonly 107 59 -48
builtin_export 145 93 -52
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/5 up/down: 85/-168) Total: -83 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2540 2873 +333
i_getch 85 410 +325
builtin_alias - 216 +216
builtin_unalias - 185 +185
.rodata 105806 105985 +179
word_matches_alias - 82 +82
find_alias_slot - 77 +77
end_of_alias_name - 69 +69
builtin_type 128 179 +51
i_free_alias_buffer - 33 +33
enable_all_aliases - 29 +29
bltins1 396 420 +24
o_reset_to_empty_unquoted - 21 +21
run_pipe 1554 1566 +12
i_peek 57 55 -2
parse_redirect 351 346 -5
redirect_opt_num 63 53 -10
encode_then_append_var_plusminus 552 532 -20
done_word 796 771 -25
i_getch_interactive 308 - -308
------------------------------------------------------------------------------
(add/remove: 8/1 grow/shrink: 6/5 up/down: 1636/-370) Total: 1266 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
set_local_var 416 409 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
setup_heredoc 299 351 +52
parse_stream 2514 2540 +26
parse_redirect 335 351 +16
redir_table 40 48 +8
static.setup_redirects 394 400 +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 108/0) Total: 108 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2513 2514 +1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Was trying to add code to reject more invalid "case" syntaxes, but it's not that easy
function old new delta
done_word 795 796 +1
parse_stream 2529 2513 -16
.rodata 105825 105806 -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 1/-35) Total: -34 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
While at it, remove now-unused WORD_IS_KEYWORD
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
parse_stream 2566 2524 -42
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2572 2566 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2565 2572 +7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Final link with: <none>
function old new delta
i_getch_interactive - 308 +308
i_getch 102 85 -17
fgetc_interactive 309 - -309
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 308/-326) Total: -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
0-9,A-Z,a-z are never special and just go into the current word.
function old new delta
parse_stream 2476 2565 +89
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
No logic changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2446 2476 +30
done_word 797 800 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 33/0) Total: 33 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Also, deindent "ch == EOF" code branch in parse_stream()
function old new delta
done_word 799 797 -2
parse_stream 2453 2446 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-9) Total: -9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
done_word 776 799 +23
parse_stream 2456 2453 -3
done_pipe 252 242 -10
.rodata 105837 105825 -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 23/-25) Total: -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This is not accepted by bash, we may also disallow this,
but for now, at least do not crash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_stream 2292 2456 +164
done_pipe 231 252 +21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 185/0) Total: 185 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit
Date: Wed, 14 Dec 2022 02:06:05 +0100
parser: Invalid redirections are run-time, not syntax errors
This fixes a long-standing bug where
echo 'echo >&a' | sh
errors out with
sh: 2: Syntax error: Bad fd number
despite the error being on line 1
This patch makes the error
sh: 1: Bad fd number: a
as expected
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
o_addqblock - 131 +131
append_str_maybe_ifs_split 53 100 +47
expand_one_var 1872 1897 +25
encode_then_expand_vararg 380 399 +19
sig_unblock 41 43 +2
sig_block 41 40 -1
sigprocmask_allsigs 33 31 -2
expand_vars_to_list 1080 1077 -3
wait_for_child_or_signal 202 193 -9
o_addQstr 175 42 -133
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/5 up/down: 224/-148) Total: 76 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
sig_unblock 41 43 +2
sig_block 41 40 -1
sigprocmask_allsigs 33 31 -2
wait_for_child_or_signal 202 193 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-12) Total: -10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
text data bss dec hex filename
1067871 559 5184 1073614 1061ce busybox_old
1068067 555 5088 1073710 10622e busybox_unstripped
^^^^^^^^^^^
function old new delta
pgetc 580 623 +43
parse_command 1633 1651 +18
ash_main 1226 1239 +13
popstring 115 126 +11
redirect 951 961 +10
popfile 105 115 +10
expandstr 252 262 +10
evalbltin 306 314 +8
pushstring 155 162 +7
pushfile 31 38 +7
freestrings 90 97 +7
setinputstring 68 74 +6
readtoken1 3095 3101 +6
pungetc 9 15 +6
nlprompt 39 45 +6
nlnoprompt 33 39 +6
unwindfiles 20 25 +5
dotcmd 309 314 +5
setinputfile 190 194 +4
init 429 432 +3
forkchild 617 620 +3
evalcommand 1616 1617 +1
ash_vmsg 141 142 +1
g_parsefile 4 - -4
commandname 4 - -4
basepf 84 - -84
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 23/0 up/down: 196/-92) Total: 104 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Thu, 28 May 2020 21:31:45 +1000
redir: Retry open64 on EINTR
It is possible for open64 to block on named pipes, and therefore
it can be interrupted by signals and return EINTR. We should only
let it fail with EINTR if real signals are pending (i.e., it should
not fail on SIGCHLD if SIGCHLD has not been trapped).
This patch adds a new helper sh_open to retry the open64 call if
necessary. It also calls sh_error when appropriate.
Fixes: 3800d4934391 ("[JOBS] Fix dowait signal race")
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Sun, 3 Mar 2019 21:57:50 +0800
eval: Reset handler when entering a subshell
As it is a subshell can execute code that is only meant for the
parent shell when it executes a longjmp that is caught by something
like evalcommand. This patch fixes it by resetting the handler
when entering a subshell.
function old new delta
evalsubshell 169 183 +14
evalpipe 342 356 +14
argstr 1406 1416 +10
ash_main 1236 1226 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 65/-10) Total: 28 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Wed, 6 Jan 2021 15:45:12 +1100
jobs: Block signals during tcsetpgrp
Harald van Dijk <harald@gigawatt.nl> wrote:
> On 19/12/2020 22:21, Steffen Nurpmeso wrote:
>> Steffen Nurpmeso wrote in
>> <20201219172838.1B-WB%steffen@sdaoden.eu>:
>> |Long story short, after falsely accusing BSD make of not working
>>
>> After dinner i shortened it a bit more, and attach it again, ok?
>> It is terrible, but now less redundant than before.
>> Sorry for being so terse, that problem crosses my head for about
>> a week, and i was totally mislead and if you bang your head
>> against the wall so many hours bugs or misbehaviours in a handful
>> of other programs is not the expected outcome.
>
> I think a minimal test case is simply
>
> all:
> $(SHELL) -c 'trap "echo TTOU" TTOU; set -m; echo all good'
>
> unless I accidentally oversimplified.
>
> The SIGTTOU is caused by setjobctl's xtcsetpgrp(fd, pgrp) call to make
> its newly started process group the foreground process group when job
> control is enabled, where xtcsetpgrp is a wrapper for tcsetpgrp. (That's
> in dash, the other variants may have some small differences.) tcsetpgrp
> has this little bit in its specification:
>
> Attempts to use tcsetpgrp() from a process which is a member of
> a background process group on a fildes associated with its con‐
> trolling terminal shall cause the process group to be sent a
> SIGTTOU signal. If the calling thread is blocking SIGTTOU sig‐
> nals or the process is ignoring SIGTTOU signals, the process
> shall be allowed to perform the operation, and no signal is
> sent.
>
> Ordinarily, when job control is enabled, SIGTTOU is ignored. However,
> when a trap action is specified for SIGTTOU, the signal is not ignored,
> and there is no blocking in place either, so the tcsetpgrp() call is not
> allowed.
>
> The lowest impact change to make here, the one that otherwise preserves
> the existing shell behaviour, is to block signals before calling
> tcsetpgrp and unblocking them afterwards. This ensures SIGTTOU does not
> get raised here, but also ensures that if SIGTTOU is sent to the shell
> for another reason, there is no window where it gets silently ignored.
>
> Another way to fix this is by not trying to make the shell start a new
> process group, or at least not make it the foreground process group.
> Most other shells appear to not try to do this.
This patch implements the blocking of SIGTTOU (and everything else)
while we call tcsetpgrp.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Sat, 19 May 2018 02:39:56 +0800
eval: Add vfork support
This patch adds basic vfork support for the case of a simple command.
Upstream commit:
Date: Tue, 12 Jan 2021 17:11:19 +1100
jobs: Always reset SIGINT/SIGQUIT handlers
On Fri, Jan 08, 2021 at 08:55:41PM +0000, Harald van Dijk wrote:
> On 18/05/2018 19:39, Herbert Xu wrote:
> > This patch adds basic vfork support for the case of a simple command.
> > ... @@ -879,17 +892,30 @@ forkchild(struct job *jp, union node *n, int
> > mode)
> > }
> > }
> > if (!oldlvl && iflag) {
> > - setsignal(SIGINT);
> > - setsignal(SIGQUIT);
> > + if (mode != FORK_BG) {
> > + setsignal(SIGINT);
> > + setsignal(SIGQUIT);
> > + }
> > setsignal(SIGTERM);
> > }
> > +
> > + if (lvforked)
> > + return;
> > +
> > for (jp = curjob; jp; jp = jp->prev_job)
> > freejob(jp);
> > }
>
> This leaves SIGQUIT ignored in background jobs in interactive shells.
>
> ENV= dash -ic 'dash -c "kill -QUIT \$\$; echo huh" & wait'
>
> As of dash 0.5.11, this prints "huh". Before, the subprocess process killed
> itself before it could print anything. Other shells do not leave SIGQUIT
> ignored.
>
> (In a few other shells, this also prints "huh", but in those other shells,
> that is because the inner shell chooses to ignore SIGQUIT, not because the
> outer shell leaves it ignored.)
Thanks for catching this. I have no idea how that got in there
and it makes no sense whatsoever. This patch removes the if
conditional.
Fixes: e94a964e7dd0 ("eval: Add vfork support")
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Comparing code with dash is more difficult with these differences.
(We didn't know back then that dash will be revived...)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Testsuite reports lots of message mismatches, fix that
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Tue, 6 Dec 2022 16:49:14 +0800
eval: Always set exitstatus in evaltree
There is no harm in setting exitstatus unconditionally in evaltree.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Upstream commit:
Date: Mon Feb 25 12:49:20 2019 +0800
options: Do not set commandname in procargs
We set commandname in procargs when we don't have to. This results
in a duplicated output of arg0 when an error occurs.
function old new delta
ash_main 1256 1236 -20
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>
|