Commit Graph

1777 Commits

Author SHA1 Message Date
Stefan Hellermann 4ef1439c59 ash: read $HOME/.profile instead of $(pwd)/.profile
ash --login should read ~/.profile instead of .profile in the current
directory. I noticed it while trying to figure out why /root/.profile
is only read sometimes.

function                                             old     new   delta
ash_main                                            1374    1398     +24

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15 02:45:50 +01:00
Stefan Hellermann aeb717aa5e ash: move code to allow setting $HOME in /etc/profile
move HISTFILE=$HOME/.ash_history below reading /etc/profile,
so that /etc/profile can set $HOME. HOME can be unset when
directly invoking ash --login from init without going through
getty.

Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15 02:37:51 +01:00
Denys Vlasenko 1961aea305 move endofname() to libbb
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-26 00:36:53 +01:00
Denys Vlasenko 7c4b13e019 ash: revert wrong "fix" for an apparent memory leak. Closes 5822
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-17 13:02:27 +01:00
Denys Vlasenko 6830ade6aa whitespace fixes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15 13:58:01 +01:00
Denys Vlasenko 60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Jon Tollefson 4ba6c5d3ba ash: fix a memory leak
The script which triggers the leak:

while true
  do
    while true
      do
        break;
    done</dev/null
done

Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-11-13 19:26:53 +01:00
Denys Vlasenko d527588882 ash: implement export -n
function                                             old     new   delta
exportcmd                                            129     175     +46

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-10-01 13:41:17 +02:00
Denys Vlasenko 0b4980c252 ash: trivial fixes for compile failures
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-25 12:49:29 +02:00
Denys Vlasenko 9e71e3cea5 ash: fix "read -s" + ^C. Closes 5504
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-06 13:28:10 +02:00
Michael Tokarev 32f774cd34 *: declare strings with ALIGN1, as appropriate
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-24 15:56:37 +02:00
Denys Vlasenko 566a313a7f ash: add a comment about VEXPORT
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-07 21:40:35 +02:00
Mike Frysinger c5fe9f7b72 include sys/resource.h where needed
We use functions from sys/resource.h in misc applets, but don't include
the header.  This breaks building with newer glibc versions, so add the
include where needed.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-07-05 23:19:09 -04:00
Denys Vlasenko f451b2cfe0 ash: fix a bug in >${varexp} handling. Closes 5282
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-09 02:06:57 +02:00
Denys Vlasenko 9d75370238 hush: remove sighandler_t definition hack, platform.h has it too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-26 10:59:01 +02:00
Denys Vlasenko 8cab66730a fix build breakage found by randconfig
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-20 14:48:00 +02:00
Denys Vlasenko 0d6bbb0497 hush: remove unused member struct command::is_stopped
function                                             old     new   delta
builtin_umask                                        133     132      -1
checkjobs                                            551     544      -7
builtin_fg_bg                                        291     267     -24

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-27 14:32:48 +02:00
Aaro Koskinen 6e9d047c15 cttyhack: handle multiple consoles found in sysfs
If multiple consoles are found from the sysfs file, cttyhack fails:

cttyhack: can't open '/dev/tty0 ttyS0': No such file or directory

In such cases take the last one as the kernel will use that one for
/dev/console.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-04 21:55:01 +01:00
Denys Vlasenko 7ce209b9d4 shell_builtin_read: set cc[VMIN] to 1; lineedit: don't clear c_cc[VINTR]
First change fixes "read -n NUM". Apparently poll() won't report
data availability if cc[VMIN] > 1 until there are at least cc[VMIN] bytes.

function                                             old     new   delta
read_line_input                                     3885    3877      -8
shell_builtin_read                                  1097    1087     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18)             Total: -18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-15 22:58:06 +01:00
Denys Vlasenko 83f103b30e ash: in standalone mode, search in $PATH if /proc/self/exe doesn't exist
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-20 06:10:35 +01:00
Denys Vlasenko cda6ea905d ash: document bash's exit code too. No code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-16 00:44:36 +01:00
Denys Vlasenko 2bef526331 ash: add comment about bash's ENOEXEC handling. No code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-16 00:25:17 +01:00
Denys Vlasenko f8a5b792ba cttyhack: move /sys/class/tty/console/active check to the front
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-31 16:57:04 +01:00
Alexander Shishkin 156840c249 cttyhack: print detected ctty name when called without parameters
Sometimes there's a need to figure out the controlling tty from a shell
script, for example, to obtain a line for getty. In this case it's easier
to call cttyhack than trying to repeat some of the cttyhack's logic.

