oweals/busybox.git
9 years agotar: implement --version for buildroot
Denys Vlasenko [Thu, 22 Oct 2015 11:22:26 +0000 (13:22 +0200)]
tar: implement --version for buildroot

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotar: add support for --strip-components=N
Denys Vlasenko [Wed, 21 Oct 2015 23:07:13 +0000 (01:07 +0200)]
tar: add support for --strip-components=N

function                                             old     new   delta
data_extract_all                                     882     995    +113
tar_longopts                                         290     309     +19
tar_main                                             938     942      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 136/0)             Total: 136 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agologin: explain -h HOST option better
Denys Vlasenko [Wed, 21 Oct 2015 14:06:40 +0000 (16:06 +0200)]
login: explain -h HOST option better

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agowget: make Bartosz's "wget --passive-ftp -nd -t 3" work
Denys Vlasenko [Tue, 20 Oct 2015 19:51:52 +0000 (21:51 +0200)]
wget: make Bartosz's "wget --passive-ftp -nd -t 3" work

function                                             old     new   delta
static.wget_longopts                                 166     234     +68
wget_main                                           2608    2610      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotypo fix
Denys Vlasenko [Tue, 20 Oct 2015 16:15:01 +0000 (18:15 +0200)]
typo fix

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoscripts/trylink: remove $CPPFLAGS
Denys Vlasenko [Tue, 20 Oct 2015 14:40:43 +0000 (16:40 +0200)]
scripts/trylink: remove $CPPFLAGS

We don't use it in final link, should not use it in check_FOO then.
This uncovered a logic bug in glibc check...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoscripts/trylink: fix bit-rotted linker option verification
Denys Vlasenko [Tue, 20 Oct 2015 14:16:16 +0000 (16:16 +0200)]
scripts/trylink: fix bit-rotted linker option verification

To that end, *make it complain* when check_cc fails on options
we usually want to succeed.

   text    data     bss     dec     hex filename
 929697     932   17692  948321   e7861 busybox-1.23.2/busybox
 915361     911   17484  933756   e3f7c busybox-1.23.2.fixed/busybox

 927725     932   17448  946105   e6fb9 busybox-1.24.0/busybox
 913630     911   17240  931781   e37c5 busybox-1.24.0.fixed/busybox

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoqemu_multiarch_testing/README: add a list of qemu's needed
Denys Vlasenko [Tue, 20 Oct 2015 10:58:37 +0000 (12:58 +0200)]
qemu_multiarch_testing/README: add a list of qemu's needed

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosetarch: add support for '-R' (disable randomization)
Denys Vlasenko [Mon, 19 Oct 2015 21:26:50 +0000 (23:26 +0200)]
setarch: add support for '-R' (disable randomization)

This commit adds support for the -R flag of setarch, which disables
randomization of the virtual address space.

function                                             old     new   delta
setarch_main                                         115     150     +35
packed_usage                                       30664   30651     -13

Signed-off-by: Jan Heylen <heyleke@gmail.com>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosort: fix ENDCHAR handling in "-kSTART,N.ENDCHAR"
Denys Vlasenko [Mon, 19 Oct 2015 17:27:26 +0000 (19:27 +0200)]
sort: fix ENDCHAR handling in "-kSTART,N.ENDCHAR"

function                                             old     new   delta
get_key                                              505     503      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosort: code shrink
Denys Vlasenko [Mon, 19 Oct 2015 17:13:06 +0000 (19:13 +0200)]
sort: code shrink

function                                             old     new   delta
compare_keys                                         738     695     -43

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoremove extra debug printout
Denys Vlasenko [Mon, 19 Oct 2015 12:48:24 +0000 (14:48 +0200)]
remove extra debug printout

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosort: fix key with delimiters breakage
Denys Vlasenko [Mon, 19 Oct 2015 12:44:51 +0000 (14:44 +0200)]
sort: fix key with delimiters breakage

function                                             old     new   delta
get_key                                              509     505      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: make parse_chown_usergroup_or_die() set unspecified uid/gid to -1
Denys Vlasenko [Mon, 19 Oct 2015 02:37:19 +0000 (04:37 +0200)]
libbb: make parse_chown_usergroup_or_die() set unspecified uid/gid to -1

function                                             old     new   delta
parse_chown_usergroup_or_die                         102     115     +13
chown_main                                           190     175     -15
start_stop_daemon_main                              1043    1027     -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 13/-31)            Total: -18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: get_uidgid() always called with allow_numeric=1
Denys Vlasenko [Mon, 19 Oct 2015 02:27:17 +0000 (04:27 +0200)]
libbb: get_uidgid() always called with allow_numeric=1

