oweals/busybox.git
9 years agoi2cdetect: fix address skipping in auto mode
Bartosz Golaszewski [Tue, 27 Oct 2015 16:15:00 +0000 (17:15 +0100)]
i2cdetect: fix address skipping in auto mode

If the bus doesn't support SMBus Quick Write or Receive Byte commands
and we're running in auto mode all addresses will be skipped resulting
in an empty table being printed.

This is caused by not restoring the auto mode after it's been changed
for certain address ranges - we need an additional variable to hold the
temporary state.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoifupdown: use -x hostname:NAME with udhcpc
Natanael Copa [Wed, 19 Sep 2012 14:55:08 +0000 (16:55 +0200)]
ifupdown: use -x hostname:NAME with udhcpc

The -H NAME is deprecated in udhcpc. See commit
2017d48c0d70bef8768efb42909e605ea8eb5a21

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years ago[g]unzip: fix recent breakage.
Denys Vlasenko [Fri, 30 Oct 2015 22:41:53 +0000 (23:41 +0100)]
[g]unzip: fix recent breakage.

Also, do emit error message we so painstakingly pass from gzip internals

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: allow popredir to be called if the stack is empty
Ron Yorston [Fri, 30 Oct 2015 19:07:37 +0000 (19:07 +0000)]
ash: allow popredir to be called if the stack is empty

If /tmp/test.sh is a script that tries to run a second script which
happens to be non-executable this:

   command . /tmp/test.sh

causes a seg fault.

This is because clearredir is called in the error path to clear the
stack of redirections.  The normal path then calls popredir, but popredir
fails when the stack is empty.

Reported-by: Bastian Bittorf <bittorf@bluebottle.com>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: fix EXEXEC status clobbering
Ron Yorston [Fri, 30 Oct 2015 19:06:47 +0000 (19:06 +0000)]
ash: fix EXEXEC status clobbering

evalcommand always clobbers the exit status in case of an EXEXEC
which means that exec always fails with exit status 2 regardless
of what it actually returns.

This patch adds the missing check for EXEXEC so that the correct
exit status is preserved.  It causes the test ash-misc/exec.tests
to succeed.

Based on commit 7f68426 in dash git, by Herbert Xu.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: add tests for failures of the exec and command builtins
Ron Yorston [Fri, 30 Oct 2015 19:05:55 +0000 (19:05 +0000)]
ash: add tests for failures of the exec and command builtins

The exec builtin should return an exit status of 127 if the command
can't be found.  It doesn't:  it returns 2.

If the command builtin is used to source a script that runs a second
script that doesn't exist ash should issue an error.  Instead it seg
faults.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agostat: make -f optional. This allows to build stat for non-linux systems
Denys Vlasenko [Fri, 30 Oct 2015 21:10:44 +0000 (22:10 +0100)]
stat: make -f optional. This allows to build stat for non-linux systems

function                                             old     new   delta
packed_usage                                       30761   30706     -55

Based on the patch by Ron Yorston.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolineedit: FEATURE_REVERSE_SEARCH should not depend on SAVEHISTORY
Denys Vlasenko [Fri, 30 Oct 2015 20:39:19 +0000 (21:39 +0100)]
lineedit: FEATURE_REVERSE_SEARCH should not depend on SAVEHISTORY

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolineedit: search applets as well as PATH for tab completion
Ron Yorston [Fri, 29 May 2015 10:31:40 +0000 (11:31 +0100)]
lineedit: search applets as well as PATH for tab completion

In standalone shell mode search the applet table as well as PATH
when tab completing a command.

Use a stupid linear search:  we're also about to read all the
directories on PATH so efficiency isn't a big concern.

function                                             old     new   delta
add_match                                              -      53     +53
complete_cmd_dir_file                                687     724     +37
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 90/0)               Total: 90 bytes

Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agobusybox: alter help message in standalone shell mode
Ron Yorston [Sat, 30 May 2015 16:13:52 +0000 (17:13 +0100)]
busybox: alter help message in standalone shell mode

Signed-off-by: Ron Yorston <rmy@frippery.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agohush: copy for.tests from ash testsuite
Denys Vlasenko [Thu, 29 Oct 2015 21:37:25 +0000 (22:37 +0100)]
hush: copy for.tests from ash testsuite

This test passes for hush

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: simplify EOF/newline handling in list parser
Ron Yorston [Thu, 29 Oct 2015 11:30:55 +0000 (11:30 +0000)]
ash: simplify EOF/newline handling in list parser

