Commit Graph

16687 Commits

Author SHA1 Message Date
Denys Vlasenko
9ec836c033 whois: limit total length of response to 32+2 kb
function                                             old     new   delta
query                                                517     554     +37

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-12-03 14:52:17 +01:00
Denys Vlasenko
356f23de20 init: improve handling of signals racing with each other
Before this change, a request to reboot could be "overwritten" by e.g.
SIGHUP.

function                                             old     new   delta
init_main                                            709     793     +84
packed_usage                                       33273   33337     +64
run_actions                                          109     117      +8
stop_handler                                          87      88      +1
check_delayed_sigs                                   340     335      -5
run                                                  214     198     -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/2 up/down: 157/-21)           Total: 136 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-12-03 14:05:32 +01:00
Denys Vlasenko
113c776f4d init: if tcgetattr() fails, don't even try to tcsetattr()
function                                             old     new   delta
set_sane_term                                        111     114      +3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-12-02 16:39:54 +01:00
Denys Vlasenko
259747caa7 hush: fix preprocessor directives indentation
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-28 10:28:14 +01:00
Tomi Leppanen
1b76ffaae4 grep: add -R
This adds -R option to grep similar to GNU grep. It is the same as -r
but also dereferences symbolic links to directories.

function                                             old     new   delta
grep_main                                            834     850     +16
packed_usage                                       33362   33368      +6
grep_file                                           1440    1441      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 23/0)               Total: 23 bytes

Signed-off-by: Tomi Leppanen <tomi.leppanen@jolla.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-27 17:11:09 +01:00
Denys Vlasenko
008413754b bc: fix comparison bug, closes 12336
function                                             old     new   delta
bc_num_cmp                                           249     259     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-23 17:25:21 +01:00
Alistair Francis
d3539be8f2 Remove stime() function calls
stime() has been deprecated in glibc 2.31 and replaced with
clock_settime(). Let's replace the stime() function calls with
clock_settime() in preperation.

function                                             old     new   delta
rdate_main                                           197     224     +27
clock_settime                                          -      27     +27
date_main                                            926     941     +15
stime                                                 37       -     -37
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/0 up/down: 69/-37)             Total: 32 bytes

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-19 13:08:25 +01:00
Denys Vlasenko
419d0294e9 Updated inittab example documentation
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-17 17:48:53 +01:00
Liu, Shuang (ADITG/ESM)
af6bc54fde chgrp: correct the usage for non-desktop chgrp calls
When IF_DESKTOP is not defined, chown and chgrp only takes option -R -h,
However the usage output of chgrp is wrong:

	$ ./busybox.nosuid chown
	Usage: chown [-Rh]... USER[:[GRP]] FILE...

	$ ./busybox.nosuid chgrp
	Usage: chgrp [-RhLHP]... GROUP FILE...

	$ ./busybox.nosuid chgrp -H group dummy
	chgrp: invalid option -- 'H'
	Usage: chgrp [-RhLHP]... GROUP FILE...

The chgrp is now a wrapper of chown, so the recognized options shall be the same.
This is introduced by 34425389e0

I would expect the correct behavior shall be the same as chown.
So suggest the below patch, the behavior shall be:

	$ ./busybox.nosuid chgrp
	Usage: chgrp [-Rh]... GROUP FILE...

Signed-off-by: Shuang Liu <sliu@de.adit-jv.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-17 17:06:31 +01:00
Denys Vlasenko
b230fdfa9d taskset: tighten the check for stride values
function                                             old     new   delta
taskset_main                                         986     987      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-09 17:32:43 +01:00
Denys Vlasenko
a82fb1b9d8 taskset: implement stride argument
function                                             old     new   delta
taskset_main                                         925     986     +61

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-09 17:07:44 +01:00
Denys Vlasenko
2f57b5139e unxz: show -t in --help
function                                             old     new   delta
packed_usage                                       33236   33247     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-08 16:37:28 +01:00
Denys Vlasenko
e5586605ca taskset: update comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-08 16:32:37 +01:00
Denys Vlasenko
162ac7f45e taskset: add support for taking/printing CPU list (-c option)
function                                             old     new   delta
taskset_main                                         511     855    +344

