oweals/busybox.git
11 years agosed: fix "sed clusternewline" testcase
Denys Vlasenko [Wed, 30 Oct 2013 13:25:22 +0000 (14:25 +0100)]
sed: fix "sed clusternewline" testcase

function                                             old     new   delta
process_files                                       2197    2226     +29
flush_append                                          47      54      +7
get_next_line                                        184     189      +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 41/0)               Total: 41 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosed: document -E in help text
Denys Vlasenko [Wed, 30 Oct 2013 12:00:00 +0000 (13:00 +0100)]
sed: document -E in help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosed: fix memory leak in 'r FILE' command
Denys Vlasenko [Wed, 30 Oct 2013 09:22:47 +0000 (10:22 +0100)]
sed: fix memory leak in 'r FILE' command

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosed: accept -E as a synonym for -r
David A. Wheeler [Mon, 28 Oct 2013 23:52:48 +0000 (00:52 +0100)]
sed: accept -E as a synonym for -r

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpc: make DHCP packets to have at least 300 DHCP bytes
Johannes Stezenbach [Mon, 28 Oct 2013 22:27:37 +0000 (23:27 +0100)]
udhcpc: make DHCP packets to have at least 300 DHCP bytes

Commit b8b72f02 removed all padding from DHCP packets
to fix operation with buggy servers which can't handle
maximum sized packets.  But it introduced a regression
with buggy routers which drop DHCP packets smaller
than 300 bytes (i.e. 342 byte ethernet packets).
Add back some padding to work around.

function                                             old     new   delta
udhcp_send_kernel_packet                             268     292     +24
udhcp_send_raw_packet                                462     473     +11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 35/0)               Total: 35 bytes

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolibbb: use <poll.h> instead of <sys/poll.h>
Thomas Petazzoni [Wed, 16 Oct 2013 17:59:45 +0000 (19:59 +0200)]
libbb: use <poll.h> instead of <sys/poll.h>

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agobloat-o-meter: add usage info
Bartosz Golaszewski [Wed, 16 Oct 2013 17:18:05 +0000 (19:18 +0200)]
bloat-o-meter: add usage info

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotail compat: fix header printing for tail -f
Bartosz Golaszewski [Mon, 14 Oct 2013 18:11:55 +0000 (20:11 +0200)]
tail compat: fix header printing for tail -f

Makes tail -f for multiple files display the header only if another (ie. not
currently displayed) file changed.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowget: if FEATURE_CLEAN_UP, free(ptr_to_globals)
Guilherme Maciel Ferreira [Wed, 16 Oct 2013 12:43:30 +0000 (14:43 +0200)]
wget: if FEATURE_CLEAN_UP, free(ptr_to_globals)

Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoFix some compiler warnings emitted by gcc-4.8.0
Denys Vlasenko [Wed, 16 Oct 2013 12:21:20 +0000 (14:21 +0200)]
Fix some compiler warnings emitted by gcc-4.8.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoether-wake: shorten help text, reduce packet buffer size
Denys Vlasenko [Mon, 14 Oct 2013 17:04:20 +0000 (19:04 +0200)]
ether-wake: shorten help text, reduce packet buffer size

function                                             old     new   delta
ether_wake_main                                      726     727      +1
packed_usage                                       29468   29434     -34

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowget: add support for connect timeout
Lauri Kasanen [Sat, 12 Oct 2013 19:47:07 +0000 (21:47 +0200)]
wget: add support for connect timeout

function                                             old     new   delta
open_socket                                           33      64     +31
wget_main                                           2182    2194     +12

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoinit: better --help text
Denys Vlasenko [Sat, 12 Oct 2013 02:52:22 +0000 (04:52 +0200)]
init: better --help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoawk: fix length(array)
Denys Vlasenko [Sat, 12 Oct 2013 02:51:54 +0000 (04:51 +0200)]
awk: fix length(array)

function                                             old     new   delta
evaluate                                            3526    3548     +22

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowall,crontab: use xopen_as_uid_gid()
Ryan Mallon [Tue, 8 Oct 2013 12:53:29 +0000 (14:53 +0200)]
wall,crontab: use xopen_as_uid_gid()

This fixes a narrow security race in crontab.