function                                             old     new   delta
cttyhack_main                                        283     327     +44
packed_usage                                       28911   28915      +4

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-31 13:18:44 +01:00
Denys Vlasenko e45af7ad17 lineedit: remove SAVE_HISTORY bit, ->hist_file can be used as indicator
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 16:15:24 +02:00
Denys Vlasenko bede215cf1 lineedit: add support for history saving on exit
Based on the patch by Dennis Groenen <tj.groenen@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 16:12:33 +02:00
Denys Vlasenko 4840ae8a06 lineedit: fix atomic replace of history file; hush: fix $HISTFILE handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 15:28:03 +02:00
Kevin Cernekee 4619802a5f cttyhack: trivial spelling/spacing fixes
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-16 23:31:03 +02:00
Kevin Cernekee 816cd16a4c cttyhack: remove the trailing newline when reading console name from sysfs
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-16 23:29:54 +02:00
Denys Vlasenko b347df9131 randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-09 22:49:15 +02: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
Kevin Cernekee 43a668b2ee cttyhack: fail gracefully if the device node is missing
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-13 09:30:36 +02:00
Kevin Cernekee 064e99646a cttyhack: check sysfs for the name of the active console
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-13 09:26:58 +02:00
Denys Vlasenko 56a3b82e96 hush: better comment. No code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-01 12:47:07 +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 60a9414cad fix "variable 'foo' set but not used" warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13 20:57:01 +02:00
Denys Vlasenko 0806e401d6 hush: install signal handlers with filled sigmask
function                                             old     new   delta
install_sighandler                                     -      39     +39
hush_main                                           1001    1031     +30
builtin_trap                                         386     392      +6
install_sighandlers                                  121     123      +2
switch_off_special_sigs                               87      86      -1
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 77/-1)              Total: 76 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 23:06:20 +02:00
Denys Vlasenko 75e77deab1 hush: fixes and small shrink for HUSH_JOB!=y
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 13:12:47 +02:00
Denys Vlasenko ebc1ee2e2a hush: remove one sigprocmask from exit path
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 10:59:18 +02:00
Denys Vlasenko 0c40a731e3 hush: add forgotten {} in multi-statement if.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 09:50:12 +02:00
Denys Vlasenko f58f705c58 hush: fix login shell's signal handling; add -l option so that it's easier to test
function                                             old     new   delta
hush_main                                            958    1001     +43
install_special_sighandlers                           47      52      +5
packed_usage                                       28752   28741     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 48/-11)             Total: 37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 02:10:33 +02:00
Denys Vlasenko 9d6cbafe72 hush: replace signal handling machinery
With new version of signal handling, read builtin should be less buggy
wrt signals.

function                                             old     new   delta
install_sighandlers                                    -     121    +121
switch_off_special_sigs                                -      84     +84
pick_sighandler                                        -      58     +58
install_special_sighandlers                            -      47     +47
builtin_wait                                         284     319     +35
record_pending_signo                                   -      21     +21
execvp_or_die                                         43      48      +5
file_get                                             290     288      -2
run_list                                            1004     998      -6
static.zero_timespec                                   8       -      -8
sigprocmask_set                                       14       -     -14
sigwaitinfo                                           23       -     -23
record_signal                                         23       -     -23
__GI_sigwaitinfo                                      23       -     -23
sigtimedwait                                          25       -     -25
builtin_trap                                         417     392     -25
__GI_sigtimedwait                                     25       -     -25
hush_main                                           1003     965     -38
check_and_run_traps                                  263     217     -46
__rt_sigtimedwait                                     52       -     -52
reset_traps_to_defaults                              213     126     -87
init_sigmasks                                        198       -    -198
builtin_read                                         536     197    -339
------------------------------------------------------------------------------
(add/remove: 5/10 grow/shrink: 2/7 up/down: 371/-934)        Total: -563 bytes
   text	   data	    bss	    dec	    hex	filename
 903075	    936	  17736	 921747	  e1093	busybox_old
 902547	    936	  17736	 921219	  e0e83	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-11 23:56:11 +02:00
