| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
arith_apply 1134 1143 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
arith_apply 1137 1134 -3
evaluate_string 1101 1095 -6
arith_lookup_val 150 143 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-16) Total: -16 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes arith-ternary1.tests and arith-ternary_nested.tests
function old new delta
evaluate_string 1043 1101 +58
arith_apply 1087 1137 +50
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 108/0) Total: 108 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
arith_apply 1134 1087 -47
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
arith_apply 1123 1134 +11
arith_lookup_val 140 145 +5
evaluate_string 1053 1047 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 16/-6) Total: 10 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
evaluate_string 1011 1053 +42
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
encode_then_append_var_plusminus 554 552 -2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Consider this test case:
{ echo -n te; sleep 3; echo st; } | (read -t 1 x; echo "$x")
- bash echoes "te" after 1 second.
- Upstream BusyBox echoes an empty "$x" after 1 second.
- busybox-w32 echoes an empty "$x" after 3 seconds.
The delayed echo in busybox-w32 arises because the 'read' shell
built-in omits the code to poll for input.
Rearrange the code so that polling takes place. This doesn't address
the difference between BusyBox and bash.
Costs 48-64 bytes.
|
| |
| |
| |
| |
| |
| |
| | |
The 'read' shell built-in echoed console input to stdout. Echo
directly to the console instead.
Costs 124-136 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Although 'winxp' is a shell option it could only be set with '-X'
on the command line.
Fully implement 'winxp' so it can also be set within the shell by
'set -o winxp' and 'set +o winxp'. '-X' no longer needs to be the
first option on the command line.
Track which shell variables have been imported from a native Windows
environment so only those are affected when 'winxp' is changed. The
tracking persists in a subshell but is lost when shell variables are
exported to the environment so 'set -/+o winxp' is ineffective in a
child shell.
Costs 48-52 bytes.
(GitHub issue #322)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- There's no need to set USER, LOGNAME, HOME and SHELL as environment
variables: making them shell variables is enough.
- Use endofname() to detect invalid characters in variable names and
take the copy of the invalid variable before it's modified.
Saves 48-64 bytes.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
bltins1 384 396 +12
builtin_false - 6 +6
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 18/0) Total: 18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
run_list 1012 1024 +12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 255ebaf535 (drop: adjust environment on privilege change)
added USERNAME to the variables subject to special treatment when
the shell starts or privilege is dropped.
It's been pointed out this may not be appropriate for a variable
that's Windows-specific. Remove the special treatment of USERNAME.
Saves 40-48 bytes.
(GitHub issue #300)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Remove find_preferred_applet_by_name(). Instead add a
reference to is_applet_preferred() in find_applet_by_name().
- Remove the global variable ash_path. Use a static instead,
accessed by calling get_ash_path().
- Mark ash_applet_by_name() as NOINLINE.
Saves 64-96 bytes.
(GitHub issue #329)
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 64c8f5f3d0 (ash: add support for INT trap) made some changes
to the line editing code. As a result building the shell with
line editing disabled fails.
Add the necessary conditional compilation to restore the ability
to do this.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Support for conditionally replacing applets with external commands
requires the ability to check whether a given command name is
present on PATH. This was being done using the PATH environment
variable, which works in commands run by the shell but not in the
shell itself.
- The shell uses the *shell* variable PATH to look for executables.
This may not be the same as the *environment* variable.
- 'command -p' uses an entirely different PATH.
Applet look-up in the shell is now treated as a special case, with
the actual PATH being used passed to the look-up code in a global
variable.
This doesn't affect tab completion in the shell: whether a
completion is an applet or an external command is irrelevant.
Costs 152-288 bytes.
(GitHub issue #329)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that BB_OVERRIDE_APPLETS can affect how the shell searches
PATH it may be necessary to invalidate the command table when it
changes. It's probably not worth being clever about this: just
invalidate the cache on every change.
Adds 40-80 bytes
(GitHub issue #329)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously the 'noconsole' shell option could only be set as a
shell command line option. Allow it to be changed from within
the shell by 'set -o noconsole' or 'set +o noconsole'.
The console window is now minimised rather than hidden. This
makes it easier for the user to access the console when 'noconsole'
is in effect.
Adds 8-32 bytes.
(GitHub issue #325)
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit daa66ed6 fixed a number of use-after-free bugs in bash pattern
substitution, however one "unguarded" STPUTC remained, which is fixed here.
function old new delta
subevalvar 1564 1576 +12
Signed-off-by: Karsten Sperling <ksperling@apple.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
parse_and_run_stream 140 155 +15
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use an exit code of the form (signal << 24) when a process exits
due to a signal. This replaces the previous use of (signal + 128).
This makes it easier to distinguish exit codes from signals.
Allow kill(2) to handle all defined signals, not just EXIT, TERM
and KILL.
The kill and timeout applets now accept any defined signals.
Convert certain Windows status codes Unix-style signal codes.
In ash:
- Exit as if with SIGINT in raise_interrupt() rather than call
raise(SIGINT). The latter returns an exit code of 3.
- Detect if a child process exits as if with SIGINT. If not and if
the parent is an interactive top-level shell, reset pending_int.
This prevents the parent from seeing an INT if the child hasn't
reported it exited due to INT. (Probably due to it being an
interactive shell.)
Costs 132-136 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The '-N' option keeps the console window open after the elevated
shell exits.
Previously this was achieved by passing the '-s' option along with
'-c'. Recent changes allow scripts to be run without using '-c'
so a new mechanism is required.
su passes the '-N' flag to the shell. This causes the shell to
issue a prompt and wait for user input when it exits.
Costs 200-204 bytes.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since commit 9e2a5668f (ash,hush: allow builtins to be tab-completed,
closes 7532) ash and hush have supported tab completion of builtins.
Other shells, bash and ksh for example, also support tab completion
of functions and aliases.
Add such support to ash and hush.
function old new delta
ash_command_name - 92 +92
hush_command_name - 63 +63
ash_builtin_name 17 - -17
hush_builtin_name 38 - -38
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/0 up/down: 169/-55) Total: 100 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Avi Halachmi <avihpit@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
builtin_set 258 301 +43
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 950b318a2 (ash: Unix-style paths, shell builtins and applets)
broke running of Unix-style absolute paths from the shell by PATH
search. The copy of the program name on the stack should only be
used in the first call to tryexec() otherwise it interferes with the
use of the stack by padvance().
Also, bring the code to handle Unix-style paths in find_command()
into line with the revised code in shellexec().
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
getjob 281 285 +4
prefix 13 - -13
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 4/-13) Total: -9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
changepath 67 68 +1
legal_pathopt 70 66 -4
prefix 34 13 -21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 1/-25) Total: -24 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We can just clear mailtime_hash to zero and have the same effect.
function old new delta
changemail 8 11 +3
mail_var_path_changed 1 - -1
cmdloop 398 382 -16
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 3/-17) Total: -14 bytes
text data bss dec hex filename
1054786 559 5020 1060365 102e0d busybox_old
1054773 559 5020 1060352 102e00 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
padvance() exit condition is return value < 0, not == 0.
After MAIL changing twice, the logic erroneously
concluded that "you have new mail".
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Mea culpa, in "Do not allocate stack string in padvance" commit
(I left an extraneous "break" statement).
function old new delta
cmdloop 329 398 +69
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
hush_main 1815 1851 +36
re_execute_shell 601 635 +34
.rodata 102721 102726 +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 75/0) Total: 75 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
hush_main 1810 1815 +5
.rodata 102723 102721 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 5/-2) Total: 3 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
describe_command 323 320 -3
dotcmd 324 309 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18) Total: -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The trap and jobs builtins can be used to report information about
traps and jobs. This works when they're called from the current
shell but in a child shell the required information is usually
cleared. Special hacks allow:
- trap to work with command substitution;
- jobs to work with command substitution or in a pipeline.
Neither works with process substitution.
- Relax the test for the trap hack so it also supports pipelines.
- Pass the command to be evaluated to forkshell() in evalbackcmd()
so trap and jobs both work with process substitution.
function old new delta
forkchild 629 640 +11
argstr 1502 1496 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 11/-6) Total: 5 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 1d37186fe2 (ash: add bash-compatible EPOCH variables) added
support for the EPOCHSECONDS and EPOCHREALTIME variables.
These variables are dynamic and therefore require the VDYNAMIC flag
to be non-zero. However, this is only the case if support for the
RANDOM variable is enabled.
Give VDYNAMIC a non-zero value if either EPOCH variables or RANDOM
are enabled.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
No further problems with CRLF handling have been reported. Remove
the configuration option that allowed some recent changes to be
turned off.
Also, prevent some WIN32 code from being included in the POSIX
build. The faulty code is from commit 64c8f5f3d (ash: add support
for INT trap).
These changes don't alter the default WIN32 build.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When INT is being trapped the read builtin gets special treatment
in bash. In a top-level interactive shell interrupting the read
with Ctrl-C clears the input and allows the user to enter a new
string. In a subshell Ctrl-C really does interrupt the read and
the trap isn't executed.
zsh works similarly, except that in the latter case the trap is
executed.
dash interrupts the read and executes the trap in both cases.
ksh also interrupts the read in both cases but only executes the
trap in the first.
Implement the bash behaviour.
(GitHub issue #303)
|
| |
| |
| |
| |
| | |
Reinstate the change introduced in commit 96c104a61c (ash: try harder
to avoid ctrl-c issue). It was removed during recent work on traps.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The trap builtin now handles INT. As before, other signals (from
a limited list) are accepted but their traps don't have any effect.
There's some variability in how shells handle traps. This patch
upholds that proud tradition.
Various changes are needed to make this work:
- Line editing has a new flag to ignore Ctrl-C.
- If INT is being trapped or ignored don't call raise_interrupt().
- A minimal implementation of dotrap() is provided.
- Call dotrap() when the read builtin or line input detect Ctrl-C.
- Adjust Ctrl-C detection when the INT trap is changed.
- Set may_have_traps when an INT trap is set.
Costs 368-448 bytes.
(GitHub issue #303)
|