function                                             old     new   delta
xopen_as_uid_gid                                       -      80     +80
seteuid                                                -      64     +64
setegid                                                -      64     +64
setreuid                                               -      37     +37
xseteuid                                               -      22     +22
xsetegid                                               -      22     +22
crontab_main                                         590     577     -13
setfsuid                                              33       -     -33
setfsgid                                              33       -     -33
wall_main                                            138     102     -36
open_as_user                                         109       -    -109

   text    data     bss     dec     hex filename
 893539     497    7568  901604   dc1e4 busybox_old
 893618     497    7568  901683   dc233 busybox_unstripped

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolibbb: Add xsetegid(), xseteuid(), xopen_as_uid_gid() functions
Ryan Mallon [Tue, 8 Oct 2013 12:52:49 +0000 (14:52 +0200)]
libbb: Add xsetegid(), xseteuid(), xopen_as_uid_gid() functions

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agobunzip2: fix off-by-one check
Denys Vlasenko [Sun, 6 Oct 2013 20:53:14 +0000 (22:53 +0200)]
bunzip2: fix off-by-one check

stage3-armv7a_hardfp-20130209.tar.bz2, 149189948 bytes long,
md5sum b29ce23312e14eb15a143377d4a38473, was failing to unpack.

It so happened that this file has a run which exactly fills
the 90k buffer. The check was "size >= bufsize", apparently
it has to be ">".

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowall: access FILE under real user's credentials
Denys Vlasenko [Sun, 6 Oct 2013 13:14:25 +0000 (15:14 +0200)]
wall: access FILE under real user's credentials

While at it, move applet/config/kbuild bits into wall.c.
(This way, it's more visible that applet is suid'ed).

function                                             old     new   delta
wall_main                                             87     138     +51

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotrylink: only prefix libs with -l
Mike Frysinger [Thu, 12 Sep 2013 04:29:40 +0000 (00:29 -0400)]
trylink: only prefix libs with -l

If our pkg-config queries pass back a flag like -pthread, the trylink
script will expand that to -l-pthread.  So change trylink to only add
the -l prefix to a value that doesn't have a - prefix already.

Reported-by: thaehaid@incognitomail.org
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoloadkmap: explain what happens with K_ALLOCATED key value
Denys Vlasenko [Thu, 19 Sep 2013 15:56:59 +0000 (17:56 +0200)]
loadkmap: explain what happens with K_ALLOCATED key value

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohttpd: make sire pfd[TO_CGI].revents is cleared before poll()
Denys Vlasenko [Wed, 18 Sep 2013 10:08:41 +0000 (12:08 +0200)]
httpd: make sire pfd[TO_CGI].revents is cleared before poll()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoDocumentation update
Denys Vlasenko [Tue, 17 Sep 2013 14:24:01 +0000 (16:24 +0200)]
Documentation update

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodumpkmap: code shrink
Denys Vlasenko [Tue, 17 Sep 2013 12:16:25 +0000 (14:16 +0200)]
dumpkmap: code shrink

function                                             old     new   delta
dumpkmap_main                                        223     160     -63

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohttpd: treat errors from stdin correctly.
Denys Vlasenko [Wed, 11 Sep 2013 12:59:21 +0000 (14:59 +0200)]
httpd: treat errors from stdin correctly.

Fron bug report:

If a CGI or proxied connection is rudely aborted (SIG_{KILL,BUS,SEGV})
then httpd will spin madly the poll loop in:

networking/httpd.c:1080
cgi_io_loop_and_exit()

Upon investigation I found that pfd[0].revents == 0x0018 (POLLHUP|POLLERR),
which leads to empty read, but the pfd[0].fd (STDIN_FILENO) is left open,
and in the FD list given to poll() which immediately returns to once
again inform the loop of (POLLHUP|POLLERR) condition of pfd[0].fd.
This continues until pfd[FROM_CGI].revents != 0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotouch: add conditional support for -h
Denys Vlasenko [Wed, 11 Sep 2013 09:58:33 +0000 (11:58 +0200)]
touch: add conditional support for -h

Based on a patch by Andy <andy.padavan@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoar: better comment
Denys Vlasenko [Tue, 10 Sep 2013 14:27:08 +0000 (16:27 +0200)]
ar: better comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoar: read_num(): fix reading fields using the entire width
Peter Korsgaard [Tue, 10 Sep 2013 09:52:35 +0000 (11:52 +0200)]
ar: read_num(): fix reading fields using the entire width

ar fields are fixed length text strings (padded with spaces). Ensure
bb_strtou doesn't read past the field in case the full width is used.

