Commit Graph

13599 Commits

Author SHA1 Message Date
Bernhard Reutner-Fischer
d7bfee1edb wget: fix --header to not append duplicate headers
function                                             old     new   delta
wget_main                                           2551    2715    +164
wget_user_headers                                      -      62     +62
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 226/0)             Total: 226 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-18 20:41:02 +01:00
Denys Vlasenko
54e9585e10 trivial code shrink
function                                             old     new   delta
rdate_main                                           246     251      +5
show_entry                                           291     287      -4
daytime_stream                                        44      39      -5
packed_usage                                       30176   30168      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 5/-17)             Total: -12 bytes
   text	   data	    bss	    dec	    hex	filename
 929453	    932	  17684	 948069	  e7765	busybox_old
 929411	    932	  17684	 948027	  e773b	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-18 13:47:46 +01:00
Denys Vlasenko
0cb981c5e2 ls: trivial code shrink
function                                             old     new   delta
display_single                                       914     893     -21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-18 11:29:07 +01:00
Bernhard Reutner-Fischer
70e30e8eec dc: tweak parsing
https://bugs.debian.org/538685
dc requires whitespace between language elements.

We were requiring
1 2 + p
instead of the abbreviated
1 2+p
(for example).

function                                             old     new   delta
stack_machine                                         97     126     +29
dc_main                                              117      79     -38
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 29/-38)             Total: -9 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-16 17:12:04 +01:00
Denys Vlasenko
8e92df15b5 ls: fix year 9999 bug :)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-16 15:36:25 +01:00
Denys Vlasenko
402afe1cc6 modprobe-small: fix thinko in previous commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-13 11:53:33 +01:00
Denys Vlasenko
1fd844267c modprobe-small: if concurrent module load did not succeed, wait
usecase:
two sd cards are being mounted in parallel at same time on dual core. example
modules which are getting loaded is  nls_cp437. While one module is being
loaded , it makes state in /proc/modules as 'coming' and then starts doing its
module init function (in our case - registering nls). meanwhile on other core,
if modprobe returns that is has already been loaded, then it will continue
and search for the nls list which is not yet finished from first module init.
This fails resulting in not mounting sd card.

function                                             old     new   delta
process_module                                       667     746     +79

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-12 17:05:14 +01:00
Bartosz Golaszewski
622a7aab2c i2cget, i2cset, i2cdetect, i2cdump: new applets
Add a minimal implementation of i2cget, i2cset, i2cdump and i2cdetect
tools. Supports most features of upstream i2c-tools.

function                                             old     new   delta
i2cdump_main                                           -    1444   +1444
i2cset_main                                            -    1239   +1239
i2cdetect_main                                         -     611    +611
list_i2c_busses_and_exit                               -     532    +532
packed_usage                                       29975   30438    +463
i2cget_main                                            -     380    +380
check_read_funcs                                       -     140    +140
i2c_funcs_tab                                          -     128    +128
confirm_action                                         -     100    +100
i2c_dev_open                                           -      57     +57
i2c_smbus_access                                       -      44     +44
confirm_or_abort                                       -      43     +43
check_funcs_test_end                                   -      39     +39
i2c_smbus_read_word_data                               -      38     +38
i2c_smbus_read_byte_data                               -      38     +38
i2c_smbus_read_byte                                    -      37     +37
i2c_set_slave_addr                                     -      32     +32
applet_names                                        2480    2512     +32
adap_descs                                             -      32     +32
i2c_set_pec                                            -      29     +29
get_funcs_matrix                                       -      21     +21
i2c_parse_data_addr                                    -      18     +18
i2c_parse_bus_addr                                     -      18     +18
i2c_bus_lookup                                         -      18     +18
i2c_smbus_write_byte                                   -      17     +17
applet_main                                         1440    1456     +16
will_skip                                              -      14     +14
no_support                                             -      11     +11
applet_nameofs                                       720     728      +8
applet_install_loc                                   180     182      +2
------------------------------------------------------------------------------
(add/remove: 26/0 grow/shrink: 5/0 up/down: 5601/0)          Total: 5601 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-10 03:16:25 +01:00
Denys Vlasenko
8c06bc6ba1 unzip: prevent attacks via malicious filenames
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-10 01:30:43 +01:00
Denys Vlasenko
23cfaab47d libpwdgrp: use getpwent() instead of getpwent_r()
function                                             old     new   delta
massage_data_for_non_r_func                            -      90     +90
bb_internal_getpwent                                   -      69     +69
getXXnam_r                                            94     162     +68
fill_bounds                                          131     128      -3
deluser_main                                         355     310     -45
complete_username                                    123      78     -45
getXXnam                                             163      90     -73
massage_data_for_r_func                              103       -    -103
bb_internal_getpwent_r                               121       -    -121
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 1/5 up/down: 227/-407)         Total: -163 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-07 21:21:02 +01:00
Denys Vlasenko
68c048fb23 modprobe-small: fix and simplify rmmod
"rmmod OUT_OF_TREE_MODULE" was not working, because module is not in depmod file.

In general, rmmod doesn't need scanning, it simply unloads every argv[i].