function                                             old     new   delta
xget_uidgid                                           30      25      -5
make_device                                         2188    2183      -5
main                                                 797     792      -5
get_uidgid                                           240     225     -15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agood: get rid of (almost all) statics
Denys Vlasenko [Mon, 19 Oct 2015 00:51:56 +0000 (02:51 +0200)]
od: get rid of (almost all) statics

function                                             old     new   delta
od_main                                             2565    2600     +35
check_and_close                                      113     115      +2
static.prev_pair_equal                                 1       -      -1
static.first                                           1       -      -1
exit_code                                              1       -      -1
string_min                                             4       -      -4
n_specs                                                4       -      -4
in_stream                                              4       -      -4
format_address                                         4       -      -4
file_list                                              4       -      -4
bytes_per_block                                        4       -      -4
get_lcm                                              120     115      -5
pseudo_offset                                          8       -      -8
------------------------------------------------------------------------------
(add/remove: 0/10 grow/shrink: 2/1 up/down: 37/-40)            Total: -3 bytes
   text    data     bss     dec     hex filename
 938487     932   17392  956811   e998b busybox_old
 938519     924   17360  956803   e9983 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofsck: do not use statics
Denys Vlasenko [Mon, 19 Oct 2015 00:24:14 +0000 (02:24 +0200)]
fsck: do not use statics

function                                             old     new   delta
fsck_main                                           1794    1812     +18
packed_usage                                       30662   30664      +2
kill_all_if_got_signal                                60      62      +2
create_fs_device                                     158     160      +2
static.kill_sent                                       1       -      -1
skip_root                                              1       -      -1
serialize                                              1       -      -1
parallel_root                                          1       -      -1
noexecute                                              1       -      -1
fs_type_negated                                        1       -      -1
force_all_parallel                                     1       -      -1
verbose                                                4       -      -4
num_running                                            4       -      -4
num_args                                               4       -      -4
max_running                                            4       -      -4
instance_list                                          4       -      -4
fstype                                                 4       -      -4
fs_type_list                                           4       -      -4
fs_type_flag                                           4       -      -4
filesys_last                                           4       -      -4
filesys_info                                           4       -      -4
args                                                   4       -      -4
wait_one                                             309     300      -9
ignore                                               196     174     -22
------------------------------------------------------------------------------
(add/remove: 0/18 grow/shrink: 4/2 up/down: 24/-82)           Total: -58 bytes
   text    data     bss     dec     hex filename
 938527     932   17448  956907   e99eb busybox_old
 938487     932   17392  956811   e998b busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agochattr,lsattr: shorten help message
Denys Vlasenko [Sun, 18 Oct 2015 23:29:20 +0000 (01:29 +0200)]
chattr,lsattr: shorten help message