The fields are only read once, so the simplest/smallest solution to me
seems to be to just pass the length to read_num() and then zero terminate
the string before passing it to bb_strtou. This does mean that the fields
MUST be read in reverse order, so some minor reshuffling was needed.

Bloat-o-meter:
function                                             old     new   delta
get_header_ar                                        394     414     +20
read_num                                              29      36      +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0)               Total: 27 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotop: fix breakage introduced by previous commit
Denys Vlasenko [Fri, 6 Sep 2013 10:59:48 +0000 (12:59 +0200)]
top: fix breakage introduced by previous commit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoMake smart_ulltoa return pointer to end (allows for code shink in callers)
Denys Vlasenko [Fri, 6 Sep 2013 10:53:14 +0000 (12:53 +0200)]
Make smart_ulltoa return pointer to end (allows for code shink in callers)

function                                             old     new   delta
smart_ulltoa5                                        405     408      +3
smart_ulltoa4                                        273     276      +3
list_table                                          1113    1114      +1
scale                                                 36      34      -2
put_lu                                                55      53      -2
ulltoa6_and_space                                     19      14      -5
powertop_main                                       1470    1461      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoman: find posix man pages
John Spencer [Sun, 25 Aug 2013 21:38:25 +0000 (17:38 -0400)]
man: find posix man pages

Add the 0p/1p/3p sections to the search.

Signed-off-by: John Spencer <maillist-busybox@barfooze.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agofdisk: fix GPT size math errors
Jody Bruchon [Tue, 20 Aug 2013 15:42:06 +0000 (17:42 +0200)]
fdisk: fix GPT size math errors

Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolineedit: use unicode_strwidth instead of unicode_strlen
Denys Vlasenko [Tue, 20 Aug 2013 14:13:05 +0000 (16:13 +0200)]
lineedit: use unicode_strwidth instead of unicode_strlen

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodd: code shrink
Denys Vlasenko [Tue, 20 Aug 2013 10:49:28 +0000 (12:49 +0200)]
dd: code shrink

function                                             old     new   delta
dd_main                                             1475    1469      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodd: code shrink
Denys Vlasenko [Tue, 20 Aug 2013 10:45:05 +0000 (12:45 +0200)]
dd: code shrink

function                                             old     new   delta
dd_main                                             1487    1475     -12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodd: code shrink
Denys Vlasenko [Tue, 20 Aug 2013 10:40:29 +0000 (12:40 +0200)]
dd: code shrink

function                                             old     new   delta
write_and_stats                                       78      99     +21
dd_main                                             1496    1487      -9
full_write_or_warn                                    42       -     -42
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 21/-51)            Total: -30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodd: remove FIXME comment which is fixed now. No code changes
Denys Vlasenko [Tue, 20 Aug 2013 10:27:19 +0000 (12:27 +0200)]
dd: remove FIXME comment which is fixed now. No code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodd: code shrink
Denys Vlasenko [Tue, 20 Aug 2013 10:08:46 +0000 (12:08 +0200)]
dd: code shrink

function                                             old     new   delta
dd_main                                             1001     961     -40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodd: fail if swab is attempted on odd-sized block
Denys Vlasenko [Tue, 20 Aug 2013 00:50:49 +0000 (02:50 +0200)]
dd: fail if swab is attempted on odd-sized block

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolineedit: fix multi-line PS1 handling: calculate PS1 length from last \n
Denys Vlasenko [Mon, 19 Aug 2013 14:45:04 +0000 (16:45 +0200)]
lineedit: fix multi-line PS1 handling: calculate PS1 length from last \n

function                                             old     new   delta
parse_and_put_prompt                                 755     774     +19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolineedit: improve Unicode handling (still buggy though)
Denys Vlasenko [Mon, 19 Aug 2013 14:44:05 +0000 (16:44 +0200)]
lineedit: improve Unicode handling (still buggy though)

function                                             old     new   delta
unicode_strlen                                         -      31     +31
read_line_input                                     3876    3879      +3
lineedit_read_key                                    255     246      -9
parse_and_put_prompt                                 785     755     -30
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/2 up/down: 34/-39)             Total: -5 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodd: fix example in a comment. No code changes.
Denys Vlasenko [Mon, 19 Aug 2013 08:30:55 +0000 (10:30 +0200)]
dd: fix example in a comment. No code changes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodd: support conv=swab
Denys Vlasenko [Mon, 19 Aug 2013 07:01:39 +0000 (09:01 +0200)]
dd: support conv=swab