Processing of here documents in ash has had a couple of breakages
which are now the subject of tests.  This commit should fix both.

It is based on the following commit in dash git by Herbert Xu:

   <7c245aa> [PARSER] Simplify EOF/newline handling in list parser

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

Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoRevert "ash: fix a SEGV case in an invalid heredoc" xxx
Ron Yorston [Thu, 29 Oct 2015 11:30:22 +0000 (11:30 +0000)]
Revert "ash: fix a SEGV case in an invalid heredoc" xxx

This reverts commit 7e66102f762a7d80715f0c7e5925433256b78cee but
leaves the test in place as it's still valid.

Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: fix error during recursive processing of here document
Ron Yorston [Thu, 29 Oct 2015 16:44:56 +0000 (16:44 +0000)]
ash: fix error during recursive processing of here document

Save the value of the checkkwd flag to prevent it being clobbered
during recursion.

Based on commit ec2c84d from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu.

function                                             old     new   delta
readtoken                                            190     203     +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0)               Total: 13 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash tests: make test print test name before it is run
Denys Vlasenko [Thu, 29 Oct 2015 19:29:05 +0000 (20:29 +0100)]
ash tests: make test print test name before it is run

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: only allow local variables in functions
Ron Yorston [Thu, 29 Oct 2015 16:19:14 +0000 (16:19 +0000)]
ash: only allow local variables in functions

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: respect -p flag when command builtin is run with -v/-V
Ron Yorston [Mon, 3 Aug 2015 12:47:33 +0000 (13:47 +0100)]
ash: respect -p flag when command builtin is run with -v/-V

The command builtin should only check the default path, not $PATH,
when the -p flag is used along with -v/-V.

Based on commits 65ae84b (by Harald van Dijk) and 29ee27d (by Herbert
Xu) from git://git.kernel.org/pub/scm/utils/dash/dash.git).

function                                             old     new   delta
commandcmd                                            72      87     +15
describe_command                                     437     450     +13
typecmd                                               84      86      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 30/0)               Total: 30 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: fix command -- crash
Denys Vlasenko [Thu, 29 Oct 2015 18:46:40 +0000 (19:46 +0100)]
ash: fix command -- crash

busybox sh -c 'command --' segfaults because parse_command_args
returns a pointer to a null pointer.

Based on commit 18071c7 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Gerrit Pape.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: save a few bytes in code to parse case statements
Ron Yorston [Mon, 3 Aug 2015 12:46:25 +0000 (13:46 +0100)]
ash: save a few bytes in code to parse case statements

Based on commit 49b82fc from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu.

function                                             old     new   delta
parse_command                                       1563    1555      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8)               Total: -8 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: allow newline after variable name in for loop
Ron Yorston [Mon, 3 Aug 2015 12:46:00 +0000 (13:46 +0100)]
ash: allow newline after variable name in for loop

Newline is a valid delimiter between the variable name and `in`
keyword in for loops.

Based on commit 22e8fb4 from git://git.kernel.org/pub/scm/utils/dash/dash.git
by Herbert Xu.

function                                             old     new   delta
parse_command                                       1568    1563      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5)               Total: -5 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoash: add test for issue with here document
Ron Yorston [Thu, 29 Oct 2015 11:29:59 +0000 (11:29 +0000)]
ash: add test for issue with here document

This used to work but doesn't now:

foo () {
cat <<EOF && { echo "$1" ; }
$1
EOF
}

foo "bar"

Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agomodinfo: fix "-F firmware", add "intree" field display
Denys Vlasenko [Wed, 28 Oct 2015 17:07:46 +0000 (18:07 +0100)]
modinfo: fix "-F firmware", add "intree" field display

function                                             old     new   delta
shortcuts                                              -      52     +52
modinfo                                              317     330     +13
display                                               77      87     +10
packed_usage                                       30752   30761      +9
modinfo_main                                         351     345      -6
static.shortcuts                                      48       -     -48
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 3/1 up/down: 84/-54)             Total: 30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolzop: eliminate variable, use "int" as return type
Denys Vlasenko [Wed, 28 Oct 2015 14:33:19 +0000 (15:33 +0100)]
lzop: eliminate variable, use "int" as return type

Based on patch by Maxin B. John <maxin.john@intel.com>

function                                             old     new   delta
pack_lzop                                            870     859     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agofbsplash: use virtual y size in mmap size calculations
Timo Teräs [Mon, 26 Oct 2015 07:40:31 +0000 (09:40 +0200)]
fbsplash: use virtual y size in mmap size calculations