Based on patch by Fryderyk Wrobel <frd1996@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-01 15:44:49 +01:00
Denys Vlasenko
21806562ca hush: restore redirected stdin
function                                             old     new   delta
restore_redirects                                     52      95     +43
save_fd_on_redirect                                  243     253     +10
hfopen                                                90      99      +9
fgetc_interactive                                    259     261      +2
builtin_type                                         117     115      -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 64/-2)              Total: 62 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-01 14:16:07 +01:00
Denys Vlasenko
ea096d6c13 ntpd: decrease MIN_FREQHOLD by 2, increase "penalty" for largish offset x2
> 2018-07-25:
> ntpd: increase MIN_FREQHOLD by 3
> This means we'll start correcting frequency ~5 minutes after start,
> not ~3.5 ones.
> With previous settings I still often see largish ~0.7s initial offsets
> only about 1/2 corrected before frequency correction kicks in,
> resulting in ~200ppm "correction" which is then slowly undone.

Review of real-world results of the above shows that with small
initial offsets, freq correction can be allowed to kick in sooner,
whereas with large (~0.8s) offsets, we still start freq correction
a bit too soon.

Let's rebalance this a bit.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-30 12:18:07 +01:00
Jo-Philipp Wich
6b4960155e nslookup: implement support for SRV records
Add support for querying and parsing SRV DNS records.

function                                             old     new   delta
send_queries                                        1711    1865    +154
qtypes                                                72      80      +8

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-27 17:07:35 +01:00
Jo-Philipp Wich
8c3b520d4f nslookup: handle replies without RRs
Under some circumstances, a DNS reply might contain no resource records,
e.g. when a valid domain is queried that does not have records of the
requested type.

Example with nslookup from BIND dnsutils:

    $ nslookup -q=SRV example.org
    Server:	10.11.12.13
    Address:	10.11.12.13#53

    Non-authoritative answer:
    *** Can't find example.org: No answer

Currently the busybox nslookup applet simply prints nothing after the
"Non-authoritative answer:" line in the same situation.

This change modifies nslookup to either print "Parse error" or "No answer"
diagnostics, depending on the parse_reply() return value.

function                                             old     new   delta
send_queries                                        1676    1711     +35

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-27 17:02:08 +01:00
Denys Vlasenko
caf5ee0dd9 gunzip: fix incorrect decoding of "fixed" inflate blocks
function                                             old     new   delta
huft_build                                          1008    1022     +14
inflate_block                                       1253    1256      +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 17/0)               Total: 17 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-26 20:04:34 +02:00
Denys Vlasenko
122a8cbd4a hdparm: placate "warning: taking the absolute value of unsigned type"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 17:47:22 +02:00
Denys Vlasenko
9a0c404d5f vi: placate "warning: shifting a negative signed value is undefined"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 17:42:23 +02:00
Denys Vlasenko
f39a71817e read_key(): placate "warning: shifting a negative signed value is undefined"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 17:40:57 +02:00
Denys Vlasenko
d6ff27de15 ntpd: abs(tmx.offset) was truncating a "long" typed value
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 17:35:58 +02:00
Denys Vlasenko
b4ad1d86b6 tc: array address is never NULL
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 13:41:31 +02:00
Denys Vlasenko
e076162897 traceroute: fix gcc-ism
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 13:39:41 +02:00
Denys Vlasenko
e5897d041d suppress a few "unused function" warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 13:05:15 +02:00
Denys Vlasenko
1f1492bb96 netstat: suppress a warning (conversion from 'int' to 'smallint' changes value)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 13:00:01 +02:00
Denys Vlasenko
b4ef2e3467 Makefile.flags: suppress some clang-9 warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 12:56:51 +02:00
Denys Vlasenko
af7169b4a7 clang/llvm 9 fix - do not eliminate a store to a fake "const"
This is *much* better (9 kbytes better) than dropping "*const"
optimization trick.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 12:12:22 +02:00
Denys Vlasenko
e1a7c97ac6 tar: fix fallout of: change -a from meaning "lzma" to mean "autodetect by extension"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 10:30:53 +02:00
Denys Vlasenko
be5a505d77 Remove syscall wrappers around clock_gettime, closes 12091
12091 "Direct use of __NR_clock_gettime is not time64-safe".

