oweals/busybox.git
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>
10 years agokill[all[5]]: code shrink
Denys Vlasenko [Mon, 16 Dec 2013 16:45:44 +0000 (17:45 +0100)]
kill[all[5]]: code shrink

function                                             old     new   delta
kill_main                                            992     947     -45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agokillall5: return 2 if no processes got killed
Uros Vampl [Mon, 16 Dec 2013 16:44:58 +0000 (17:44 +0100)]
killall5: return 2 if no processes got killed

function                                             old     new   delta
kill_main                                            943     992     +49

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodo not fail build if MAXSYMLINKS isn't defined
Michael Tokarev [Mon, 9 Dec 2013 10:45:01 +0000 (14:45 +0400)]
do not fail build if MAXSYMLINKS isn't defined

This is needed for, eg, hurd, which is known to have no constraints.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoexpand: use printable_string instead of hard-coding implementation
Michael Tokarev [Mon, 9 Dec 2013 12:09:35 +0000 (16:09 +0400)]
expand: use printable_string instead of hard-coding implementation

function                                             old     new   delta
expand_main                                          709     690     -19

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: speed up resyncing if our clock is seriously off
Denys Vlasenko [Sun, 8 Dec 2013 15:11:04 +0000 (16:11 +0100)]
ntpd: speed up resyncing if our clock is seriously off

function                                             old     new   delta
recv_and_process_peer_pkt                            892     922     +30

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: do not invalidate datapoints after step
Denys Vlasenko [Sat, 7 Dec 2013 16:29:03 +0000 (17:29 +0100)]
ntpd: do not invalidate datapoints after step

Used to set p->filter_datapoint[i].d_dispersion = MAXDISP
and clear reachable bits, but this proved to be too agressive:
after step (tested with suspinding laptop for ~30 secs),
this caused all previous data to be considered invalid,
making us needing to collect full ~8 datapoins per peer
after step in order to start trusting them.
In turn, this was making poll interval decrease even after
step was done. (Poll interval decreases already before step
in this scenario, because we see large offsets and end up with
no good peer to select).

function                                             old     new   delta
reset_peer_stats                                     157     139     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: comment out "spike detection" code
Denys Vlasenko [Wed, 4 Dec 2013 16:12:11 +0000 (17:12 +0100)]
ntpd: comment out "spike detection" code

function                                             old     new   delta
update_local_clock                                   982     835    -147

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: promote log level 3 to production
Denys Vlasenko [Wed, 4 Dec 2013 15:32:09 +0000 (16:32 +0100)]
ntpd: promote log level 3 to production

Without it, peer selection logic is hard to debug

function                                             old     new   delta
update_local_clock                                   861     982    +121
select_and_cluster                                   962    1065    +103
common_ping_main                                    1788    1821     +33
huft_build                                          1287    1296      +9
chpst_main                                           708     704      -4
INET6_resolve                                        127     119      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/2 up/down: 266/-12)           Total: 254 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agontpd: let user know if spike was detected
Denys Vlasenko [Wed, 4 Dec 2013 12:19:04 +0000 (13:19 +0100)]
ntpd: let user know if spike was detected

function                                             old     new   delta
update_local_clock                                   861     943     +82

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoUse unsigned printf/scanf conversion where more appropriate
Denys Vlasenko [Fri, 29 Nov 2013 15:45:45 +0000 (16:45 +0100)]
Use unsigned printf/scanf conversion where more appropriate

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agofix assorted unused code and wrong format specs found by cppchekc (bug 6716)
Denys Vlasenko [Fri, 29 Nov 2013 15:43:33 +0000 (16:43 +0100)]
fix assorted unused code and wrong format specs found by cppchekc (bug 6716)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agochpst: fix a bug where -U USER was using wrong USER (one from -u USER)
Denys Vlasenko [Fri, 29 Nov 2013 15:39:28 +0000 (16:39 +0100)]
chpst: fix a bug where -U USER was using wrong USER (one from -u USER)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoping: try SOCK_DGRAM if no root privileges
Daniel Borca [Thu, 28 Nov 2013 11:50:25 +0000 (12:50 +0100)]
ping: try SOCK_DGRAM if no root privileges

