oweals/busybox.git
10 years agoash: make "locak VAR" unset VAR (bash does that)
Denys Vlasenko [Sun, 16 Mar 2014 17:41:11 +0000 (18:41 +0100)]
ash: make "locak VAR" unset VAR (bash does that)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoscript: make it work even if fd 0 is closed
Denys Vlasenko [Sun, 16 Mar 2014 11:34:53 +0000 (12:34 +0100)]
script: make it work even if fd 0 is closed

Testcase:
script -q -c "echo hey" /dev/null 0>&-

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: for "find", use POSIX not operator (!) instead of -not
Denys Vlasenko [Sun, 16 Mar 2014 11:05:58 +0000 (12:05 +0100)]
build system: for "find", use POSIX not operator (!) instead of -not

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosu: add a delay if the password is incorrect
Romain Naour [Sun, 16 Mar 2014 10:18:19 +0000 (11:18 +0100)]
su: add a delay if the password is incorrect

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash,hush: fix a thinko about 2^64-1 factorization
Denys Vlasenko [Sat, 15 Mar 2014 08:25:46 +0000 (09:25 +0100)]
ash,hush: fix a thinko about 2^64-1 factorization

function                                             old     new   delta
next_random                                          113     119      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agohush: make "true" built-in
Denys Vlasenko [Fri, 14 Mar 2014 11:43:57 +0000 (12:43 +0100)]
hush: make "true" built-in

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agorandom: cosmetic tweaks in debug code
Denys Vlasenko [Thu, 13 Mar 2014 12:03:27 +0000 (13:03 +0100)]
random: cosmetic tweaks in debug code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash,hush: improve randomness of $RANDOM, add easy-ish way to test it
Denys Vlasenko [Thu, 13 Mar 2014 11:52:43 +0000 (12:52 +0100)]
ash,hush: improve randomness of $RANDOM, add easy-ish way to test it

function                                             old     new   delta
next_random                                           68     113     +45
change_random                                        103     121     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: trim help text
Denys Vlasenko [Fri, 7 Mar 2014 13:41:53 +0000 (14:41 +0100)]
shuf: trim help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: do not use strings for -i RANGE case
Denys Vlasenko [Fri, 7 Mar 2014 13:32:39 +0000 (14:32 +0100)]
shuf: do not use strings for -i RANGE case

function                                             old     new   delta
shuf_main                                            482     496     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: improve help text
Bartosz Golaszewski [Fri, 7 Mar 2014 13:07:35 +0000 (14:07 +0100)]
shuf: improve help text

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: fix a segfault on 'shuf -e'
Bartosz Golaszewski [Fri, 7 Mar 2014 10:46:03 +0000 (11:46 +0100)]
shuf: fix a segfault on 'shuf -e'

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agouse [s]rand(), not [s]random()
Denys Vlasenko [Wed, 5 Mar 2014 17:58:15 +0000 (18:58 +0100)]
use [s]rand(), not [s]random()

rand() is the most standard C library function,
and on uclibc they are the same. I guess
they are the same in most todays' libc...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoshuf: new applet
Denys Vlasenko [Wed, 5 Mar 2014 17:56:20 +0000 (18:56 +0100)]
shuf: new applet

function                                             old     new   delta
shuf_main                                              -     478    +478
packed_usage                                       29571   29719    +148
applet_names                                        2460    2465      +5
applet_main                                         1428    1432      +4
applet_nameofs                                       714     716      +2
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/0 up/down: 637/0)             Total: 637 bytes

Based on the code by Bartosz Golaszewski <bartekgola@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoman: default to ascii
Denys Vlasenko [Mon, 3 Mar 2014 14:13:37 +0000 (15:13 +0100)]
man: default to ascii

Default to ascii instead of latin1. Otherwise man pages can be displayed
incorrectly. E.g. bullets show as "<B7>".

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoip link: add support for "address ETHADDR". Closes 4862
Denys Vlasenko [Sat, 1 Mar 2014 16:38:41 +0000 (17:38 +0100)]
ip link: add support for "address ETHADDR". Closes 4862