function                                             old     new   delta
runsv_main                                          1698    1712     +14
startservice                                         378     383      +5
get_mono                                              31      25      -6
date_main                                            932     926      -6
gettimeofday_ns                                       17       -     -17
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/2 up/down: 19/-29)            Total: -10 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-24 16:26:55 +02:00
Denys Vlasenko
7427406580 shell: better comments in BASE#nn code
function                                             old     new   delta
evaluate_string                                      932     930      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-22 14:25:43 +02:00
Denys Vlasenko
3ef513e787 shell/ulimit: code shrink
text	   data	    bss	    dec	    hex	filename
1001949	    551	   5612	1008112	  f61f0	busybox_old
1001906	    551	   5612	1008069	  f61c5	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-21 16:47:09 +02:00
Denys Vlasenko
fb1103595f gunzip: code shrink by using int-, not short-sized struct member
function                                             old     new   delta
inflate_block                                       1254    1253      -1
inflate_codes                                        629     621      -8
huft_build                                          1054    1008     -46
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-55)             Total: -55 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-20 19:07:06 +02:00
Denys Vlasenko
6572ef6e1e gzip: code shrink
huft_build() still has way too many params

function                                             old     new   delta
lit                                                    -      94     +94
dist                                                   -      94     +94
huft_build                                          1058    1054      -4
inflate_block                                       1281    1254     -27
cpdext                                                30       -     -30
cplext                                                31       -     -31
cpdist                                                60       -     -60
cplens                                                62       -     -62
------------------------------------------------------------------------------
(add/remove: 2/4 grow/shrink: 0/2 up/down: 188/-214)          Total: -26 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-19 18:53:19 +02:00
Denys Vlasenko
c763392458 gzip: code shrink
huft_build() has way too many params

function                                             old     new   delta
inflate_block                                       1293    1281     -12
huft_build                                          1085    1058     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-39)             Total: -39 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-19 18:33:49 +02:00
Denys Vlasenko
95867147f5 telnet: add disabled code to emit EC and IP
> I'm trying to connect to a Korenix 3005 switch through telnet
> for management purposes, and all is well except for the backspace character
> - seems like my switch doesn't handle it too well and instead of erasing
> the last character all it does is print some garbage to the screen.
> I've had the same issue before while using putty, but saw a solution that
> suggests to enable "Telnet special commands" in the options menu, and it
> worked.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-18 16:47:37 +02:00
Denys Vlasenko
37a9008f8e brctl: code shrink
function                                             old     new   delta
show_bridge                                          323     317      -6
brctl_main                                          2171    2164      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-13)             Total: -13 bytes
   text	   data	    bss	    dec	    hex	filename
1002083	    551	   5612	1008246	  f6276	busybox_old
1002065	    551	   5612	1008228	  f6264	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-15 12:31:54 +02:00
James Byrne
ed79af77a4 config: PID_FILE_PATH required for FEATURE_CROND_SPECIAL_TIMES
When crond is built with FEATURE_CROND_SPECIAL_TIMES enabled, it creates
a file called 'crond.reboot' at CONFIG_PID_FILE_PATH, but if
FEATURE_PIDFILE is disabled, this will be an empty string and the file
will be created in the root directory, which is undesirable.