Signed-off-by: Daniel Borca <dborca@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodpkg-deb: cosmetic correction to usage text
Daniel Borca [Thu, 28 Nov 2013 11:38:25 +0000 (12:38 +0100)]
dpkg-deb: cosmetic correction to usage text

Signed-off-by: Daniel Borca <dborca@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosed: code shrink
Denys Vlasenko [Thu, 28 Nov 2013 11:08:51 +0000 (12:08 +0100)]
sed: code shrink

function                                             old     new   delta
get_next_line                                        246     250      +4
sed_main                                             671     662      -9
add_input_file                                        47       -     -47
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 4/-56)             Total: -52 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agosed: open input files sequentially to avoid EMFILE
Denys Vlasenko [Thu, 28 Nov 2013 02:14:16 +0000 (03:14 +0100)]
sed: open input files sequentially to avoid EMFILE

Currently, sed pre-opens all files, which may cause EMFILE errors
on systems with low ulimit -n.  Change sed to open one file at a time.

function                                             old     new   delta
get_next_line                                        177     235     +58
sed_main                                             682     652     -30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 58/-30)             Total: 28 bytes

Based on the patch by Daniel Borca <dborca@yahoo.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agohush: typo fixes in comments
Denys Vlasenko [Thu, 28 Nov 2013 00:50:01 +0000 (01:50 +0100)]
hush: typo fixes in comments

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoplatform: strchrnul is missing if __APPLE__
Daniel Borca [Tue, 26 Nov 2013 23:27:46 +0000 (00:27 +0100)]
platform: strchrnul is missing if __APPLE__

Signed-off-by: Daniel Borca <dborca@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: use od -b instead of od -t x1
Denys Vlasenko [Tue, 26 Nov 2013 13:56:29 +0000 (14:56 +0100)]
build system: use od -b instead of od -t x1

od -t is not available in non-CONFIG_DESKTOPed busybox od

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agoinit: halt on SIGPWR too
Bogdan Purcareata [Tue, 26 Nov 2013 12:54:48 +0000 (13:54 +0100)]
init: halt on SIGPWR too

Most init processes implement a handler for SIGPWR that gracefully
stops all child processes when shutting down a machine. Some other
technologies rely on this signal - e.g. Busybox powered LXC
containers.

This patch makes busybox init halt when receiving SIGPWR.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agolibbb: add sketch of tentative 'better' passwd/group API
Denys Vlasenko [Tue, 26 Nov 2013 12:46:18 +0000 (13:46 +0100)]
libbb: add sketch of tentative 'better' passwd/group API

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agodevfsd: remove static variable
Denys Vlasenko [Tue, 26 Nov 2013 11:12:27 +0000 (12:12 +0100)]
devfsd: remove static variable

function                                             old     new   delta
static.msg                                             4       -      -4
get_uid_gid                                          114     107      -7
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-11)             Total: -11 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agobuild system: do not generate MAX_APPLET_NAME_LEN (unused)
Denys Vlasenko [Tue, 26 Nov 2013 11:03:24 +0000 (12:03 +0100)]
build system: do not generate MAX_APPLET_NAME_LEN (unused)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agologread: don't call shmdt() before exit, kernel does it for us.
Denys Vlasenko [Tue, 26 Nov 2013 11:02:18 +0000 (12:02 +0100)]
logread: don't call shmdt() before exit, kernel does it for us.

function                                             old     new   delta
logread_main                                         472     466      -6
interrupted                                           20       9     -11
error_exit                                            20       -     -20
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-37)             Total: -37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
10 years agologread: flush output. closes 6710
Denys Vlasenko [Tue, 26 Nov 2013 10:44:27 +0000 (11:44 +0100)]
logread: flush output. closes 6710

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoawk: fix a bug in argc counting in recent change
Denys Vlasenko [Thu, 21 Nov 2013 14:09:55 +0000 (15:09 +0100)]
awk: fix a bug in argc counting in recent change

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorfkill: use new-style config/kbuild/applet
Denys Vlasenko [Wed, 20 Nov 2013 13:20:07 +0000 (14:20 +0100)]
rfkill: use new-style config/kbuild/applet

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotar: prevent empty file to be treated as valid tarball
Denys Vlasenko [Tue, 19 Nov 2013 16:17:48 +0000 (17:17 +0100)]
tar: prevent empty file to be treated as valid tarball