function                                             old     new   delta
do_iplink                                           2175    2289    +114

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agounlzma: add comments about possible bug from BZ 2689
Denys Vlasenko [Fri, 28 Feb 2014 14:42:10 +0000 (15:42 +0100)]
unlzma: add comments about possible bug from BZ 2689

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agounlzma: move some variables in "more local" scope
Denys Vlasenko [Fri, 28 Feb 2014 14:05:43 +0000 (15:05 +0100)]
unlzma: move some variables in "more local" scope

No code changes as verified by objdump

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoudhcpc: ignore NAKs from "wrong" servers. Closes 4267
Denys Vlasenko [Thu, 27 Feb 2014 17:15:50 +0000 (18:15 +0100)]
udhcpc: ignore NAKs from "wrong" servers. Closes 4267

function                                             old     new   delta
udhcpc_main                                         2716    2814     +98

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agols: make "ls -s DIR" show total too. Clases 4946
Denys Vlasenko [Thu, 27 Feb 2014 14:40:26 +0000 (15:40 +0100)]
ls: make "ls -s DIR" show total too. Clases 4946

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoxargs: fix compilation breakage
Denys Vlasenko [Thu, 27 Feb 2014 14:02:36 +0000 (15:02 +0100)]
xargs: fix compilation breakage

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agogrep: fix -w match if first match isn't a word, but second is. Closes 4520
Denys Vlasenko [Thu, 27 Feb 2014 13:56:12 +0000 (14:56 +0100)]
grep: fix -w match if first match isn't a word, but second is. Closes 4520

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoxargs: add support for -I and -i. Closes 493
Denys Vlasenko [Thu, 27 Feb 2014 10:17:06 +0000 (11:17 +0100)]
xargs: add support for -I and -i. Closes 493

function                                             old     new   delta
process_stdin_with_replace                             -     195    +195
xmalloc_substitute_string                              -     145    +145
xargs_main                                           808     884     +76
count_strstr                                           -      45     +45
packed_usage                                       29580   29571      -9
parse_params                                        1445    1416     -29
func_exec                                            285     138    -147
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 1/3 up/down: 461/-185)          Total: 276 bytes
   text    data     bss     dec     hex filename
 922156     932   17692  940780   e5aec busybox_old
 922440     932   17692  941064   e5c08 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofind: code shrink
Denys Vlasenko [Wed, 26 Feb 2014 14:27:10 +0000 (15:27 +0100)]
find: code shrink

function                                             old     new   delta
func_exec                                            306     285     -21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agonc: fix option bit positions. Closes 6926
Denys Vlasenko [Wed, 26 Feb 2014 12:58:59 +0000 (13:58 +0100)]
nc: fix option bit positions. Closes 6926

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agohwclock: fix setting of tz_minuteswest. Closes 5414
Denys Vlasenko [Tue, 25 Feb 2014 16:52:10 +0000 (17:52 +0100)]
hwclock: fix setting of tz_minuteswest. Closes 5414

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: remove a dead link from Config help text
Denys Vlasenko [Tue, 25 Feb 2014 16:31:22 +0000 (17:31 +0100)]
build system: remove a dead link from Config help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodu, copy_file: fix file matching on cramfs. Closes 5456
Denys Vlasenko [Tue, 25 Feb 2014 14:27:58 +0000 (15:27 +0100)]
du, copy_file: fix file matching on cramfs. Closes 5456

function                                             old     new   delta
is_in_ino_dev_hashtable                               88     108     +20
add_to_ino_dev_hashtable                             150     142      -8
reset_ino_dev_hashtable                               84      75      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 20/-17)              Total: 3 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: trivial code shrink
Denys Vlasenko [Tue, 25 Feb 2014 14:09:01 +0000 (15:09 +0100)]
libbb: trivial code shrink