function                                             old     new   delta
dd_main                                             1482    1520     +38
static.conv_words                                     28      33      +5
packed_usage                                       29377   29375      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodd: do not reuse local variables for unrelated values.
Denys Vlasenko [Mon, 19 Aug 2013 07:00:08 +0000 (09:00 +0200)]
dd: do not reuse local variables for unrelated values.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoiplink: comment out include <net/if_packet.h>
Denys Vlasenko [Fri, 16 Aug 2013 10:20:25 +0000 (12:20 +0200)]
iplink: comment out include <net/if_packet.h>

iplink.c includes net/if_packet.h, which (on GLIBC)
only defines struct sockaddr_pkt. this struct is not
used anywhere in the code, and removing the #include
makes compilation succeed with musl libc.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoinit: don't srop unterminated processes' entries during inittab reload
Paulius Zaleckas [Fri, 16 Aug 2013 10:01:58 +0000 (12:01 +0200)]
init: don't srop unterminated processes' entries during inittab reload

This feature was removed in 72c99af

It is useful when process is removed from inittab and later added
back, but never terminated. It prevents init from spawning duplicate.

function                                             old     new   delta
check_delayed_sigs                                   176     182      +6

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoinit: don't use fixed size buffer for command
Denys Vlasenko [Fri, 16 Aug 2013 09:48:48 +0000 (11:48 +0200)]
init: don't use fixed size buffer for command

We store init actions forever. 256 bytes per action means that
a typical inittab of ~10 commands uses 2.5k just to remember
command strings - which are usually _much_ shorter than 256 bytes.

At a cost of a bit more code, it's possible to allocate
only actually needed amount.

function                                             old     new   delta
init_exec                                            224     248     +24
new_init_action                                      140     142      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotar: fix tar -T to add entries in the exact order as the input list
SASAKI Suguru [Thu, 15 Aug 2013 10:19:29 +0000 (12:19 +0200)]
tar: fix tar -T to add entries in the exact order as the input list

This fixes tar to order files in tarball correctly in this case:

$ touch 1 2 3; echo -e '1\n2\n3' | tar -T- -c | tar t
1
2
3

Signed-off-by: SASAKI Suguru <suguru@sonik.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofix build error with musl libc due to if_slip.h
Denys Vlasenko [Thu, 15 Aug 2013 07:54:51 +0000 (09:54 +0200)]
fix build error with musl libc due to if_slip.h

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonetworking: fix potential overflow in ife_print6()
Nicolas Dichtel [Mon, 12 Aug 2013 15:09:59 +0000 (17:09 +0200)]
networking: fix potential overflow in ife_print6()

devname is used by fscanf to store a string specified by '%20s'.

Extract from the man for the '%s' specifier:
Matches a sequence of non-white-space characters; the next pointer must be a
pointer to character array that is long enough to hold the input sequence and
the terminating null byte ('\0'), which is added automatically. The input
string stops at white space or at the maximum field width, whichever occurs
first.

Hence, the right length is 20 + 1 for the '\0'.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpc: tweak help text more
Denys Vlasenko [Thu, 8 Aug 2013 10:45:45 +0000 (12:45 +0200)]
udhcpc: tweak help text more

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpc: tweak help text
Denys Vlasenko [Thu, 8 Aug 2013 10:33:18 +0000 (12:33 +0200)]
udhcpc: tweak help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoswapon: support "pri=NNN" in fstab
Tito Ragusa [Thu, 8 Aug 2013 08:21:27 +0000 (10:21 +0200)]
swapon: support "pri=NNN" in fstab

function                                             old     new   delta
swap_on_off_main                                     244     365    +121

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosetsid: code shrink, expanded comments
Denys Vlasenko [Wed, 7 Aug 2013 16:49:51 +0000 (18:49 +0200)]
setsid: code shrink, expanded comments

function                                             old     new   delta
setsid_main                                           56      53      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agolibbb: code shrink
Denys Vlasenko [Mon, 5 Aug 2013 22:41:06 +0000 (00:41 +0200)]
libbb: code shrink

function                                             old     new   delta
xmalloc_ttyname                                       46      42      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpc: tweak help text
Denys Vlasenko [Mon, 5 Aug 2013 00:21:36 +0000 (02:21 +0200)]
udhcpc: tweak help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosyslogd: use _PATH_LOG when available
Cédric Cabessa [Mon, 5 Aug 2013 00:09:16 +0000 (02:09 +0200)]
syslogd: use _PATH_LOG when available