This commit makes PID_FILE_PATH depend on FEATURE_CROND_SPECIAL_TIMES as
well as FEATURE_PIDFILE so that you get sensible behaviour in crond when
FEATURE_PIDFILE is switched off.

Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-14 12:48:38 +02:00
Denys Vlasenko
eb1395147a brctl: tweak help text, fix comments
function                                             old     new   delta
packed_usage                                       33255   33236     -19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-12 19:51:46 +02:00
Denys Vlasenko
b4fa16d5ed brctl: fold show_bridge_ports_ into its caller
function                                             old     new   delta
brctl_main                                          2235    2171     -64

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-12 19:42:37 +02:00
Denys Vlasenko
3398753818 brctl: code shrink
packed_usage                                       33253   33255      +2
write_uint                                            96      90      -6
show_bridge_timer                                     93      69     -24
brctl_main                                          2338    2235    -103
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-133)           Total: -131 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-12 19:24:38 +02:00
Martin Lewis
6dcf563633 brctl: add support for showstp command
function                                             old     new   delta
brctl_main                                           974    2339   +1365
show_bridge_timer                                      -      93     +93
static.state_names                                     -      48     +48
printf_xstrtou                                         -      26     +26
packed_usage                                       33243   33253     +10
show_bridge                                          333     323     -10
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/1 up/down: 1542/-10)         Total: 1532 bytes
   text	   data	    bss	    dec	    hex	filename
 999868	    551	   5612	1006031	  f59cf	busybox_old
1002309	    551	   5612	1008472	  f6358	busybox_unstripped

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-11 17:58:15 +02:00
Denys Vlasenko
42f454b13b dpkg-deb: work around bogus error message when working with XZ compressed packages
function                                             old     new   delta
unpack_xz_stream                                    2309    2317      +8
bb_full_fd_action                                    464     472      +8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-11 14:11:44 +02:00
Martin Lewis
7011eca83a replace: count_strstr - Handle an edge case where sub is empty
If sub is empty, avoids an infinite loop.

function                                             old     new   delta
count_strstr                                          45      63     +18

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-09 14:39:41 +02:00
Martin Lewis
dd46861282 libbb: Converted safe_read to safe_write format
Changed safe_read to be symmetrical to safe_write, it shall
never return EINTR because it calls read multiple times,
the error is considered transient.

function                                             old     new   delta
safe_read                                             44      57     +13

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-09 14:35:55 +02:00
Alistair Francis
ad27d44ebe runsv: Use 64 prefix syscall if we have to
Some 32-bit architectures no longer have the 32-bit time_t syscalls.
Instead they have suffixed syscalls that returns a 64-bit time_t. If
the architecture doesn't have the non-suffixed syscall and is using a
64-bit time_t let's use the suffixed syscall instead.

This fixes build issues when building for RISC-V 32-bit with 5.1+ kernel
headers.

If an architecture only supports the suffixed syscalls, but is still
using a 32-bit time_t report a compilation error. This avoids us have to
deal with converting between 64-bit and 32-bit values. There are
currently no architectures where this is the case.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-08 16:31:54 +02:00
Alistair Francis
902d399292 time: Use 64 prefix syscall if we have to
Some 32-bit architectures no longer have the 32-bit time_t syscalls.
Instead they have suffixed syscalls that returns a 64-bit time_t. If
the architecture doesn't have the non-suffixed syscall and is using a
64-bit time_t let's use the suffixed syscall instead.

This fixes build issues when building for RISC-V 32-bit with 5.1+ kernel
headers.

If an architecture only supports the suffixed syscalls, but is still
using a 32-bit time_t report a compilation error. This avoids us have to
deal with converting between 64-bit and 32-bit values. There are
currently no architectures where this is the case.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-08 16:31:54 +02:00
Alistair Francis
b7b7452f29 date: Use 64 prefix syscall if we have to
Some 32-bit architectures no longer have the 32-bit time_t syscalls.
Instead they have suffixed syscalls that returns a 64-bit time_t. If
the architecture doesn't have the non-suffixed syscall and is using a
64-bit time_t let's use the suffixed syscall instead.

This fixes build issues when building for RISC-V 32-bit with 5.1+ kernel
headers.

If an architecture only supports the suffixed syscalls, but is still
using a 32-bit time_t fall back to the libc call.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-08 16:31:54 +02:00
Michal Kazior
1f1988d525 udhcpc: fix segmentation fault on empty bin opt
The following caused udhcpc to segfault:
  busybox udhcpc -i lo -s /dev/null -x 0x3d:

function                                             old     new   delta
udhcp_str2optset                                     629     641     +12

Signed-off-by: Michal Kazior <michal@plume.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-08 15:14:46 +02:00