function                                             old     new   delta
reset_ino_dev_hashtable                               84      74     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosysctl: do not error out showing write-only data. Closes 6386
Denys Vlasenko [Mon, 24 Feb 2014 16:28:43 +0000 (17:28 +0100)]
sysctl: do not error out showing write-only data. Closes 6386

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: fix comment
Denys Vlasenko [Mon, 24 Feb 2014 16:20:40 +0000 (17:20 +0100)]
wget: fix comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: add commented-out code to use ssl_helper instead of openssl
Denys Vlasenko [Sun, 23 Feb 2014 22:39:47 +0000 (23:39 +0100)]
wget: add commented-out code to use ssl_helper instead of openssl

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agonetworking/ssl_helper: experimental matrixssl-based ssl helper
Denys Vlasenko [Sun, 23 Feb 2014 22:31:13 +0000 (23:31 +0100)]
networking/ssl_helper: experimental matrixssl-based ssl helper

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: add support for https using "openssl s_client" as a helper
Denys Vlasenko [Sat, 22 Feb 2014 13:12:29 +0000 (14:12 +0100)]
wget: add support for https using "openssl s_client" as a helper

www.kernel.org started redirecting http:// to https://
making https support mandatory for any auto build scripts.

function                                             old     new   delta
wget_main                                           2631    2971    +340
parse_url                                            409     471     +62
.rodata                                           115607  115626     +19
P_HTTPS                                                -       6      +6
P_HTTP                                                 -       5      +5
P_FTP                                                  -       4      +4
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 3/0 up/down: 436/0)             Total: 436 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoImprove examples/var_service READMEs
Denys Vlasenko [Fri, 21 Feb 2014 11:55:43 +0000 (12:55 +0100)]
Improve examples/var_service READMEs

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoKbuild: move CONFIG_PAM to general configuration
Bartosz Golaszewski [Tue, 11 Feb 2014 20:31:42 +0000 (21:31 +0100)]
Kbuild: move CONFIG_PAM to general configuration

Currently CONFIG_PAM depends on CONFIG_LOGIN, but is used by the httpd applet too.

This patch moves said option to general configuration, thus allowing to
compile httpd with PAM support independently from login.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoudhcpc: fix BPF filter. Hopefully fixes the root cause of 4598 and 6746
Denys Vlasenko [Wed, 19 Feb 2014 13:17:11 +0000 (14:17 +0100)]
udhcpc: fix BPF filter. Hopefully fixes the root cause of 4598 and 6746

Use a *signed* large positive value in BPF filter to indicate success.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoifplugd: code shrink
Denys Vlasenko [Mon, 10 Feb 2014 08:44:25 +0000 (09:44 +0100)]
ifplugd: code shrink

function                                             old     new   delta
ifplugd_main                                        1161    1144     -17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agohtpd: trivial simplification in random interval selection
Denys Vlasenko [Sun, 9 Feb 2014 14:35:04 +0000 (15:35 +0100)]
htpd: trivial simplification in random interval selection

function                                             old     new   delta
poll_interval                                         57      52      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: don't die if crypt() returns NULL
Denys Vlasenko [Sun, 9 Feb 2014 13:38:03 +0000 (14:38 +0100)]
libbb: don't die if crypt() returns NULL

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosendmail: use FQDN in default envelope sender
Kaarle Ritvanen [Sun, 9 Feb 2014 08:49:36 +0000 (09:49 +0100)]
sendmail: use FQDN in default envelope sender

RFC 5321 requires the return path to be supplied with a proper domain
name.

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoudhcpc: in comments, explain the kind of raw socket we create
Denys Vlasenko [Fri, 7 Feb 2014 16:38:52 +0000 (17:38 +0100)]
udhcpc: in comments, explain the kind of raw socket we create

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agogrep: properly handle grep -w "^str" in !EXTRA_COMPAT case too
Bartosz Golaszewski [Fri, 7 Feb 2014 16:14:37 +0000 (17:14 +0100)]
grep: properly handle grep -w "^str" in !EXTRA_COMPAT case too