function                                             old     new   delta
packed_usage                                       30662   30645     -17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agologinutils/*: convert to new-style "one file" applets
Denys Vlasenko [Sun, 18 Oct 2015 23:20:36 +0000 (01:20 +0200)]
loginutils/*: convert to new-style "one file" applets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodebianutils/*: convert to new-style "one file" applets
Denys Vlasenko [Sun, 18 Oct 2015 22:52:26 +0000 (00:52 +0200)]
debianutils/*: convert to new-style "one file" applets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoprintutils/*: convert to new-style "one file" applets
Denys Vlasenko [Sun, 18 Oct 2015 22:45:46 +0000 (00:45 +0200)]
printutils/*: convert to new-style "one file" applets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agorunit/*: convert to new-style "one file" applets
Denys Vlasenko [Sun, 18 Oct 2015 22:41:28 +0000 (00:41 +0200)]
runit/*: convert to new-style "one file" applets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoe2fsprogs/*: convert to new-style "one file" applets
Denys Vlasenko [Sun, 18 Oct 2015 20:40:23 +0000 (22:40 +0200)]
e2fsprogs/*: convert to new-style "one file" applets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosysklogd/*: convert to new-style "one file" applets
Denys Vlasenko [Sun, 18 Oct 2015 16:42:03 +0000 (18:42 +0200)]
sysklogd/*: convert to new-style "one file" applets

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agocpio: implement -R/--owner
Aaro Koskinen [Fri, 16 Oct 2015 15:24:46 +0000 (17:24 +0200)]
cpio: implement -R/--owner

Implement -R/--owner to force ownership of files.

function                                             old     new   delta
cpio_main                                            532     586     +54
get_header_cpio                                      909     939     +30
print                                                 36      65     +29
cpio_o                                               804     832     +28
cpio_TRAILER                                           -      11     +11
packed_usage                                       30667   30662      -5
static.trailer                                        11       -     -11
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 4/1 up/down: 152/-16)           Total: 136 bytes

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodu: extra compat: with -k and -m, round sizes up
Denys Vlasenko [Thu, 15 Oct 2015 19:33:34 +0000 (21:33 +0200)]
du: extra compat: with -k and -m, round sizes up

function                                             old     new   delta
print                                                 36      65     +29

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agobetter pinger service example
Denys Vlasenko [Thu, 15 Oct 2015 00:10:11 +0000 (02:10 +0200)]
better pinger service example

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotop: make sort field for 's' mode less confusing
Denys Vlasenko [Wed, 14 Oct 2015 20:29:52 +0000 (22:29 +0200)]
top: make sort field for 's' mode less confusing

function                                             old     new   delta
display_topmem_process_list                          542     565     +23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibiproute: make rt_addr_n2a() and format_host() return auto strings
Denys Vlasenko [Wed, 14 Oct 2015 11:56:42 +0000 (13:56 +0200)]
libiproute: make rt_addr_n2a() and format_host() return auto strings

function                                             old     new   delta
rt_addr_n2a                                           56      53      -3
print_addrinfo                                      1227    1178     -49
print_neigh                                          933     881     -52
print_rule                                           689     617     -72
print_tunnel                                         640     560     -80
print_route                                         1727    1588    -139
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-395)           Total: -395 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibiproute: rename invarg(a,b) to invarg_1_to_2(a,b)
Denys Vlasenko [Wed, 14 Oct 2015 11:21:01 +0000 (13:21 +0200)]
libiproute: rename invarg(a,b) to invarg_1_to_2(a,b)

invarg(a,b) - "invalid argument", but how a and b enter the message?

invarg_1_to_2(a,b) is somewhat easier to read: "invalid argument 'a' to 'b'"

Audit of usage revealed a number of bad uses, with too long messages.

   text    data     bss     dec     hex filename
 938848     932   17448  957228   e9b2c busybox_old
 938788     932   17448  957168   e9af0 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agonetworking: add 'ip neigh' command
Curt Brune [Wed, 14 Oct 2015 10:53:47 +0000 (12:53 +0200)]
networking: add 'ip neigh' command

This patch ports the 'ip neigh' command, originally written by Alexey
Kuznetsov, <kuznet@ms2.inr.ac.ru>, to busybox.

The base of the port is the version of iproute that shipped with
Debian Squeeze, taken from:

  http://http.debian.net/debian/pool/main/i/iproute/iproute_20100519.orig.tar.gz

This patch has actively been used by the Open Network Install
Environment (ONIE) project for over 3 years without incident.

function                                             old     new   delta
print_neigh                                            -     933    +933
ipneigh_list_or_flush                                  -     742    +742
get_hz                                                 -     109    +109
do_ipneigh                                             -      62     +62
do_iproute                                          2112    2153     +41
packed_usage                                       30647   30667     +20
ipneigh_main                                           -      14     +14
static.ip_neigh_commands                               -      12     +12
static.nuds                                            -       9      +9
static.ip_func_ptrs                                   32      36      +4
print_route                                         1858    1727    -131
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 3/1 up/down: 1946/-131)        Total: 1815 bytes

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years ago*: more BUILD_BUG_ON conversions
Denys Vlasenko [Tue, 13 Oct 2015 15:17:34 +0000 (17:17 +0200)]
*: more BUILD_BUG_ON conversions

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agowget: shrink code if https isn't supported
Ron Yorston [Mon, 12 Oct 2015 09:51:25 +0000 (10:51 +0100)]
wget: shrink code if https isn't supported

If FEATURE_WGET_OPENSSL and FEATURE_WGET_SSL_HELPER are both disabled
there's no point in checking for https URLs.

function                                             old     new   delta
P_HTTPS                                                6       -      -6
.rodata                                           155501  155469     -32
parse_url                                            476     423     -53
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-91)             Total: -91 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: introduce kernel-style BUILD_BUG_ON()
Denys Vlasenko [Tue, 13 Oct 2015 12:50:20 +0000 (14:50 +0200)]
libbb: introduce kernel-style BUILD_BUG_ON()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoftpd: make DIR parameter work for non-root too: chdir to it instead of chroot
Denys Vlasenko [Tue, 13 Oct 2015 11:49:53 +0000 (13:49 +0200)]
ftpd: make DIR parameter work for non-root too: chdir to it instead of chroot

Unfortunately, chroot() works only for root user, because of attacks
on setuid binaries (make DIR/lib/ld-linux.so a shell, hardlink to
a setuid binary, chroot to DIR, execute it and get root shell).

function                                             old     new   delta
ftpd_main                                           2160    2180     +20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotypo fix in comment
Denys Vlasenko [Tue, 13 Oct 2015 10:34:35 +0000 (12:34 +0200)]
typo fix in comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agowhitespace fixes
Denys Vlasenko [Mon, 12 Oct 2015 23:51:37 +0000 (01:51 +0200)]
whitespace fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotypo fix
Denys Vlasenko [Mon, 12 Oct 2015 23:49:06 +0000 (01:49 +0200)]
typo fix

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: fix comment discrepancies
Denys Vlasenko [Mon, 12 Oct 2015 22:31:02 +0000 (00:31 +0200)]
libpwdgrp: fix comment discrepancies

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoStart 1.25.0 development cycle
Denys Vlasenko [Mon, 12 Oct 2015 12:33:46 +0000 (14:33 +0200)]
Start 1.25.0 development cycle

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoBump version to 1.24.0 1_24_0
Denys Vlasenko [Mon, 12 Oct 2015 12:33:03 +0000 (14:33 +0200)]
Bump version to 1.24.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibpwdgrp: do not require that /etc/passwd entries have nonempty home and shell
Denys Vlasenko [Mon, 12 Oct 2015 02:06:18 +0000 (04:06 +0200)]
libpwdgrp: do not require that /etc/passwd entries have nonempty home and shell

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agorandconfig fixes
Denys Vlasenko [Mon, 12 Oct 2015 01:15:36 +0000 (03:15 +0200)]
randconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agobuild system: remove special-casing for extra libs
Denys Vlasenko [Mon, 12 Oct 2015 01:12:17 +0000 (03:12 +0200)]
build system: remove special-casing for extra libs

It is not reliable (tried on three systems, multiple problems).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agorandconfig fixes
Denys Vlasenko [Sun, 11 Oct 2015 21:43:29 +0000 (23:43 +0200)]
randconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agohush: code shrink
Denys Vlasenko [Sun, 11 Oct 2015 19:47:11 +0000 (21:47 +0200)]
hush: code shrink

function                                             old     new   delta
builtin_wait                                         347     328     -19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agorandconfig fix
Denys Vlasenko [Sun, 11 Oct 2015 14:58:18 +0000 (16:58 +0200)]
randconfig fix

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agorandconfig fixes
Denys Vlasenko [Sun, 11 Oct 2015 14:27:55 +0000 (16:27 +0200)]
randconfig fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: shrink umask code
Denys Vlasenko [Sat, 10 Oct 2015 18:17:12 +0000 (20:17 +0200)]
ash: shrink umask code

function                                             old     new   delta
umaskcmd                                             258     248     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agouse auto_string() where appropriate to kill a few statics
Denys Vlasenko [Fri, 9 Oct 2015 16:16:40 +0000 (18:16 +0200)]
use auto_string() where appropriate to kill a few statics

Custom linker script 'busybox_ldscript' found, using it
function                                             old     new   delta
static.str                                             4       -      -4
static.passwd                                          4       0      -4
bb_ask                                               322     311     -11
ether_print                                           63      47     -16
UNSPEC_print                                          82      66     -16
INET_sprint                                           59      38     -21
INET6_sprint                                          54      30     -24
make_human_readable_str                              292     235     -57
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/7 up/down: 0/-153)           Total: -153 bytes
   text    data     bss     dec     hex filename
 939880     992   17480  958352   e9f90 busybox_old
 939736     992   17456  958184   e9ee8 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: auto_string() for efficient handling of temporary malloced stirngs
Denys Vlasenko [Fri, 9 Oct 2015 15:59:56 +0000 (17:59 +0200)]
libbb: auto_string() for efficient handling of temporary malloced stirngs

Use it in libiproute: get rid of one static string buffer.

function                                             old     new   delta
auto_string                                            -      51     +51
ll_index_to_name                                      10      49     +39
buffer_fill_and_print                                169     178      +9
scan_recursive                                       378     380      +2
decode_one_format                                    732     734      +2
cmdputs                                              334     332      -2
static.cur_saved                                       4       1      -3
static.nbuf                                           16       -     -16
printable_string                                      94      57     -37
ll_idx_n2a                                            53       -     -53
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 4/3 up/down: 103/-111)           Total: -8 bytes
   text    data     bss     dec     hex filename
 939880     992   17496  958368   e9fa0 busybox_old
 939880     992   17480  958352   e9f90 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoremove global "jmp_buf die_jmp" from !FEATURE_PREFER_APPLETS builds
Denys Vlasenko [Fri, 9 Oct 2015 14:42:57 +0000 (16:42 +0200)]
remove global "jmp_buf die_jmp" from !FEATURE_PREFER_APPLETS builds

function                                             old     new   delta
xfunc_has_died                                         -      21     +21
sleep_much                                             -      12     +12
sleep10                                                -       9      +9
die_func                                               -       4      +4
fflush_stdout_and_exit                                35      36      +1
builtin_type                                         121     119      -2
die_sleep                                              4       -      -4
xfunc_die                                             60      24     -36
hush_main                                           1128    1011    -117
die_jmp                                              156       -    -156
------------------------------------------------------------------------------
(add/remove: 4/2 grow/shrink: 1/3 up/down: 47/-315)          Total: -268 bytes
   text    data     bss     dec     hex filename
 939992     992   17652  958636   ea0ac busybox_old
 939880     992   17496  958368   e9fa0 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: "you have mail" should ignore first change in mtime
Denys Vlasenko [Fri, 9 Oct 2015 14:02:53 +0000 (16:02 +0200)]
ash: "you have mail" should ignore first change in mtime

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: simplify "you have mail" code
Denys Vlasenko [Fri, 9 Oct 2015 13:52:03 +0000 (15:52 +0200)]
ash: simplify "you have mail" code

function                                             old     new   delta
mailtime_hash                                          -       4      +4
redirect                                            1282    1280      -2
mailtime                                              40       -     -40
cmdloop                                              429     378     -51
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 4/-93)             Total: -89 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: make dowait() a bit more readable. Logic is unchanged
Denys Vlasenko [Fri, 9 Oct 2015 13:40:13 +0000 (15:40 +0200)]
ash: make dowait() a bit more readable. Logic is unchanged

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoupdated android_ndk_defconfig
Denys Vlasenko [Thu, 8 Oct 2015 16:17:31 +0000 (18:17 +0200)]
updated android_ndk_defconfig

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoudhcpc: fix for some Android toolchain breakage
Denys Vlasenko [Thu, 8 Oct 2015 16:13:57 +0000 (18:13 +0200)]
udhcpc: fix for some Android toolchain breakage

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoiproute: more string reuse
Denys Vlasenko [Thu, 8 Oct 2015 15:15:08 +0000 (17:15 +0200)]
iproute: more string reuse

   text    data     bss     dec     hex filename
 936892     932   17676  955500   e946c busybox_old
 936843     932   17676  955451   e943b busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoiproute: don't hardcode the path to config files
Christoph J. Thompson [Thu, 8 Oct 2015 15:06:06 +0000 (17:06 +0200)]
iproute: don't hardcode the path to config files

Allows using an alternate path for config files.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Christoph J. Thompson <cjsthompson@gmail.com>
Signed-off-by: Michael Bestas <mikeioannina@gmail.com>
9 years agoip: increased max ID for /etc/iproute2/rt_tables to 1023
Denys Vlasenko [Thu, 8 Oct 2015 13:10:10 +0000 (15:10 +0200)]
ip: increased max ID for  /etc/iproute2/rt_tables to 1023

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibiproute: use itoa() where appropriate
Denys Vlasenko [Thu, 8 Oct 2015 11:02:28 +0000 (13:02 +0200)]
libiproute: use itoa() where appropriate

function                                             old     new   delta
rtnl_rtprot_a2n                                       31      88     +57
print_tunnel                                         647     640      -7
print_route                                         1865    1858      -7
print_linkinfo                                       820     812      -8
print_addrinfo                                      1241    1227     -14
rtnl_rttable_n2a                                      53      38     -15
rtnl_rtscope_n2a                                      53      38     -15
rtnl_rtrealm_n2a                                      53      38     -15
rtnl_dsfield_n2a                                      61      38     -23
rtnl_rtntype_n2a                                     118      89     -29
print_rule                                           724     689     -35
ipaddr_list_or_flush                                1293    1253     -40
rtnl_rtprot_n2a                                       53       -     -53
rtnl_rtprot_initialize                                63       -     -63
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/11 up/down: 57/-324)         Total: -267 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agojoin some common strings, -400 bytes
Denys Vlasenko [Thu, 8 Oct 2015 09:24:44 +0000 (11:24 +0200)]
join some common strings, -400 bytes

function                                             old     new   delta
print_intel_cstates                                  499     511     +12
file_insert                                          355     364      +9
dpkg_main                                           2944    2940      -4
ifenslave_main                                       645     640      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 21/-9)              Total: 12 bytes
   text    data     bss     dec     hex filename
 937564     932   17676  956172   e970c busybox_old
 937164     932   17676  955772   e957c busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agobuild system: -fno-builtin-printf
Denys Vlasenko [Wed, 7 Oct 2015 20:42:45 +0000 (22:42 +0200)]
build system: -fno-builtin-printf

Benefits are: drops reference to out-of-line putchar(), fixes a few cases
of failed string merge.

function                                             old     new   delta
i2cdump_main                                        1488    1502     +14
sha256_process_block64                               423     433     +10
sendmail_main                                       1183    1185      +2
list_table                                          1114    1116      +2
i2cdetect_main                                      1235    1237      +2
fdisk_main                                          2852    2854      +2
builtin_type                                         119     121      +2
unicode_conv_to_printable2                           325     324      -1
scan_recursive                                       380     378      -2
mkfs_minix_main                                     2687    2684      -3
buffer_fill_and_print                                178     169      -9
putchar                                              152       -    -152
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 7/4 up/down: 34/-167)          Total: -133 bytes
   text    data     bss     dec     hex filename
 937788     932   17676  956396   e97ec busybox_old
 937564     932   17676  956172   e970c busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofind: support "find . -delete" idiom - do not try rmdir(".")
Denys Vlasenko [Wed, 7 Oct 2015 19:01:47 +0000 (21:01 +0200)]
find: support "find . -delete" idiom - do not try rmdir(".")

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomd5sum: code shrink
Denys Vlasenko [Wed, 7 Oct 2015 17:17:01 +0000 (19:17 +0200)]
md5sum: code shrink

For CONFIG_MD5_SMALL=1:
function                                             old     new   delta
md5_process_block64                                  925     881     -44

For CONFIG_MD5_SMALL=0:
function                                             old     new   delta
md5_process_block64                                 1603    1586     -17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: use a more typical form of "print four octal digits" format
Denys Vlasenko [Wed, 7 Oct 2015 15:57:53 +0000 (17:57 +0200)]
ash: use a more typical form of "print four octal digits" format

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: more compact API for bb_parse_mode()
Denys Vlasenko [Wed, 7 Oct 2015 15:55:33 +0000 (17:55 +0200)]
libbb: more compact API for bb_parse_mode()

function                                             old     new   delta
make_device                                         2182    2188      +6
parse_command                                       1440    1443      +3
parse_params                                        1497    1499      +2
install_main                                         773     769      -4
mkdir_main                                           168     160      -8
getoptscmd                                           641     632      -9
builtin_umask                                        158     147     -11
bb_parse_mode                                        431     410     -21
umaskcmd                                             286     258     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/6 up/down: 11/-81)            Total: -70 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: shrink "umask -S" code
Denys Vlasenko [Wed, 7 Oct 2015 15:32:56 +0000 (17:32 +0200)]
ash: shrink "umask -S" code

function                                             old     new   delta
umaskcmd                                             279     286      +7
static.permmode                                        3       -      -3
static.permmask                                       18       -     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agohush: fix umask: umask(022) was setting umask(755)
Denys Vlasenko [Wed, 7 Oct 2015 14:56:20 +0000 (16:56 +0200)]
hush: fix umask: umask(022) was setting umask(755)

Based on the patch by Rich Felker <dalias@libc.org>

function                                             old     new   delta
builtin_umask                                        121     161     +40
umaskcmd                                             318     279     -39

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: a bunch of trivial simplifications
Denys Vlasenko [Wed, 7 Oct 2015 13:44:36 +0000 (15:44 +0200)]
ash: a bunch of trivial simplifications

Also, in a few places made code more reliable wrt large sizeof(int)
and sizeof(arith_t)..

function                                             old     new   delta
sprint_status48                                        -     143    +143
newline_and_flush                                      -      56     +56
showjob                                              365     382     +17
parse_command                                       1440    1443      +3
cmdputs                                              334     332      -2
cmdloop                                              434     429      -5
showjobs                                              70      64      -6
fg_bgcmd                                             296     290      -6
ash_vmsg                                             159     153      -6
ash_main                                            1487    1481      -6
jobscmd                                               94      82     -12
getoptscmd                                           687     632     -55
outcslow                                              56       -     -56
sprint_status                                        156       -    -156
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/8 up/down: 219/-310)          Total: -91 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agowget: make it possible to have both SSL helpers configured
Denys Vlasenko [Wed, 7 Oct 2015 00:40:53 +0000 (02:40 +0200)]
wget: make it possible to have both SSL helpers configured

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoifplugd: discovered why it needed net/ethernet.h: just for ETH_ALEN
Denys Vlasenko [Wed, 7 Oct 2015 00:02:56 +0000 (02:02 +0200)]
ifplugd: discovered why it needed net/ethernet.h: just for ETH_ALEN

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agossl_helper: tweaks discovered while building 32-bit version
Denys Vlasenko [Wed, 7 Oct 2015 00:00:11 +0000 (02:00 +0200)]
ssl_helper: tweaks discovered while building 32-bit version

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agowget: make openssl/ssl_helper choice configurable
Denys Vlasenko [Tue, 6 Oct 2015 23:39:40 +0000 (01:39 +0200)]
wget: make openssl/ssl_helper choice configurable

I got sick of not being able to wget a https file...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoqemu testing: extract_od_binary.sh: support huge files (and broken od)
Denys Vlasenko [Mon, 5 Oct 2015 14:46:29 +0000 (16:46 +0200)]
qemu testing: extract_od_binary.sh: support huge files (and broken od)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agouudecode: tolerate text input with CR+LF line ends
Denys Vlasenko [Mon, 5 Oct 2015 13:10:44 +0000 (15:10 +0200)]
uudecode: tolerate text input with CR+LF line ends

function                                             old     new   delta
read_stduu                                           265     308     +43
uudecode_main                                        313     317      +4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoqemu testing: Do build brctl and ifplugd; force mips32 dialect
Denys Vlasenko [Mon, 5 Oct 2015 10:43:04 +0000 (12:43 +0200)]
qemu testing: Do build brctl and ifplugd; force mips32 dialect

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoqemu testing: fix hexdumping of binary
Denys Vlasenko [Mon, 5 Oct 2015 10:34:24 +0000 (12:34 +0200)]
qemu testing: fix hexdumping of binary

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoAboriginal linux/musl build fixes
Denys Vlasenko [Mon, 5 Oct 2015 09:15:43 +0000 (11:15 +0200)]
Aboriginal linux/musl build fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoAdd qemu_multiarch_testing/
Denys Vlasenko [Mon, 5 Oct 2015 07:04:04 +0000 (09:04 +0200)]
Add qemu_multiarch_testing/

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoawk: support "length" form of "length()". Closes 8371
Denys Vlasenko [Fri, 2 Oct 2015 00:41:39 +0000 (02:41 +0200)]
awk: support "length" form of "length()". Closes 8371

function                                             old     new   delta
parse_expr                                           805     848     +43
tokenlist                                            447     448      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoumount: always use umount2 syscall with specified flags
Denys Vlasenko [Thu, 1 Oct 2015 16:50:06 +0000 (18:50 +0200)]
umount: always use umount2 syscall with specified flags

Make umount -f more compatible with util-linux 2.22.2.

Before:
  * 'umount -f': calls umount syscall,
        if it fails calls umount2 with 'MNT_FORCE'
  * 'mount -f -l': calls umount syscall,
        if it fails calls umount2 with 'MNT_LAZY'. 'MNT_FORCE' dropped
After:
  * 'umount -f': calls umount2 syscall with 'MNT_FORCE'
  * 'mount -f -l': calls umount2 syscall with 'MNT_LAZY' and 'MNT_FORCE'

function                                             old     new   delta
umount                                                45       -     -45
umount_main                                          610     555     -55

Signed-off-by: Anton Bondarenko <anton.bondarenko@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoadduser: fix help text
Denys Vlasenko [Mon, 21 Sep 2015 19:11:12 +0000 (21:11 +0200)]
adduser: fix help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoadduser: Add -k /path/to/skel
Bernhard Reutner-Fischer [Mon, 25 May 2015 21:25:19 +0000 (23:25 +0200)]
adduser: Add -k /path/to/skel

function                                             old     new   delta
.rodata                                           157069  157133     +64
adduser_main                                         921     936     +15
adduser_longopts                                     103     110      +7
packed_usage                                       30230   30236      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 92/0)               Total: 92 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoi2c-tools: rename remaining defines
Bartosz Golaszewski [Fri, 4 Sep 2015 08:38:48 +0000 (10:38 +0200)]
i2c-tools: rename remaining defines

Rename the defines not present in linux UAPI headers to better reflect
their purpose.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoi2c-tools: remove duplicate definitions
Bartosz Golaszewski [Fri, 4 Sep 2015 08:35:22 +0000 (10:35 +0200)]
i2c-tools: remove duplicate definitions

Most applets include linux' user API headers instead of duplicating
the definitions. Make it the case for i2c-tools as well.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agosort: fix -kN,M handling (was including last separator into the comparison)
Denys Vlasenko [Sat, 19 Sep 2015 20:06:40 +0000 (22:06 +0200)]
sort: fix -kN,M handling (was including last separator into the comparison)

Testcase:

$ printf '%s\n' a/a:a a:b | sort -t: -k1,1
a:b
a/a:a

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: another unit test for is_suffixed_with
Tito Ragusa [Tue, 15 Sep 2015 21:38:01 +0000 (23:38 +0200)]
libbb: another unit test for is_suffixed_with

Suggested by Bartosz Golaszewski.

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodprobe: handle module arguments containing spaces
Peter Korsgaard [Wed, 9 Sep 2015 12:55:07 +0000 (14:55 +0200)]
modprobe: handle module arguments containing spaces

Modprobe wasn't correctly parsing module arguments containing spaces from
/proc/cmdline - E.G. module.property="some text".

Extend the parsing to correctly handle quoted text.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: fix slash treatment in expmeta
Ron Yorston [Fri, 4 Sep 2015 09:32:41 +0000 (10:32 +0100)]
ash: fix slash treatment in expmeta

Commit 549deab caused this sequence of commands:

   mkdir foo
   cd foo
   touch a b
   echo "./"*

to return './*' instead of the expected './a ./b'.  The problem
was caused by the backport of commit 880d952 from dash.  In dash
the issue was fixed by two further commits by Herbert Xu:

<d6d06ff> [EXPAND] Fixed non-leading slash treatment in expmeta
<36f0fa8> [EXPAND] Fix slash treatment in expmeta

(See git://git.kernel.org/pub/scm/utils/dash/dash.git)

Apply these fixes to BusyBox ash, thus causing the new test
glob3.tests to succeed.

function                                             old     new   delta
expmeta                                              469     528     +59

Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agohush: fix a nommu bug where a part of function body is lost if run in a pipe
Denys Vlasenko [Fri, 4 Sep 2015 04:22:10 +0000 (06:22 +0200)]
hush: fix a nommu bug where a part of function body is lost if run in a pipe

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoMakefile.flags: survive a build system which has no pthread
Denys Vlasenko [Fri, 4 Sep 2015 02:20:51 +0000 (04:20 +0200)]
Makefile.flags: survive a build system which has no pthread

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash,hush: add a test which fails for ash since commit 549deab
Denys Vlasenko [Fri, 4 Sep 2015 01:33:02 +0000 (03:33 +0200)]
ash,hush: add a test which fails for ash since commit 549deab

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: add tests adapted from hush glob tests. glob2.tests currently fails
Denys Vlasenko [Fri, 4 Sep 2015 01:27:08 +0000 (03:27 +0200)]
ash: add tests adapted from hush glob tests. glob2.tests currently fails

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: make is_suffixed_with() return pointer inside string, not key.
Denys Vlasenko [Tue, 25 Aug 2015 19:47:33 +0000 (21:47 +0200)]
libbb: make is_suffixed_with() return pointer inside string, not key.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: add is_suffixed_with() function
Bartosz Golaszewski [Tue, 25 Aug 2015 14:36:43 +0000 (16:36 +0200)]
libbb: add is_suffixed_with() function

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoping: fix recently introduced build breakage for non-optimizing builds
Denys Vlasenko [Tue, 25 Aug 2015 14:26:31 +0000 (16:26 +0200)]
ping: fix recently introduced build breakage for non-optimizing builds

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: add a comment describing the way is_prefixed_with() works
Bartosz Golaszewski [Tue, 25 Aug 2015 11:10:00 +0000 (13:10 +0200)]
libbb: add a comment describing the way is_prefixed_with() works

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: add unit tests for is_prefixed_with()
Bartosz Golaszewski [Tue, 25 Aug 2015 11:09:59 +0000 (13:09 +0200)]
libbb: add unit tests for is_prefixed_with()

Test corner cases too like looking for an empty prefix etc.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agologin: don't print motd if .hushlogin exists in users home
Sören Tempel [Mon, 24 Aug 2015 20:16:48 +0000 (22:16 +0200)]
login: don't print motd if .hushlogin exists in users home

function                                             old     new   delta
login_main                                           978     996     +18

Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>