Signed-off-by: Cédric Cabessa <ccabessa@genymobile.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoubi_tools: fix typo in strcpy
Paul B. Henson [Sun, 4 Aug 2013 19:07:20 +0000 (21:07 +0200)]
ubi_tools: fix typo in strcpy

Signed-off-by: Paul B. Henson <henson@acm.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoifplugd: use a larger netlink buffer
Tito Ragusa [Sun, 4 Aug 2013 16:08:40 +0000 (18:08 +0200)]
ifplugd: use a larger netlink buffer

function                                             old     new   delta
check_existence_through_netlink                      310     321     +11

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoless: support "less 1<>TTY"
Denys Vlasenko [Sun, 4 Aug 2013 15:41:19 +0000 (17:41 +0200)]
less: support "less 1<>TTY"

function                                             old     new   delta
less_main                                           2466    2507     +41
xmalloc_ttyname                                       46      42      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: add f2fs detection
Sven-Göran Bergh [Thu, 1 Aug 2013 09:05:08 +0000 (11:05 +0200)]
volume_id: add f2fs detection

function                                             old     new   delta
volume_id_probe_f2fs                                   -      98     +98

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoawk: Fix handling of functions with empty body
Bernhard Reutner-Fischer [Wed, 31 Jul 2013 13:29:20 +0000 (15:29 +0200)]
awk: Fix handling of functions with empty body

ammend b79a0fef99627c457548e804fcd6e162b116cbe8 to properly
handle functions defined in another scope.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agovolume_id: nilfs config description.
Sven-Göran Bergh [Wed, 31 Jul 2013 16:30:34 +0000 (18:30 +0200)]
volume_id: nilfs config description.

Config description for nilfs added.

No code change.

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: Adopt to new config style.
Sven-Göran Bergh [Wed, 31 Jul 2013 13:57:59 +0000 (15:57 +0200)]
volume_id: Adopt to new config style.

Config instructions for util-linux/volume_id are moved into the
source files according to the new config feature.

No code change.

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: Adopt to new kbuild style.
Sven-Göran Bergh [Wed, 31 Jul 2013 13:45:20 +0000 (15:45 +0200)]
volume_id: Adopt to new kbuild style.

Kbuild instructions for util-linux/volume_id are moved into the
source files according to the new build feature.

No code change.

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoWhitespace fixes
Denys Vlasenko [Tue, 30 Jul 2013 09:52:58 +0000 (11:52 +0200)]
Whitespace fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agocatv: code shrink
Denys Vlasenko [Tue, 30 Jul 2013 09:41:58 +0000 (11:41 +0200)]
catv: code shrink

catv_main                                            250     227     -23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoRefactor catv. Move visible() from stty to libbb.
Bartosz Golaszewski [Tue, 30 Jul 2013 04:29:42 +0000 (06:29 +0200)]
Refactor catv. Move visible() from stty to libbb.

Fixes the following TODO:

  stty's visible() function and catv's guts are identical. Merge them into
  an appropriate libbb function.

Also makes catv behave exactly like coreutils' cat -v e.g. it'll print 'M-^I'
instead of 'M-   '.

function                                             old     new   delta
visible                                                -      70     +70
do_display                                           431     379     -52
catv_main                                            306     250     -56
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 70/-108)           Total: -38 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounpackers: by users' request, print compression percentage if -v and DESKTOP
Denys Vlasenko [Tue, 30 Jul 2013 03:41:11 +0000 (05:41 +0200)]
unpackers: by users' request, print compression percentage if -v and DESKTOP

function                                             old     new   delta
bbunpack                                             634     731     +97

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc: remove unnecessary "errno = 0"
Denys Vlasenko [Mon, 29 Jul 2013 12:18:32 +0000 (14:18 +0200)]
nc: remove unnecessary "errno = 0"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoiplink: fix build error (IFLA_VLAN_PROTOCOL defined before include)
Denys Vlasenko [Sun, 28 Jul 2013 21:24:55 +0000 (23:24 +0200)]
iplink: fix build error (IFLA_VLAN_PROTOCOL defined before include)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agologread: intercept all fatal signals, not just SIGINT
Denys Vlasenko [Sun, 28 Jul 2013 21:17:00 +0000 (23:17 +0200)]
logread: intercept all fatal signals, not just SIGINT