The virtual y can be larger - and we can be even writing there since
we are taking into account the y offset. Avoids possible crash.
But use it only if set, seems it is not set if virtual area is not
allocated (though, often fbcon allocates some scrollback area).

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agogzip: add support for --no-name long option
Aaro Koskinen [Mon, 26 Oct 2015 21:42:33 +0000 (23:42 +0200)]
gzip: add support for --no-name long option

Add support for --no-name long option. Just silently ignore it
like the short -n option.

This allows to use busybox gzip with Lynx browser.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agogunzip: add support for long options
Aaro Koskinen [Mon, 26 Oct 2015 21:42:32 +0000 (23:42 +0200)]
gunzip: add support for long options

Add support for long options.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agounzip: test for bad archive SEGVing
Denys Vlasenko [Mon, 26 Oct 2015 18:33:05 +0000 (19:33 +0100)]
unzip: test for bad archive SEGVing

function                                             old     new   delta
huft_build                                          1296    1300      +4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotr: support octal ranges
Richard Genoud [Mon, 26 Oct 2015 09:10:28 +0000 (10:10 +0100)]
tr: support octal ranges

now, we can do printf "a\tb\tcdef\n" | ./busybox tr -d "\1-\14b-e"
af

and bonus, we save some bytes.

function                                             old     new   delta
expand                                               718     699     -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-19)             Total: -19
bytes

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoifupdown: pass interface device name for ipv6 route commands
Timo Teräs [Mon, 26 Oct 2015 16:06:12 +0000 (17:06 +0100)]
ifupdown: pass interface device name for ipv6 route commands

IPv6 routes need the device argument for link-local routes, or they
cannot be used at all. E.g. "gateway fe80::def" seems to be used in
some places, but kernel refuses to insert the route unless device
name is explicitly specified in the route addition.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotweak defconfig
Denys Vlasenko [Sun, 25 Oct 2015 19:36:03 +0000 (20:36 +0100)]
tweak defconfig

MONOTONIC_SYSCALL=y by default

FEATURE_LAST_SMALL is gone: now FEATURE_LAST_FANCY is a "bool", not a "choice".

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoinetd: make FEATURE_INETD_RPC off by default
Denys Vlasenko [Sun, 25 Oct 2015 19:10:46 +0000 (20:10 +0100)]
inetd: make FEATURE_INETD_RPC off by default

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibiproute: use if_nametoindex
Ron Yorston [Wed, 21 Oct 2015 15:57:25 +0000 (16:57 +0100)]
libiproute: use if_nametoindex

Saves 87 bytes.  Assuming, of course, all platforms have it.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoxargs: make -I imply -r
Aaro Koskinen [Sat, 24 Oct 2015 20:01:29 +0000 (22:01 +0200)]
xargs: make -I imply -r

Make -I imply -r (GNU findutils seems to do the same).

Fixes the following bug:

        $ echo -n | xargs -I% echo %
        Segmentation fault

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodumpleases: string reuse
Denys Vlasenko [Sat, 24 Oct 2015 18:45:10 +0000 (20:45 +0200)]
dumpleases: string reuse

   text    data     bss     dec     hex filename
 926254     906   17160  944320   e68c0 busybox_old
 926242     906   17160  944308   e68b4 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodumpleases: new option -d to show time in seconds
Isaac Dunham [Sat, 24 Oct 2015 18:28:04 +0000 (20:28 +0200)]
dumpleases: new option -d to show time in seconds

function                                             old     new   delta
dumpleases_main                                      493     534     +41
static.dumpleases_longopts                            31      41     +10
packed_usage                                       30777   30752     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 51/-25)             Total: 26 bytes

Signed-off-by: Isaac Dunham <ibid.ag@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agozcip: ...ad suppress the warning
Denys Vlasenko [Sat, 24 Oct 2015 17:15:44 +0000 (19:15 +0200)]
zcip: ...ad suppress the warning

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agozcip: do not query current time if we won't use the result
Denys Vlasenko [Sat, 24 Oct 2015 17:14:04 +0000 (19:14 +0200)]
zcip: do not query current time if we won't use the result

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotweak zcip service example
Denys Vlasenko [Sat, 24 Oct 2015 16:57:32 +0000 (18:57 +0200)]
tweak zcip service example

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoTweak README
Denys Vlasenko [Sat, 24 Oct 2015 12:58:58 +0000 (14:58 +0200)]
Tweak README

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoupdate network service examples
Denys Vlasenko [Sat, 24 Oct 2015 12:55:33 +0000 (14:55 +0200)]
update network service examples

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoNew example of a service: examples/var_service/zcip_if
Denys Vlasenko [Sat, 24 Oct 2015 03:30:58 +0000 (05:30 +0200)]
New example of a service: examples/var_service/zcip_if