function                                             old     new   delta
rmmod                                                  -      63     +63
modprobe_main                                        449     465     +16
process_module                                       705     667     -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 79/-38)             Total: 41 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-07 20:44:46 +01:00
Kevin Wallace
782ee2aa0e libbb/loop: don't try to re-use existing loop device
loopinfo.lo_file_name is not enough to uniquely identify a file on a system with
multiple mount namespaces.  We could conceivably change this to dedup on
(lo_rdevice, lo_inode), but, as the comment above the deleted code notes, this
whole approach of reusing devices is racy anyway, so it seems better to stop
doing it entirely.

Signed-off-by: Kevin Wallace <k@igneous.io>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-07 19:13:57 +01:00
Denys Vlasenko
a03195941b examples/mdev_fat.conf: document that newer mdev exposes path
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-07 18:14:39 +01:00
Ari Sundholm
f22a838aed dd: add optional support for status=noxfer/none
While at it, added 'B' number suffixes, upstream compat

function                                             old     new   delta
dd_main                                             1469    1543     +74
dd_suffixes                                           88     112     +24
packed_usage                                       30156   30176     +20
dd_output_status                                     372     388     +16
static.status_words                                    -      13     +13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 147/0)             Total: 147 bytes

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-07 01:41:22 +01:00
Denys Vlasenko
7e66102f76 ash: fix a SEGV case in an invalid heredoc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-05 21:00:17 +01:00
Denys Vlasenko
a14fa79592 deluser: implement --remove-home
function                                             old     new   delta
deluser_main                                         308     355     +47
packed_usage                                       30149   30156      +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 54/0)               Total: 54 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-05 18:35:52 +01:00
Denys Vlasenko
3c5d133c7d fstrim: fix help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-04 15:19:38 +01:00
Denys Vlasenko
a75dcd4353 route: fix bogus read error when route table is empty
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-04 10:40:10 +01:00
Denys Vlasenko
09020b1aa8 route: improve -A inet6
Upstream route command shows non-up routes, it shows reject and nonexthop flags.
And we had "ref" and "use" values mixed up...

function                                             old     new   delta
flagvals                                              32      44     +12
flagchars                                              9      12      +3
INET_setroute                                        767     768      +1
INET6_setroute                                       495     496      +1
set_flags                                             43      39      -4
flags_ipvx                                            16       8      -8
route_main                                           632     623      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/3 up/down: 17/-21)             Total: -4 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-03 19:32:44 +01:00
Denys Vlasenko
b62d4d9d57 gzip: trivial code shrink -5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-03 15:25:17 +01:00
Denys Vlasenko
a977778893 ifconfig: fix double free fatal error in INET_sprint
Based on the patch by Zheng Junling <zhengjunling@huawei.com>
and Chen Gang <cg.chen@huawei.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-03 12:11:30 +01:00
Denys Vlasenko
8e74adab01 libbb: make INET[6]_rresolve use sockaddr2{host,dotted}_noport
function                                             old     new   delta
INET_rresolve                                        274     214     -60
INET6_rresolve                                       168      85     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-03 12:07:40 +01:00
Denys Vlasenko
f7f70bf1b3 gzip: speed up and shrink put_16bit()
function                                             old     new   delta
put_16bit                                            104      98      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-02 16:07:07 +01:00
Rich Felker
7f7ade1964 gzip: do not store timestamp in gzip header
Storing the original file's modification time in the output file is
harmful (precludes deterministic results) and unlike official gzip,
the busybox version provides no way to suppress this behavior; the -n
option is silently ignored. Rather than trying to make -n work, this
patch just removes the timestamp-storing functionality. It should be
considered deprecated anyway; it's not Y2038-safe and gunzip ignores
it by default.

Per RFC 1952, 0 is the correct value to store to indicate that there
is no timestamp.

Signed-off-by: Rich Felker <dalias@libc.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-02 16:01:16 +01:00
Denys Vlasenko
5104645cf8 platform.h: enable mempcpy for FreeBSD
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-02 03:51:47 +01:00
Micke Prag
07fa09a952 ubiattach: add option -O
Some images do not have the default VID offset. The option -O must
be used to attach such images.

Signed-off-by: Micke Prag <micke.prag@telldus.se>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-30 18:33:24 +01:00
Martin Kaiser
1cbe93cf4e telnetd: we only need CONFIG_UNIX98_PTYS from the Linux kernel
(re-sending this as it got ignored completey and the format of the
previous mail was probably not correct - please let me know if there's
anything else I can do to get this trivial fix applied)

for telnetd to work, we only need CONFIG_UNIX98_PTYS to be enabled
in the Linux kernel - DEVPTS_FS has been obsolete for some time

Signed-off-by: Martin Kaiser <lists@kaiser.cx>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-30 17:12:38 +01:00
Denys Vlasenko
08f9ffc3f7 dpkg: update supported compression methods
Based on a patch by Ron Yorston <rmy@tigress.co.uk>