Denys Vlasenko 10c0131a8a hush: use SA_RESTARTed signal handlers across read.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-11 11:49:21 +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 54e9e1217c hush: code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-09 00:52:15 +02:00
Denys Vlasenko 80542bad2f hush: make read builtin interruptible.
function                                             old     new   delta
builtin_read                                         185     471    +286
check_and_run_traps                                  200     262     +62
nonblock_immune_read                                  73     119     +46
sigismember                                            -      44     +44
record_signal                                          -      21     +21
sigisemptyset                                          -      16     +16
...
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 7/5 up/down: 483/-46)           Total: 437 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:23:43 +02:00
Denys Vlasenko 80c5b6893d libbb: nonblock_safe_read->nonblock_immune_read, remove unused param of xmalloc_reads
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:21:10 +02:00
Denys Vlasenko b8709032a3 hush: fix incorrect PS2 dispaly and trap handling while reading command
The fix affects only !ENABLE_FEATURE_EDITING configuration

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:20:01 +02:00
Ian Wienand 89b3cbaa97 ash: clear sa_flags always
Signed-off-by: Ian Wienand <ianw@vmware.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-16 20:05:14 +02:00
Denys Vlasenko e32d05b708 ash,hush: add ulimit -e -r (RLIMIT_NICE, RLIMIT_RTPRIO)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-04 02:12:14 +02:00
Denys Vlasenko 2c4de5b045 ash,hush: optional support for $HISTFILESIZE.
Based on patch from Alexey Fomenko (ext-alexey.fomenko AT nokia.com)

function                                             old     new   delta
size_from_HISTFILESIZE                                 -      44     +44
hush_main                                            998    1025     +27
ash_main                                            1348    1374     +26
read_line_input                                     3361    3372     +11
new_line_input_t                                      17      24      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-31 13:16:52 +02:00
Denys Vlasenko a439fa93f6 hush: remove outdated comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-30 19:11:46 +02:00
Denys Vlasenko cecbc98611 hush: fix source1.tests
function                                             old     new   delta
parse_and_run_stream                                  95     139     +44
static_get                                            22      25      +3
file_get                                             260     263      +3
builtin_umask                                        133     132      -1
parse_stream                                        2442    2425     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 50/-18)             Total: 32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-30 18:54:52 +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 3eab24e64a hush: make parse errors in sourced file non-fatal in interactive script
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-24 05:25:59 +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 20704f0662 ash,hush: recheck LANG before every line input
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-23 17:59:27 +01:00
Denys Vlasenko 6b6af53426 ash/hush: shrink help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-08 10:24:17 +01:00
Denys Vlasenko 976ec23da5 remove stray empty line
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-07 13:12:01 +01:00
Denys Vlasenko b0b834342f ash/hush: provide help text
$ ./busybox ash --help
BusyBox v1.19.0.git (2011-03-07 11:25:29 CET) multi-call binary.

Usage: ash [-/+OPTCHARS] [-/+o OPTNAME]... [-c 'SCRIPT' [ARG0 [ARGS]] / SCRIPT_FILE [ARGS]]

Unix shell interpreter

$ ./busybox hush --help
BusyBox v1.19.0.git (2011-03-07 11:25:29 CET) multi-call binary.

Usage: hush [-nx] [-c 'SCRIPT' [ARG0 [ARGS]] / SCRIPT_FILE [ARGS]]

Unix shell interpreter

function                                             old     new   delta
packed_usage                                       28163   28212     +49
setcmd                                                85      78      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 49/-7)              Total: 42 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-07 12:34:59 +01:00
Denys Vlasenko aefe1c260e ash: fix execution of shell scripts without shebang
We were assuming #!/bin/sh, whereas we had to simply re-enter ash.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-07 12:02:40 +01:00
Denys Vlasenko 940c7206c2 convert "do {...} while (1);" -> "while (1) {...}"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-02 04:07:14 +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 7c6f2468cc hush: do not print killer signal's name for SIGPIPE
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-14 17:17:10 +01:00
Denys Vlasenko 66c5b12dbf ash: fix TMOUT not restoring tty attributes
function                                             old     new   delta
pgetc                                                420     500     +80
readtoken1                                          3202    3239     +37
read_line_input                                     3316    3337     +21
udhcpc_main                                         2610    2630     +20
file_get                                             266     272      +6
expandarg                                            958     963      +5
localcmd                                             257     259      +2
addLines                                              85      87      +2
read_line                                             94      95      +1
ed_main                                             2540    2541      +1
timed_out                                              1       -      -1
lineedit_read_key                                    256     255      -1
alrm_sighandler                                       44       -     -44
cmdloop                                              539     434    -105
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 10/2 up/down: 175/-151)          Total: 24 bytes
   text    data     bss     dec     hex filename
 887379     936   17200  905515   dd12b busybox_old
 887411     936   17192  905539   dd143 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-08 05:07:02 +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 046341e8bd ash: optional support for $TMOUT variable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-04 17:53:59 +01:00