function                                             old     new   delta
grep_file                                           1267    1288     +21

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosendmail: make -f optional, document its default value
Denys Vlasenko [Wed, 5 Feb 2014 14:01:39 +0000 (15:01 +0100)]
sendmail: make -f optional, document its default value

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoudhcpc: don't use BPF filter, users report problems (bugs 4598, 6746)
Denys Vlasenko [Mon, 3 Feb 2014 17:03:42 +0000 (18:03 +0100)]
udhcpc: don't use BPF filter, users report problems (bugs 4598, 6746)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoifupdown: support 'link' address family
Kaarle Ritvanen [Mon, 3 Feb 2014 14:56:20 +0000 (15:56 +0100)]
ifupdown: support 'link' address family

Does not configure anything. L2 configuration hook scripts should do
their job on receiving ADDRFAM=link. Configuration will be done only
once, irrespective of L3 protocols used.

Using the 'link' family in the interfaces file conforms to the Debian
implementation:

http://sources.debian.net/src/ifupdown/0.7.47.1/link.defn

function                                             old     new   delta
link_methods                                           -      12     +12
addr_link                                              -      12     +12
link_up_down                                           -       6      +6
static.addr_fams                                      12      16      +4
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 1/0 up/down: 34/0)               Total: 34 bytes

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: fix use-after-free of ->user. Closes 6836
Denys Vlasenko [Mon, 3 Feb 2014 13:09:42 +0000 (14:09 +0100)]
wget: fix use-after-free of ->user. Closes 6836

function                                             old     new   delta
wget_main                                           2207    2223     +16
parse_url                                            339     353     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agocatv: suppress compiler warning
Denys Vlasenko [Mon, 3 Feb 2014 02:27:53 +0000 (03:27 +0100)]
catv: suppress compiler warning

The warning was:
warning: typedef 'BUG_const_mismatch' locally defined but not used [-Wunused-local-typedefs]

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agozcat: complain if input is not compressed
Denys Vlasenko [Sun, 2 Feb 2014 01:06:38 +0000 (02:06 +0100)]
zcat: complain if input is not compressed

function                                             old     new   delta
buffer_fill_and_print                                178     191     +13
varvalue                                             735     743      +8
bbunpack                                             747     755      +8
open_zipped                                           85      89      +4
xmalloc_open_zipped_read_close                        61      63      +2
get_addr_1                                           240     242      +2
fbsplash_main                                       1228    1230      +2
pstree_main                                          322     321      -1
builtin_type                                         121     119      -2
do_load                                              954     926     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/3 up/down: 39/-31)              Total: 8 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoappletlib: fix set-but-unused warning
Mike Frysinger [Fri, 31 Jan 2014 05:29:47 +0000 (00:29 -0500)]
appletlib: fix set-but-unused warning

When you build with FEATURE_INSTALLER disabled, you get a build
warning like so:

libbb/appletlib.c: In function 'busybox_main':
libbb/appletlib.c:691:7: warning: variable 'use_symbolic_links' set but
                                  not used [-Wunused-but-set-variable]
   int use_symbolic_links;
       ^

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agouname: fix up usage documentation
Mike Frysinger [Fri, 31 Jan 2014 05:28:42 +0000 (00:28 -0500)]
uname: fix up usage documentation

The -i/-o options were missing, and the -r/-s/-v options were
incorrectly labeled as "OS" instead of "kernel".

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agoinit: do not fail build if SIGPWR is not defined
Michael Tokarev [Wed, 29 Jan 2014 08:40:32 +0000 (12:40 +0400)]
init: do not fail build if SIGPWR is not defined

Apparently, some *BSD variants (and maybe some other OSes) does not define
SIGPWR signal.  So since commit 760fc6debcba8c, busybox fails to build on
such platforms.  Fix this.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: open_zipped() should not fail on non-compressed files
Denys Vlasenko [Mon, 27 Jan 2014 12:02:18 +0000 (13:02 +0100)]
libbb: open_zipped() should not fail on non-compressed files

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotestsuite: fix last "which" change
Michael Tokarev [Thu, 23 Jan 2014 13:41:53 +0000 (14:41 +0100)]
testsuite: fix last "which" change