function                                             old     new   delta
get_header_tar_xz                                      -      60     +60
filter_accept_list_reassign                          128     188     +60
unpack_package                                       585     621     +36
init_archive_deb_control                              52      76     +24
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/0 up/down: 180/0)             Total: 180 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-30 15:15:38 +01:00
Denys Vlasenko
8c05a74f7e platform.h: mempcpy needs <string.h>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-29 16:41:48 +01:00
Denys Vlasenko
ff3f3accc6 ntpd: get rid of G.initial_poll_complete
This speeds up syncing - now happens only just
two replies from a peer. Especially useful for "ntpd -q".
Shouldn't have ill effects: if we chose a bad peer,
we will discover it later and switch to another one.

The code is even smaller this way.

Suggested by Miroslav Lichvar <mlichvar@redhat.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-29 16:31:36 +01:00
Denys Vlasenko
936c401077 dhcpd: fix an improper widening conversion
We wanted to detect when tv_sec = unsigned1 - unsigned2
underflows by looking at tv_sec's sign. But if tv_sec
is long and it is wider than unsigned, we get unsigned -> long
conversion which is in this case never negative.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-27 21:59:40 +01:00
Denys Vlasenko
64b744997e ftpd: prevent zombies. closes 7832
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-26 15:45:48 +01:00
Denys Vlasenko
50a6d86520 platform.h: add compat mempcpy
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-25 22:08:46 +01:00
Denys Vlasenko
cc70b6f8b6 depmod: simple memory optimization
function                                             old     new   delta
filename2modname                                      67      86     +19
parse_module                                         374     351     -23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-24 22:30:30 +01:00
Denys Vlasenko
86031a5ffd trim extra newlines in help texts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-24 19:46:45 +01:00
Natanael Copa
9de69c024c modprobe: fix modprobe -r and parsing of /etc/modprobe.d
This fixes a regression introduced with commit 78854520 (modprobe:
revert checking for /, stop doing basename() on modprobe args,
2015-01-01) that broke modprobe options stored in /etc/modprobe.conf and
/etc/modprobe.d/*.conf.

This also fixes modprobe -r

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-19 19:15:24 +01:00
Denys Vlasenko
76b2262b9b modprobe: fix "modprobe devname:snd/timer" case (alias with a slash)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-15 03:04:23 +01:00
Denys Vlasenko
e998b08f11 modprobe: fix recent breakage: modules.dep reading code needs to strip dirname
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-15 02:49:59 +01:00
Denys Vlasenko
1b6715345f modprobe-small: code shrink
function                                             old     new   delta
pathname_matches_modname                              80      42     -38

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-11 17:46:56 +01:00
Denys Vlasenko
3c75b1c34e modprobe-small: fix recent breakage: modprobe -r was using full path
"modprobe -r MODNAME", after it found the full module pathname,
should strip dirpath before trying to remove the module.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-11 17:40:30 +01:00
Denys Vlasenko
39f017293a diff: fix a bug in diffing against stdin. Closes 7784
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-11 16:41:54 +01:00
Ron Yorston
70f4320b40 vi: fix reading of file after last line
If the :r command is used to read a file after the last line of the
buffer the last line of the buffer and the first line of the file
are joined.  An extra blank line appears at the end of the buffer.

   file 1
   file 1
   file 1file 2
   file 2
   file 2

	~
	~

The insertion point is normally at the start of the line following the
specified line.  When the specified line is the last one the next_line
function baulks at moving to the non-existent following line.

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-07 18:23:29 +01:00
Ron Yorston
e5213cee38 vi: failure to open file is not an error when initialising buffer
Commit 32afd3a introduced these regressions on the master branch:

Starting vi with no filename on the command line gives the status message
"'(null)' Bad address" instead of "- No file 1/1 100%".

Starting vi with a non-existent file on the command line gives the status
message "'new.txt' No such file or directory" instead of "- new.txt 1/1 100%"

Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-07 17:00:48 +01:00
Denys Vlasenko
08364dab75 depmod: fix recent breakage in modules.dep generation
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-07 14:39:01 +01:00
Tito Ragusa
e5cae08f12 libpwdgrp: line counting in error meesages is broken, remove it
Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-06 01:22:36 +01:00
René Rhéaume
e76957708b swaponoff: add support for -e
Signed-off-by: René Rhéaume <rene.rheaume@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 20:35:00 +01:00
Denys Vlasenko
1ec49732e2 mpstat: code shrink
function                                             old     new   delta
get_uptime                                           134     129      -5
get_irqs_from_stat                                   110     103      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 18:39:23 +01:00
Guillermo Rodriguez
75a1403f26 free: handle "cached" value too
function                                             old     new   delta
free_main                                            356     481    +125

Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 18:34:53 +01:00
Denys Vlasenko
da9212667c libbb: code shrink by factoring out common update_utmp_DEAD_PROCESS
function                                             old     new   delta
update_utmp_DEAD_PROCESS                               -      17     +17
telnetd_main                                        1685    1674     -11
mark_terminated                                       56      45     -11
handle_sigchld                                        74      63     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 15:37:58 +01:00
Denys Vlasenko
08b90a9d10 deleting unused ntpd_simple.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 15:12:37 +01:00