Denys Vlasenko 8c52f80397 ash: cosmetic cleanups
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-04 17:36:21 +01:00
Denys Vlasenko b7c9fb27cb whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-03 00:05:48 +01:00
Denys Vlasenko b72baeb003 hush: use FEATURE_SH_NOFORK to enable NOFORK trick
Also expands docs

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-02 18:38:57 +01:00
Denys Vlasenko 8d0e0cdadf move utmp.h include to libbb.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 23:21:46 +01:00
Denys Vlasenko a146319173 hush: improve prompt in nested {}s, remove unused in_str->promptme member
function                                             old     new   delta
setup_string_in_str                                   29      38      +9
parse_and_run_stream                                  79      88      +9
setup_file_in_str                                     32      39      +7
parse_stream                                        2430    2422      -8
file_get                                             262     235     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 25/-35)            Total: -10 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 17:55:04 +01:00
Denys Vlasenko 98c46d10ee hush: fix "cmd & <newline>" problem
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 17:30:07 +01:00
Denys Vlasenko b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko 642e71a789 hush: fix wrong prompt problem on empty interactive commants
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-07 15:16:05 +01:00
Denys Vlasenko 6088e138e1 init: simpler handling of leading dash in commands
function                                             old     new   delta
init_exec                                            233     219     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-25 23:58:42 +01:00
Denys Vlasenko 75eb9d20e9 hush: fix FEATURE_CLEAN_UP code (was freeing unallocated memory)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-12-21 21:18:12 +01:00
Denys Vlasenko 0d6a4ecb30 hush: fix build breakage (variable declared in for())
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-18 01:34:49 +01:00
Denys Vlasenko 8da415ef25 add if guards around include <malloc.h>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-05 01:30:14 +01:00
Denys Vlasenko 57542ebe4f hush: move G_x_mode define to the more appropriate place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 03:59:30 +01:00
Dan Fandrich 85c62470b7 Support set -o xtrace/noexec alternates for set -x/-n
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 03:56:39 +01:00
Dan Fandrich 89ca2f99a2 hush: display useful help text
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 01:54:39 +01:00
Denys Vlasenko 26777aa1c6 fixes for bugs discovered by randomconfig builds and tests
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-22 23:49:10 +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 c08c3f5d26 hush: preparatory patch for set -o pipefail support
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-14 01:59:55 +01:00
Denys Vlasenko fb132e4737 whitespace cleanup
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Denys Vlasenko e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko cacb2cd281 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-05 00:13:02 +02:00
Denys Vlasenko e2069fb325 hush: remove "doesn't support brace expansion" from config help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-04 00:01:47 +02:00
Denys Vlasenko bbecd74d5a hush: remove brace expansion from TODO list in comments. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03 17:22:52 +02:00
Denys Vlasenko 957f79f471 hush: small code shrink
function                                             old     new   delta
expand_on_ifs                                        231     222      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03 17:15:50 +02: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 9e800223f1 hush: implement brace expansion
When enabled:

function                                             old     new   delta
glob_brace                                             -     402    +402
next_brace_sub                                         -      70     +70
expand_on_ifs                                        185     231     +46
bbconfig_config_bz2                                 4923    4929      +6
o_save_ptr                                           282     140    -142
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/1 up/down: 524/-142)          Total: 382 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03 14:28:04 +02:00
Denys Vlasenko 238081f750 hush: preparatory patch, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-03 14:26:26 +02:00
Denys Vlasenko b563f62bbb ash: fix signal and "set -e" interaction
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-09-25 17:15:13 +02:00
Denys Vlasenko 0e13b4019c hush: use smaller EXP_FLAG_foo constants
function                                             old     new   delta
expand_string_to_string                              126     124      -2
parse_stream                                        2376    2370      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-8)               Total: -8 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-21 12:35:39 +02:00
Denys Vlasenko 395b97aeac shell/math: better comment. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-17 18:02:17 +02:00
Denys Vlasenko 52e460b744 hush: move shell_ver from globals to main's stack.
function                                             old     new   delta
hush_main                                            995    1011     +16
pseudo_exec_argv                                     253     251      -2
execvp_or_die                                         50      48      -2
maybe_set_to_sigexit                                  50      47      -3
hush_exit                                             78      75      -3
builtin_wait                                         274     271      -3
check_and_run_traps                                  205     200      -5
init_sigmasks                                        214     190     -24
builtin_trap                                         465     441     -24
reset_traps_to_defaults                              238     211     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/9 up/down: 16/-93)            Total: -77 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-16 16:12:00 +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 0eac8ff164 shell/math.c: stop using bss variable
function                                             old     new   delta
evaluate_string                                        -     678    +678
expand_one_var                                      1543    1563     +20
builtin_type                                         114     116      +2
expand_and_evaluate_arith                             89      87      -2
prev_chk_var_recursive                                 4       -      -4
ash_arith                                            122     118      -4
arith_lookup_val                                     142     132     -10
arith                                                674      12    -662
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 2/4 up/down: 700/-682)           Total: 18 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 12:49:52 +02:00
Denys Vlasenko 06d44d7dfb shell/math.c: rename arith_eval_hooks to arith_state, put error code into it
function                                             old     new   delta
expand_and_evaluate_arith                             79      89     +10
arith                                                675     674      -1
arith_lookup_val                                     151     142      -9
ash_arith                                            135     122     -13
arith_apply                                         1304    1269     -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 10/-58)            Total: -48 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 12:49:03 +02:00
Denys Vlasenko bd14770b0c shell/math.c: small code shrink; fixed incomprehensible comments
function                                             old     new   delta
arith_apply                                         1334    1304     -30

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 11:11:40 +02:00
Denys Vlasenko 51850c818c shell: small code shrink
function                                             old     new   delta
arith                                                680     675      -5

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 01:09:11 +02:00
Denys Vlasenko b771c654ca shell: shrink arith code; and prepare for returning text error codes
function                                             old     new   delta
arith                                                701     680     -21

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-13 00:34:26 +02:00
Denys Vlasenko 99862cbfad hush: optional support for history saving
function                                             old     new   delta
hush_main                                            945     995     +50

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 17:34:13 +02:00
Denys Vlasenko de8c3f667a hush: move the EXIT trap comment. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 16:13:44 +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 2d8187c139 shell/match.c: shrink by dropping double bool inversion
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:06:42 +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 958581a8d9 ash: shrink by folding an if check into setprompt; unindent big block
function                                             old     new   delta
setprompt_if                                           -      66     +66
parseheredoc                                         126     124      -2
parsecmd                                              68      66      -2
redirect                                            1254    1249      -5
xxreadtoken                                          351     343      -8
readtoken1                                          3219    3204     -15
setprompt                                             62       -     -62
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/5 up/down: 66/-94)            Total: -28 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:04:27 +02:00
Denys Vlasenko 6040fe88f4 ash: add missing casts to match CTLfoo; add TODO comments
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 15:03:16 +02:00
Denys Vlasenko 5277a9db70 hush: remove forgotten commented-out block. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 15:34:53 +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 d98e5c65c3 hush: better function and parameter names
Also, trim code which isn't needed for non-bash compat.
No logic changes.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 10:44:23 +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 14e289b324 hush: fix var_bash3.tests failure
function                                             old     new   delta
expand_one_var                                      1513    1538     +25
parse_stream_dquoted                                 233     241      +8
expand_pseudo_dquoted                                118     126      +8
setup_heredoc                                        298     303      +5
expand_and_evaluate_arith                             69      74      +5
parse_stream                                        2371    2374      +3
builtin_umask                                        132     133      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/0 up/down: 55/0)               Total: 55 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 10:15:18 +02:00
Denys Vlasenko a769e0225d hush: remove useless ESC_GLOB_CHARS clears/resotres
function                                             old     new   delta
o_addQstr                                             43     165    +122
expand_on_ifs                                        210     189     -21
expand_vars_to_list                                 1122    1094     -28
o_addqblock                                          139       -    -139
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 122/-188)          Total: -66 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-10 10:12:34 +02:00
Denys Vlasenko bfc02a76c5 hush: fix a bug where expand_one_var wasn't restoring 1st char of the encoded $var
function                                             old     new   delta
expand_one_var                                      1515    1513      -2
expand_vars_to_list                                 1133    1122     -11

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-09 14:38:46 +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 5b6210cf49 hush: simplification in parse_stream, parse_stream_dquoted
function                                             old     new   delta
parse_stream                                        2354    2369     +15
parse_stream_dquoted                                 250     228     -22

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-09 13:32:21 +02:00
Denys Vlasenko 850b15bfaf hush: simplify parse_stream_dquoted
function                                             old     new   delta
parse_stream_dquoted                                 303     250     -53

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-09 12:58:19 +02:00
Denys Vlasenko 77a7b5519c hush: straighten out the logic in parse_stream
function                                             old     new   delta
parse_stream                                        2399    2354     -45

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-09 12:40:03 +02:00
Dan Fandrich 77d4872691 Avoid side effects in putc(), which may be implemented as a macro
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-09 11:48:02 +02:00
Denys Vlasenko 95d48f2598 hush: eliminate redundant parameter of expand_vars_to_list()
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-08 13:58:55 +02:00
Denys Vlasenko 5b686cb8e6 hush: replace flag bytes in struct o_string with bit flags
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-08 13:44:34 +02:00
Denys Vlasenko 9b78255dca hush: remove unused enum typedef
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-08 13:33:26 +02:00
Denys Vlasenko 1fd3d94a6c hush: fix set -- q w e; (IFS='' echo "$*"; IFS=''; echo "$*"); echo "$*"
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-08 13:31:53 +02:00
Denys Vlasenko 8b2f13d84d shell: unify endofname() in hush and ash
function                                             old     new   delta
builtin_umask                                        132     133      +1
changepath                                           195     194      -1
expand_and_evaluate_arith                             77      69      -8
ash_arith                                            143     135      -8
expand_one_var                                      1551    1515     -36
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 1/-53)             Total: -52 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 12:19:33 +02:00
Denys Vlasenko 27c56f1267 hush: a few relatively trivial simplifications
function                                             old     new   delta
helper_export_local                                  130     135      +5
set_vars_and_save_old                                 89      85      -4
expand_variables                                     147     141      -6
get_ptr_to_local_var                                  77      70      -7
get_local_var_value                                  171     164      -7
delete_finished_bg_job                                31      16     -15
hush_exit                                            101      84     -17
free_pipe_list                                        31      12     -19
check_and_run_traps                                  232     205     -27
free_pipe                                            205     130     -75
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/9 up/down: 5/-177)           Total: -172 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 09:56:34 +02:00
Denys Vlasenko da463fb007 hush: style cleanups. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 09:53:50 +02:00
Denys Vlasenko 605067b426 hush: revert a recent buggy change which resulted in two HUSH_VERSIONs
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 12:10:51 +02:00
Denys Vlasenko 83b900fb82 fix typo in comment
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 11:47:55 +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 d383b49aef hush: remove disabled CMD_SINGLEWORD_NOGLOB_COND, rename o_glob->perform_glob
+ other small tweaks to comments and such

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 10:22:13 +02:00
Denys Vlasenko 96f064d416 shell: remove lash and bbsh
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-06 10:18:21 +02:00
Denys Vlasenko b36abf2dfc hush: big reordering: move parser functions to the beginning. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 14:50:59 +02:00
Denys Vlasenko 38292b68c9 hush: rename o_quoted to has_quoted_part; small code shrink
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 14:49:40 +02:00
Denys Vlasenko f2dc20c2d5 hush: move variable expansion into a separate function. No logic changes
function                                             old     new   delta
expand_one_var                                         -    1551   +1551
expand_vars_to_list                                 2833    1175   -1658
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 1551/-1658)       Total: -107 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 14:48:11 +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 701e127f7d hush: optimize #[#] and %[%] for speed. size -2 bytes.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-04 21:21:07 +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 8d3e225a2d libbb: add xfstat function
function                                             old     new   delta
xfstat                                                 -      25     +25
mkfs_ext2_main                                      2421    2423      +2
mkfs_reiser_main                                    1197    1194      -3
next                                                 312     307      -5
ar_main                                              533     522     -11
mkfs_minix_main                                     2938    2924     -14
mkfs_vfat_main                                      1511    1495     -16
writeTarFile                                         272     255     -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 27/-66)            Total: -39 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-31 12:42:06 +02:00
Denys Vlasenko 0ff78a0166 ash: small code shrink (-21 bytes)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-30 15:20:07 +02:00
Denys Vlasenko f7a8433535 ash: add another ${v/a/b} test we currently fail
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-30 13:54:12 +02:00
Denys Vlasenko b32a543663 nandwrite: complain on malformed -s NUM
Elsewhere: use common error message. -30 bytes net size change

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-29 13:29:02 +02:00
Denys Vlasenko 0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko 7783248eaa *: s/xatoi_u/xatoi_positive/g - I got bored of mistyping xatoi_u as xatou_i
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-12 14:14:45 +02:00
Denys Vlasenko 33bbb27e45 ash: fix another bit of var_bash4 bug
But it _still_ doesn't pass! quoted case is a tough nut to crack