In commit afa63b2dcdc9b9 I replaced `type -p' with
`command -pv'.  But actually it is wrong, the right
substitution is `command -v'.  We need to find our
busybox which is in the first directory in $PATH, so
`command -p' should not be used because it uses
default PATH, not current value of PATH where our
busybox binary resides.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoless: accept and ignore -s
Denys Vlasenko [Wed, 22 Jan 2014 15:36:22 +0000 (16:36 +0100)]
less: accept and ignore -s

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoman: parse "DEFINE pager" in config
John Spencer [Wed, 22 Jan 2014 14:31:10 +0000 (15:31 +0100)]
man: parse "DEFINE pager" in config

function                                             old     new   delta
man_main                                             789     844     +55

Signed-off-by: John Spencer <maillist-busybox@barfooze.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoiplink: fix build with kernel versions prior to 2.6.23
Eugene Rudoy [Wed, 22 Jan 2014 10:49:46 +0000 (11:49 +0100)]
iplink: fix build with kernel versions prior to 2.6.23

Signed-off-by: Eugene Rudoy <gene.devel@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: if opening /dev/loopN returns ENXIO, don't try N++.
Denys Vlasenko [Tue, 21 Jan 2014 12:44:21 +0000 (13:44 +0100)]
libbb: if opening /dev/loopN returns ENXIO, don't try N++.

function                                             old     new   delta
set_loop                                             639     635      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: fix parsing of "10101010" date/time form
Denys Vlasenko [Tue, 21 Jan 2014 06:58:18 +0000 (07:58 +0100)]
libbb: fix parsing of "10101010" date/time form

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotop.c: fix compilation warnings
Bartosz Golaszewski [Sat, 18 Jan 2014 14:36:28 +0000 (15:36 +0100)]
top.c: fix compilation warnings

pfd[1] is unused

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: remove now unnecessary check for IP_PKTINFO definition
Denys Vlasenko [Mon, 20 Jan 2014 02:24:51 +0000 (03:24 +0100)]
ntpd: remove now unnecessary check for IP_PKTINFO definition

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: fix compilation warnings
Bartosz Golaszewski [Sat, 18 Jan 2014 14:36:27 +0000 (15:36 +0100)]
ntpd: fix compilation warnings

GCC complained about since_last_update being set but not used.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosort: check global flags on fallback sort
Bartosz Golaszewski [Sun, 19 Jan 2014 08:10:14 +0000 (09:10 +0100)]
sort: check global flags on fallback sort

Sort now performs global reverse on fallback sort if -r is set. Before
only key local flags were checked.

function                                             old     new   delta
compare_keys                                         712     738     +26

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosort.c: remove a magic number from compare_keys()
Bartosz Golaszewski [Sat, 18 Jan 2014 14:25:58 +0000 (15:25 +0100)]
sort.c: remove a magic number from compare_keys()

Use bitwise OR of proper flags instead.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agogitignore: ignore files generated by 'make test'
Bartosz Golaszewski [Sun, 19 Jan 2014 03:29:59 +0000 (04:29 +0100)]
gitignore: ignore files generated by 'make test'

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoadduser,addgroup: introduce and use CONFIG_LAST_ID
Tito Ragusa [Fri, 17 Jan 2014 08:17:55 +0000 (09:17 +0100)]
adduser,addgroup: introduce and use CONFIG_LAST_ID

Changes adduser.c, addgroup.c and Config.src to set and use CONFIG_LAST_ID.

function                                             old     new   delta
adduser_main                                         841     865     +24
addgroup_main                                        407     425     +18

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoexamples/udhcp: do not rewrite resolv.conf if no DNS servers. Closes 6788
Denys Vlasenko [Mon, 13 Jan 2014 12:38:53 +0000 (13:38 +0100)]
examples/udhcp: do not rewrite resolv.conf if no DNS servers. Closes 6788

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodocs: tweak keep_data_small.txt
Denys Vlasenko [Mon, 13 Jan 2014 10:45:34 +0000 (11:45 +0100)]
docs: tweak keep_data_small.txt

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotar: tighten up pax header validity check
Denys Vlasenko [Fri, 10 Jan 2014 17:02:38 +0000 (18:02 +0100)]
tar: tighten up pax header validity check