function                                             old     new   delta
interrupted                                           27      20      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc: remove some dead code
Denys Vlasenko [Sun, 28 Jul 2013 20:24:51 +0000 (22:24 +0200)]
nc: remove some dead code

function                                             old     new   delta
readwrite                                            887     841     -46

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc: exit when both stdin and network are closed.
Denys Vlasenko [Sun, 28 Jul 2013 20:23:12 +0000 (22:23 +0200)]
nc: exit when both stdin and network are closed.

function                                             old     new   delta
nc_main                                             1051    1042      -9
readwrite                                            943     887     -56

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonc: use symbolic SHUT_WR instead of literal 1
Denys Vlasenko [Sun, 28 Jul 2013 19:08:37 +0000 (21:08 +0200)]
nc: use symbolic SHUT_WR instead of literal 1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoUpdate docs/tcp.txt
Denys Vlasenko [Sat, 27 Jul 2013 12:35:51 +0000 (14:35 +0200)]
Update docs/tcp.txt

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agobuildsys: Add helper to list suid applets
Bernhard Reutner-Fischer [Mon, 10 Jun 2013 15:08:22 +0000 (17:08 +0200)]
buildsys: Add helper to list suid applets

Add a helper script that lists all applets that
- do or may require SUID provileges (busybox.cfg.suid)
- do not require SUID provileges (busybox.cfg.nosuid)

Some setups prefer to build two busybox binaries, one that is suid which
contains all applets that do or may require suid privileges, and a
second one for all the rest (which drops suid). To ease splitting these
two binaries, generate a list of CONFIG_ items for the suid binary.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agoAdd notes about TCP programming quirks.
Denys Vlasenko [Thu, 25 Jul 2013 12:00:37 +0000 (14:00 +0200)]
Add notes about TCP programming quirks.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodate: accept 'yyyy-mm-dd HH' and 'yyyy-mm-dd' date formats
Bartosz Golaszewski [Thu, 25 Jul 2013 02:59:46 +0000 (04:59 +0200)]
date: accept 'yyyy-mm-dd HH' and 'yyyy-mm-dd' date formats

function                                             old     new   delta
parse_datestr                                        794     885     +91

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agonetworking: code shrink
Bartosz Golaszewski [Thu, 25 Jul 2013 02:39:04 +0000 (04:39 +0200)]
networking: code shrink

function                                             old     new   delta
in_ether                                               -     124    +124
hexchar2int                                           42       -     -42
ifconfig_main                                       1237    1106    -131
ether_input                                          141       -    -141
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/1 up/down: 124/-314)         Total: -190 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoawk.tests: add test for recent large integer fix
Denys Vlasenko [Mon, 22 Jul 2013 09:49:06 +0000 (11:49 +0200)]
awk.tests: add test for recent large integer fix

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosed: fix matching of newlines by $
Denys Vlasenko [Sun, 21 Jul 2013 20:09:44 +0000 (22:09 +0200)]
sed: fix matching of newlines by $

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounzip: survive lack of CDF on non-streaming zip files
Denys Vlasenko [Sun, 21 Jul 2013 00:31:08 +0000 (02:31 +0200)]
unzip: survive lack of CDF on non-streaming zip files

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoawk: use "long long" as integer type, not "int"
Denys Vlasenko [Sat, 20 Jul 2013 19:23:01 +0000 (21:23 +0200)]
awk: use "long long" as integer type, not "int"

Testcase:
awk "BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}"
2147483647 2147483647 0 2147483648 2147483648 0

(last three values weren't showing right)

function                                             old     new   delta
evaluate                                            3444    3458     +14
fmt_num                                              221     230      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounzip: increase PEEK_FROM_END from 16k to 64k
Denys Vlasenko [Sat, 20 Jul 2013 13:20:46 +0000 (15:20 +0200)]
unzip: increase PEEK_FROM_END from 16k to 64k

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoip link: add VLAN support
Patrick McHardy [Mon, 15 Jul 2013 03:16:13 +0000 (05:16 +0200)]
ip link: add VLAN support

function                                             old     new   delta
do_add_or_delete                                       -    1073   +1073
get_u16                                                -      62     +62
static.protocols                                       -      16     +16
do_iplink                                           1235    1232      -3
do_change                                            495       -    -495
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/1 up/down: 1151/-498)         Total: 653 bytes

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoip: code shrink
Denys Vlasenko [Mon, 15 Jul 2013 03:15:46 +0000 (05:15 +0200)]
ip: code shrink