function                                             old     new   delta
redirect                                            1281    1286      +5
subevalvar                                          1141    1142      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-07 22:24:36 +02:00
Denys Vlasenko 09dd6ec732 ash: cosmetic fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-07 02:44:33 +02:00
Denys Vlasenko 1614900522 ash: fix another bug detected by var_bash4.tests
... but var_bash4.tests still does not pass!

function                                             old     new   delta
expandarg                                            959     962      +3
localcmd                                             259     257      -2
readtoken1                                          3275    3260     -15
subevalvar                                          1178    1141     -37
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 3/-54)             Total: -51 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-06 22:06:21 +02:00
Denys Vlasenko c8d305d89f var_bash4.tests: better wording in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-06 19:28:04 +02:00
Denys Vlasenko f02c82f38c ash: fix dequoting error detected by var_bash4 test
But the test still fails (one more bug to fix)

function                                             old     new   delta
changepath                                           195     192      -3
readtoken1                                          3247    3240      -7
subevalvar                                          1204    1184     -20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-30)             Total: -30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-06 19:14:47 +02:00
Denys Vlasenko f56fe82542 update var_bash4 test. one more bug revealed by it now...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-06 17:21:52 +02:00
Denys Vlasenko 6814cbc928 ash: extend var_bash4.tests; nocode changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-05 18:29:13 +02:00
Denys Vlasenko b0fbe4b540 ash: add a testcase for bug 2281 (currently fails). Small code cleanups.
function                                             old     new   delta
changepath                                           195     192      -3
subevalvar                                          1204    1200      -4
readtoken1                                          3247    3240      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-14)             Total: -14 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-05 17:19:27 +02:00
Denys Vlasenko 17662801ec cttyhack: make it survive WERROR build
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-30 17:41:35 +02:00
Jeremie Koenig 430ba79c39 cttyhack: serial console detection is Linux-specific
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-30 17:40:37 +02:00
Alexander Shishkin 17e0e43c35 ulimit: set both hard and soft limits by default
function                                             old     new   delta
shell_builtin_ulimit                                 494     498      +4

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-27 08:40:55 +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
Denys Vlasenko f3ea792bad *: mass cosmetic removal of extra empty lines. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:06:14 +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
Jeremie Koenig 1d7266d3b5 mark Linux-specific configuration options
PLATFORM_LINUX is used as a dependency for applets or features
which require Linux-specific interfaces.

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:44:56 +02:00
Denys Vlasenko 6adf2aad38 hush: move msh/lash config into hush.c, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-16 19:26:38 +02:00
Denys Vlasenko 51ca7761a3 cttyhack: move build system bits into cttyhack.c, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-16 17:16:40 +02:00
Denys Vlasenko 771f1995a9 ash: move config stuff into ash.c, no code chages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-16 14:31:34 +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 202a2d1219 hush: make set -x support optional
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-16 12:36:14 +02:00
Denys Vlasenko 3f5fae0772 hush: add support for set -x
function                                             old     new   delta
run_pipe                                            1442    1568    +126
dump_cmd_in_x_mode                                     -     126    +126
builtin_trap                                         441     462     +21
pseudo_exec_argv                                     171     187     +16
reset_traps_to_defaults                              214     229     +15
check_and_run_traps                                  227     232      +5
hush_exit                                             98     101      +3
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 6/0 up/down: 312/0)             Total: 312 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-16 12:35:35 +02:00
Denys Vlasenko b3389de04b hush: fix typo in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-15 12:33:37 +02:00
Denys Vlasenko 8fa1f5d543 hush: fix faloout from previous commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-15 08:18:46 +02:00
Denys Vlasenko 889550b36b hush: make pun_pipe loop clearer; fix "cmd | var=`cmd` | cmd" handling
function                                             old     new   delta
free_strings                                           -      38     +38
pseudo_exec_argv                                     161     171     +10
free_pipe                                            227     205     -22
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 48/-22)             Total: 26 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-14 19:01:25 +02:00
Denys Vlasenko 9297dbc9d2 randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-05 21:37:12 +02:00
Pascal Bellard 926031b764 *: introduce and use xfork() and xvfork()
function                                             old     new   delta
launch_helper                                        170     169      -1
setup_heredoc                                        312     302     -10
handle_dir_common                                    367     354     -13
expand_vars_to_list                                 2456    2443     -13
open_transformer                                      89      74     -15
data_extract_to_command                              439     423     -16
do_ipaddr                                           1406    1389     -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-85)             Total: -85 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 15:32:38 +02:00
Pascal Bellard 21e8e8da64 libbb: introduce and use BB_EXECVP_or_die()
function                                             old     new   delta
BB_EXECVP_or_die                                       -      47     +47
time_main                                           1042    1043      +1
chrt_main                                            371     364      -7
ionice_main                                          292     282     -10
setsid_main                                           69      56     -13
nohup_main                                           236     223     -13
cttyhack_main                                        266     253     -13
chroot_main                                           94      81     -13
chpst_main                                           746     733     -13
timeout_main                                         297     279     -18
taskset_main                                         541     522     -19
vfork_child                                           67      45     -22
parse                                                975     953     -22
lpd_main                                             770     748     -22
launch_helper                                        192     170     -22
tcpudpsvd_main                                      1810    1782     -28
nice_main                                            190     156     -34
env_main                                             242     206     -36
run_command                                          221     174     -47
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/17 up/down: 48/-352)         Total: -304 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 00:57:03 +02:00
Denys Vlasenko fd33e17a2b ash: fix obscure case of replacing + globbing + backslashes
function                                             old     new   delta
subevalvar                                          1152    1178     +26
readtoken1                                          3267    3275      +8
redirect                                            1284    1286      +2
expandarg                                            957     958      +1
expdir                                                 4       -      -4
evalcommand                                         1219    1209     -10
expmeta                                              481     469     -12
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/2 up/down: 37/-26)             Total: 11 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 22:55:44 +02:00
Denys Vlasenko 1fcbff2fac build system: do not rebuild ash and hush on any change to any .c file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 02:40:08 +02:00
Andreas Bühmann da75f44844 ash: <> redir should not truncate
Signed-off-by: Andreas Bühmann <buehmann@users.berlios.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-24 04:32:37 +02:00
Dan Fandrich fdd7b566ec A few minor portability improvements
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-19 20:03:15 +02:00
Denys Vlasenko 8cd9f343e7 ash: times builtin: use unsigned type; take free-of-charge modulo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 15:36:48 +02:00
Denys Vlasenko b87c17cd16 *: stop defining _GNU_SOURCE in source files, it's in CFLAGS anyway
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 15:15:24 +02:00
Denys Vlasenko 7df28bbb8f ash: fix unset in standalone mode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 14:23:47 +02:00
Denys Vlasenko 1ed2fb40c9 ash: cosmetics, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 14:09:48 +02:00
Denys Vlasenko d70e0e995e *: add INSERTs to *.src files where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-08 12:15:11 +02:00
Denys Vlasenko 729ecb87bf bbconfig: make it independent from printf functions
function                                             old     new   delta
full_write2_str                                        -      25     +25
full_write1_str                                        -      25     +25
clear_main                                            21      20      -1
telnet_main                                         1488    1477     -11
getty_main                                          1932    1918     -14
full_write22_str                                      25       -     -25
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/3 up/down: 50/-51)             Total: -1 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-07 14:14:26 +02:00
Denys Vlasenko 121fb9506b typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-07 13:34:34 +02:00
Denys Vlasenko c8aae0b2a0 fix allnoconfig
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 22:14:58 +02:00
Denys Vlasenko 161bb8fa12 fix a few goofs uncovered by "make allnoconfig" testing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 05:07:11 +02:00
Denys Vlasenko 2f32bf8be6 remove defconfig. Now "make defconfig" simply uses defaults from Config.in
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 04:14:28 +02:00
Denys Vlasenko da929a95aa mass renaming Kbuild -> Kbuild.src, Config.in -> Config.src
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04 20:10:51 +02:00
Denys Vlasenko 79b3d42e13 ash: rename parsefile->fd to ->pf_fd
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-03 04:29:08 +02:00
Denys Vlasenko 08d8b3cee1 ash: fix redirection of fd 0 in scripts are sourced from interactive ash
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-03 04:28:28 +02:00
Denys Vlasenko ea8b252cb3 *: better string sharing
text   data    bss    dec    hex filename
 849427    441   7556 857424  d1550 busybox_old
 849355    441   7556 857352  d1508 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-02 12:57:26 +02:00