function                                             old     new   delta
get_header_tar                                      1785    1795     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofakeidentd: simplify ndelay manipulations
Denys Vlasenko [Fri, 10 Jan 2014 16:12:54 +0000 (17:12 +0100)]
fakeidentd: simplify ndelay manipulations

function                                             old     new   delta
new_peer                                              91      79     -12
do_rd                                                197     152     -45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotail: adjust help/usage texts
Cristian Ionescu-Idbohrn [Thu, 9 Jan 2014 19:00:58 +0000 (20:00 +0100)]
tail: adjust help/usage texts

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolineedit: fix trivial build failure
Denys Vlasenko [Fri, 10 Jan 2014 13:38:26 +0000 (14:38 +0100)]
lineedit: fix trivial build failure

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibarchive: open_zipped() does not need to check extensions for e.g. gzip
Denys Vlasenko [Fri, 10 Jan 2014 13:06:57 +0000 (14:06 +0100)]
libarchive: open_zipped() does not need to check extensions for e.g. gzip

We only need to check for signature-less extensions,
currently only .lzma. The rest can be happily autodetected.

This fixes "zcat FILE_WITHOUT_GZ_EXT" case, among others.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: fix non-portable sed constructs.
Matthias Andree [Fri, 10 Jan 2014 10:54:37 +0000 (11:54 +0100)]
build system: fix non-portable sed constructs.

This includes proper line breaks for labels and closing braces,
and removing non-portable \n and \t in s/// functions.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofixlet for the previous commit #2
Denys Vlasenko [Thu, 9 Jan 2014 19:09:43 +0000 (20:09 +0100)]
fixlet for the previous commit #2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofixlet for the previous commit
Denys Vlasenko [Thu, 9 Jan 2014 19:05:47 +0000 (20:05 +0100)]
fixlet for the previous commit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agonetworking: explain isrv_run() API
Denys Vlasenko [Thu, 9 Jan 2014 18:58:19 +0000 (19:58 +0100)]
networking: explain isrv_run() API

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofakeidentd: fix use-after-free
Ryan Mallon [Thu, 9 Jan 2014 18:14:07 +0000 (19:14 +0100)]
fakeidentd: fix use-after-free

function                                             old     new   delta
do_rd                                                199     197      -2

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agochown: fix help text
Denys Vlasenko [Thu, 9 Jan 2014 16:52:13 +0000 (17:52 +0100)]
chown: fix help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofind: fix a regression introduced with -HLP support
Denys Vlasenko [Thu, 9 Jan 2014 15:07:11 +0000 (16:07 +0100)]
find: fix a regression introduced with -HLP support

function                                             old     new   delta
find_main                                            294     342     +48

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoping: revert "try SOCK_DGRAM if no root privileges"
Denys Vlasenko [Thu, 9 Jan 2014 10:53:26 +0000 (11:53 +0100)]
ping: revert "try SOCK_DGRAM if no root privileges"

It wasn't working, and fixes on top of it would make ping
noticeably larger.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: "make hosttools" doesn't exist, remove it from "make help"
Denys Vlasenko [Thu, 9 Jan 2014 10:03:46 +0000 (11:03 +0100)]
build system: "make hosttools" doesn't exist, remove it from "make help"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: stop including alloca.h, stdlib.h provides it
Denys Vlasenko [Thu, 9 Jan 2014 10:02:46 +0000 (11:02 +0100)]
build system: stop including alloca.h, stdlib.h provides it

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: adjust last packet's recv time after a step
Denys Vlasenko [Wed, 8 Jan 2014 16:17:52 +0000 (17:17 +0100)]
ntpd: adjust last packet's recv time after a step

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: FreeBSD fix for B<num> baud rate constants not fitting into a short.
Denys Vlasenko [Wed, 8 Jan 2014 14:25:20 +0000 (15:25 +0100)]
libbb: FreeBSD fix for B<num> baud rate constants not fitting into a short.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoAnother FreeBSD fix from Matthias Andree
Denys Vlasenko [Wed, 8 Jan 2014 14:10:54 +0000 (15:10 +0100)]
Another FreeBSD fix from Matthias Andree

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoash: in bash compat mode, always export $SHLVL
Denys Vlasenko [Tue, 7 Jan 2014 15:12:48 +0000 (16:12 +0100)]
ash: in bash compat mode, always export $SHLVL