function                                             old     new   delta
do_ipaddr                                             78      81      +3
do_iprule                                            140     139      -1
do_iptunnel                                          283     278      -5
iprule_modify                                        851     841     -10
ipaddr_modify                                       1293    1236     -57
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 3/-73)             Total: -70 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotypo fix in comment
Denys Vlasenko [Sat, 13 Jul 2013 23:23:06 +0000 (01:23 +0200)]
typo fix in comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoCommonalize typical [b,]k,m suffix struct
Denys Vlasenko [Sat, 13 Jul 2013 21:49:45 +0000 (23:49 +0200)]
Commonalize typical [b,]k,m suffix struct

function                                             old     new   delta
bkm_suffixes                                           -      32     +32
static.km_suffixes                                    24       -     -24
suffixes                                              32       -     -32
static.bkm                                            32       -     -32
head_tail_suffixes                                    32       -     -32
------------------------------------------------------------------------------
(add/remove: 2/6 grow/shrink: 0/0 up/down: 72/-160)           Total: -88 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agochrt: remove warning for _POSIX_PRIORITY_SCHEDULING
Bernhard Reutner-Fischer [Mon, 8 Jul 2013 09:20:13 +0000 (11:20 +0200)]
chrt: remove warning for _POSIX_PRIORITY_SCHEDULING

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agotypo fix in comment
Denys Vlasenko [Mon, 8 Jul 2013 01:13:08 +0000 (03:13 +0200)]
typo fix in comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotail: code shrink
Denys Vlasenko [Mon, 8 Jul 2013 00:39:51 +0000 (02:39 +0200)]
tail: code shrink

function                                             old     new   delta
tail_main                                           1548    1613     +65
tail_read                                            136      34    -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 65/-102)           Total: -37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosed: remove now-redundant backslash-newline handling
Denys Vlasenko [Mon, 8 Jul 2013 00:04:44 +0000 (02:04 +0200)]
sed: remove now-redundant backslash-newline handling

4b0bb9e0fd9ec06e9e61b1a1527ace99ea9fe571 added this code in 2007,
then in a2215b98f7d65bc613b9c8f008d79672402c6a07 more general fix
was added.

function                                             old     new   delta
add_cmd_block                                         98      58     -40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosed: document where we are more liberal then GNU
Denys Vlasenko [Sun, 7 Jul 2013 23:43:40 +0000 (01:43 +0200)]
sed: document where we are more liberal then GNU

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoCall setlocale("") , not "C", if we want to set the default one
Denys Vlasenko [Sun, 7 Jul 2013 12:41:58 +0000 (14:41 +0200)]
Call setlocale("") , not "C", if we want to set the default one

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounicode: check $LC_CTYPE too to detect Unicode mode
Denys Vlasenko [Fri, 5 Jul 2013 20:00:57 +0000 (22:00 +0200)]
unicode: check $LC_CTYPE too to detect Unicode mode

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofoo*sum: Correct syntax error
Cristian Ionescu-Idbohrn [Wed, 3 Jul 2013 17:03:37 +0000 (19:03 +0200)]
foo*sum: Correct syntax error

coreutils/md5_sha1_sum.c:156:3: error: expected '}' before 'else'

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 years agotail: track file size only in -f mode
Denys Vlasenko [Tue, 2 Jul 2013 18:09:15 +0000 (20:09 +0200)]
tail: track file size only in -f mode

This eliminates extra fstat and lseek calls on every read

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofoo*sum: report I/O errors, don't merely exit with 1.
Denys Vlasenko [Tue, 2 Jul 2013 17:11:01 +0000 (19:11 +0200)]
foo*sum: report I/O errors, don't merely exit with 1.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounicode: check $LC_ALL to detect Unicode mode, not only $LANG
Denys Vlasenko [Tue, 2 Jul 2013 15:30:23 +0000 (17:30 +0200)]
unicode: check $LC_ALL to detect Unicode mode, not only $LANG

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowget: do not abort if "_" is encountered in a HTTP header
Denys Vlasenko [Mon, 1 Jul 2013 13:01:50 +0000 (15:01 +0200)]
wget: do not abort if "_" is encountered in a HTTP header

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>