Zeroconf for IPv4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agodumpleases: make host names sanitized to shell-friendly condition
Denys Vlasenko [Sat, 24 Oct 2015 02:45:22 +0000 (04:45 +0200)]
dumpleases: make host names sanitized to shell-friendly condition

function                                             old     new   delta
add_lease                                            271     298     +27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoreuse a string
Denys Vlasenko [Sat, 24 Oct 2015 02:19:56 +0000 (04:19 +0200)]
reuse a string

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agormmod: fix bad error message
Denys Vlasenko [Sat, 24 Oct 2015 02:17:04 +0000 (04:17 +0200)]
rmmod: fix bad error message

    Before:

    ># busybox_old rmmod gtrhfhdfghdf
    rmmod: can't unload 'gtrhfhdfghdf': unknown symbol in module, or unknown parameter

    After:

    ># busybox rmmod gtrhfhdfghdf
    rmmod: can't unload module 'gtrhfhdfghdf': No such file or directory

function                                             old     new   delta
modprobe_main                                        726     721      -5
do_modprobe                                          599     590      -9
rmmod_main                                           187     169     -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-32)             Total: -32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoMODPROBE_SMALL is not experimental anymore
Denys Vlasenko [Sat, 24 Oct 2015 02:13:16 +0000 (04:13 +0200)]
MODPROBE_SMALL is not experimental anymore

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agopmap: fix bogus {no such process} comm field text
Denys Vlasenko [Sat, 24 Oct 2015 01:45:57 +0000 (03:45 +0200)]
pmap: fix bogus {no such process} comm field text

function                                             old     new   delta
read_cmdline                                         246     266     +20
procps_get_maps                                      196     193      -3
packed_usage                                       30413   30404      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 20/-12)              Total: 8 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotidy up strtok use
Denys Vlasenko [Fri, 23 Oct 2015 16:43:16 +0000 (18:43 +0200)]
tidy up strtok use

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agohttpd: fix heap buffer overflow. Closes 8426
Denys Vlasenko [Fri, 23 Oct 2015 09:49:04 +0000 (11:49 +0200)]
httpd: fix heap buffer overflow. Closes 8426

function                                             old     new   delta
send_headers                                         654     677     +23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agowget: if stderr is not a tty, progress bar shouldn't use tty-tricks
Denys Vlasenko [Fri, 23 Oct 2015 00:01:38 +0000 (02:01 +0200)]
wget: if stderr is not a tty, progress bar shouldn't use tty-tricks

function                                             old     new   delta
bb_progress_update                                   706     768     +62

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agolibbb: factor out code which queries screen width
Denys Vlasenko [Thu, 22 Oct 2015 23:44:22 +0000 (01:44 +0200)]
libbb: factor out code which queries screen width

function                                             old     new   delta
get_terminal_width                                     -      17     +17
stty_main                                           1196    1197      +1
pstree_main                                          321     319      -2
ls_main                                              735     731      -4
watch_main                                           232     225      -7
bb_progress_update                                   714     706      -8
ps_main                                              555     543     -12
run_applet_and_exit                                  708     695     -13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 18/-46)            Total: -28 byte

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotar: add a test that we don't write into symlinks
Denys Vlasenko [Thu, 22 Oct 2015 14:37:01 +0000 (16:37 +0200)]
tar: add a test that we don't write into symlinks

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agoremove systemd support
Denys Vlasenko [Thu, 22 Oct 2015 14:01:57 +0000 (16:01 +0200)]
remove systemd support

systemd people are not willing to play nice with the rest of the world.
Therefore there is no reason for the rest of the world to cooperate with them.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotar: fix files skipped with --strip_components not resetting selinux context
Denys Vlasenko [Thu, 22 Oct 2015 11:38:09 +0000 (13:38 +0200)]
tar: fix files skipped with --strip_components not resetting selinux context

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 years agotar: shrink hardlink name handling code
Denys Vlasenko [Thu, 22 Oct 2015 11:30:34 +0000 (13:30 +0200)]
tar: shrink hardlink name handling code

function                                             old     new   delta
data_extract_all                                    1069    1040     -29

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>