function                                             old     new   delta
ash_main                                            1437    1442      +5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agogrep: fix two bugs with -w
Denys Vlasenko [Tue, 7 Jan 2014 13:57:42 +0000 (14:57 +0100)]
grep: fix two bugs with -w

Unfortunately, with !EXTRA_COMPAT, "grep -w ^str" still erroneously matches "strstr".

function                                             old     new   delta
grep_file                                           1499    1510     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoplatform.h: undef HAVE_STRCHRNUL only on correct versions of FreeBSD
Denys Vlasenko [Tue, 7 Jan 2014 13:09:47 +0000 (14:09 +0100)]
platform.h: undef HAVE_STRCHRNUL only on correct versions of FreeBSD

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoStart 1.23.0 development cycle
Denys Vlasenko [Tue, 31 Dec 2013 23:44:30 +0000 (00:44 +0100)]
Start 1.23.0 development cycle

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoBump version to 1.22.0 1_22_0
Denys Vlasenko [Tue, 31 Dec 2013 23:42:11 +0000 (00:42 +0100)]
Bump version to 1.22.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotestsuite: remove forgotten debug hack
Denys Vlasenko [Tue, 31 Dec 2013 22:25:46 +0000 (23:25 +0100)]
testsuite: remove forgotten debug hack

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofix failures found by randomconfig builds
Denys Vlasenko [Tue, 31 Dec 2013 22:22:36 +0000 (23:22 +0100)]
fix failures found by randomconfig builds

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotestsuite: disable tests for no longer supported bbox-specific date formats
Denys Vlasenko [Tue, 31 Dec 2013 17:57:39 +0000 (18:57 +0100)]
testsuite: disable tests for no longer supported bbox-specific date formats

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoadduser: check whether run with no USERNAME. Closes 6728
Denys Vlasenko [Fri, 20 Dec 2013 19:45:02 +0000 (20:45 +0100)]
adduser: check whether run with no USERNAME. Closes 6728

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agotestsuite: fix false positives for du
Denys Vlasenko [Fri, 20 Dec 2013 01:55:16 +0000 (02:55 +0100)]
testsuite: fix false positives for du

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: fix make gconfig
Daniel Borca [Thu, 19 Dec 2013 03:43:24 +0000 (04:43 +0100)]
build system: fix make gconfig

Was getting "undefined reference to symbol 'dlsym@@GLIBC_2.2.5'".

Signed-off-by: Daniel Borca <dborca@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosed: accept s///i as a synonym for s///I ("ignore case")
David A. Wheeler [Fri, 6 Dec 2013 01:42:17 +0000 (20:42 -0500)]
sed: accept s///i as a synonym for s///I ("ignore case")

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agohostname: do not use gethostbyname() for "hostname -s"
Michael Tokarev [Tue, 17 Dec 2013 18:13:45 +0000 (19:13 +0100)]
hostname: do not use gethostbyname() for "hostname -s"

There's no reason to call gethostbyname() on the value returned
by uname() when asked just for a short name of a host.  This may
also be wrong, when uname is set to one value, but in /etc/hosts
(or elsewhere) the "canonical" name is different.  This is often
the case for localhost entry in /etc/hosts:

  127.0.0.1     localhost       myname

With this content of /etc/hosts, and uname being set to myname,
busybox hostname -s will return localhost, while regular
hostname utility returns myname.

Fix this by not calling gethostbyname() for the simple
'hostname -s' use.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agowget: user-friendly fallback to http
Lauri Kasanen [Tue, 17 Dec 2013 18:03:41 +0000 (19:03 +0100)]
wget: user-friendly fallback to http

GNU wget: wget google.com // ok
bb before: wget google.com // wget: not an http or ftp url

function                                             old     new   delta
parse_url                                            317     339     +22

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>