function                                             old     new   delta
tar_main                                             879     895     +16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofix a copy/paste error in last tar testcase name
Denys Vlasenko [Tue, 19 Nov 2013 15:56:26 +0000 (16:56 +0100)]
fix a copy/paste error in last tar testcase name

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotar: add a testcase for previous commit
Denys Vlasenko [Tue, 19 Nov 2013 13:52:02 +0000 (14:52 +0100)]
tar: add a testcase for previous commit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotar: fix exitcode check for MMU-spawned unpacking helpers
Denys Vlasenko [Tue, 19 Nov 2013 13:44:04 +0000 (14:44 +0100)]
tar: fix exitcode check for MMU-spawned unpacking helpers

Testcase: tar xvzf EMPTY_FILE

function                                             old     new   delta
open_transformer                                     102     106      +4
get_header_tar                                      1781    1785      +4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolibbb: move nuke_str() from passwd into libbb
Denys Vlasenko [Tue, 19 Nov 2013 12:36:45 +0000 (13:36 +0100)]
libbb: move nuke_str() from passwd into libbb

function                                             old     new   delta
nuke_str                                               -      15     +15
ask_and_check_password_extended                      215     206      -9
init_main                                            781     771     -10
nuke_str                                              27       -     -27
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/2 up/down: 15/-46)            Total: -31 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agocomment tweak
Denys Vlasenko [Tue, 19 Nov 2013 12:16:44 +0000 (13:16 +0100)]
comment tweak

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosulogin: use common password-checking routine.
Denys Vlasenko [Tue, 19 Nov 2013 12:09:06 +0000 (13:09 +0100)]
sulogin: use common password-checking routine.

This needed some extensions correct_passwd() function,
which got renamed ask_and_check_password() to better describe what it does.

function                                             old     new   delta
ask_and_check_password_extended                        -     215    +215
ask_and_check_password                                 -      12     +12
vlock_main                                           394     397      +3
sulogin_main                                         494     326    -168
correct_password                                     207       -    -207
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/1 up/down: 230/-375)         Total: -145 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoarchival/*: move "config:" snippets into .c files
Denys Vlasenko [Thu, 14 Nov 2013 10:39:00 +0000 (11:39 +0100)]
archival/*: move "config:" snippets into .c files

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoarchival/*: move "applet:" snippets into .c files, part 2
Denys Vlasenko [Thu, 14 Nov 2013 10:38:18 +0000 (11:38 +0100)]
archival/*: move "applet:" snippets into .c files, part 2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoarchival/*: move "applet:" snippets into .c files
Denys Vlasenko [Thu, 14 Nov 2013 08:54:24 +0000 (09:54 +0100)]
archival/*: move "applet:" snippets into .c files

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoarchival/*: move "kbuild:" snippets into .c files
Denys Vlasenko [Thu, 14 Nov 2013 08:53:52 +0000 (09:53 +0100)]
archival/*: move "kbuild:" snippets into .c files

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoswitch editors/* to embedded-in-source kbuild system
Denys Vlasenko [Wed, 13 Nov 2013 11:45:33 +0000 (12:45 +0100)]
switch editors/* to embedded-in-source kbuild system

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoawk: optionally support -e AWK_PROG
Sven-Göran Bergh [Tue, 12 Nov 2013 13:18:25 +0000 (14:18 +0100)]
awk: optionally support -e AWK_PROG

function                                             old     new   delta
awk_main                                             959     978     +19

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofstrim: use new-style config/kbuild/applet snippets; trim help text
Denys Vlasenko [Tue, 12 Nov 2013 11:09:14 +0000 (12:09 +0100)]
fstrim: use new-style config/kbuild/applet snippets; trim help text

function                                             old     new   delta
packed_usage                                       29546   29520     -26

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcp: add PXELINUX config file option (code 209) definition
Jeremy Kerr [Tue, 12 Nov 2013 10:18:26 +0000 (11:18 +0100)]
udhcp: add PXELINUX config file option (code 209) definition

This change adds a definition for DHCP option 209. RFC 5071 defines code
209 as a configuration file for a PXE bootloader; this change uses
the string "pxeconffile" as its text identifier.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>