Denys Vlasenko [Wed, 7 Sep 2016 12:09:01 +0000 (14:09 +0200)]
mdev: create devices from /sys/dev
Currently some new devices that have a bus but no class will
be missed by mdev coldplug device creation after boot. This
happens because mdev recursively searches /sys/class which will
by definition only find class devices.
Some important devices such as iio and gpiochip does not have
a class. But users will need them.
This switches from using /sys/class as the place to look for
devices to create to using /sys/dev where all char and block
devices are listed.
The subsystem lookup code that provide the G.subsystem
environment variable is changed from using the directory
name of the class device to instead dereference the
"subsystem" symlink for the device, and look at the last
element of the path of the symlink for the subsystem, which
will work with class devices and bus devices alike. (The new
bus-only devices only symlink to the /sys/bus/* hierarchy.)
We delete the legacy kernel v2.6.2x /sys/block device path
code as part of this change. It's too old to be kept alive.
Tested on kernel v4.6-rc2 with a bunch of devices, including
some IIO and gpiochip devices.
With a print inserted before make_device() the log looks
like so:
Create device from "/sys/dev/char/1:1", subsystem "mem"
Create device from "/sys/dev/char/1:2", subsystem "mem"
Create device from "/sys/dev/char/1:3", subsystem "mem"
Create device from "/sys/dev/char/1:5", subsystem "mem"
(...)
Create device from "/sys/dev/block/179:56", subsystem "block"
Create device from "/sys/dev/block/179:64", subsystem "block"
function old new delta
mdev_main 1388 1346 -42
dirAction 134 14 -120
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-162) Total: -162 bytes
Cc: Isaac Dunham <ibid.ag@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 7 Sep 2016 11:16:33 +0000 (13:16 +0200)]
sendmail: make it possible to pause after connection helper is started
If a non-starttls helper is in use, initial 220 response is processed by us,
not by helper.
Some servers consider us to be a spammer if we don't wait for it.
It is not in protocol, but it is a real-life problem.
The workaround in this patch is a magic envvar, $SMTP_ANTISPAM_DELAY:
...
-H 'PROG ARGS' Run connection helper. Examples:
openssl s_client -quiet -tls1 -starttls smtp -connect smtp.gmail.com:25
openssl s_client -quiet -tls1 -connect smtp.gmail.com:465
$SMTP_ANTISPAM_DELAY: seconds to wait after helper connect
...
By using it, people can tweak sendmail behavior even if sendmail invocation
is buried in some scripts.
function old new delta
packed_usage 30464 30497 +33
sendmail_main 1185 1206 +21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 54/0) Total: 54 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Serj Kalichev [Mon, 29 Aug 2016 15:28:34 +0000 (18:28 +0300)]
volume_id: Add support for UBIFS
Signed-off-by: Serj Kalichev <serj.kalichev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 5 Sep 2016 13:20:10 +0000 (15:20 +0200)]
libbb/xwrite: print errno on "short write" errors
Lauri Kasanen:
:: Over at TinyCore, we receive a huge number of questions of the type "I
:: got "short write", what does it mean?". Mostly for the rpi port and when
:: using bb wget.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 1 Sep 2016 09:44:13 +0000 (11:44 +0200)]
libbb/speed_table.c: survive
B115200 and
B230400 not fitting into 16 bits
Seen on OSX.
While at it, expand baud table with
B500000..
B4000000
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 1 Sep 2016 09:16:22 +0000 (11:16 +0200)]
*: placate some compile warnings on OSX
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 31 Aug 2016 23:59:11 +0000 (01:59 +0200)]
sed: fix "sed n (flushes pattern space, terminates early)" testcase failure
Patch based on work by Dengke Du <dengke.du@windriver.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 31 Aug 2016 11:28:53 +0000 (13:28 +0200)]
wget: treat 201,202,203 as success codes too. Closes 9211
This matches "standard" wget.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 29 Aug 2016 13:20:15 +0000 (15:20 +0200)]
sha3sum: fix config text (it's no longer only 512-bit)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 29 Aug 2016 12:05:25 +0000 (14:05 +0200)]
sha3: fix to conform to final SHA3 padding standard, add -a BITS option
function old new delta
hash_file 331 396 +65
md5_sha1_sum_main 485 538 +53
packed_usage 30423 30464 +41
sha3_begin 17 31 +14
sha3_hash 101 110 +9
sha3_end 41 49 +8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 26 Aug 2016 18:14:31 +0000 (20:14 +0200)]
hexdump: fix numerous bugs in handling of backslashes
Was:
t=48\\ t=45\\ t=4c\\ t=4c\\ t=4f\\ t=0a\\
Now:
=48=\n =45=\n =4c=\n =4c=\n =4f=\n =0a=\n
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Peter Korsgaard [Fri, 26 Aug 2016 16:46:34 +0000 (18:46 +0200)]
udhcpc: Unconditionally call deconfig script, not only if lease is active
The udhcpc script may be used to setup fallback configuration (E.G. IPv4LL,
fixed IP address, ..) that also needs to be cleaned up on release (E.G.
when SIGUSR2 is called or on shutdown with -R), so unconditionally call
deconfig.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 23 Aug 2016 18:21:36 +0000 (20:21 +0200)]
build system: always rewrite NUM_APPLETS.h
Conditional rewrite can keep NUM_APPLETS.h mtime old,
this causes make to try to regenerate it at every invocation.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 23 Aug 2016 15:18:45 +0000 (17:18 +0200)]
fdisk: tweak some messages
"Total allocated sectors
2021315 greater than the maximum
2020356"
maximum what?
Turns out, that's the CHS size of the disk.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 23 Aug 2016 14:13:33 +0000 (16:13 +0200)]
fdisk: print much less cryptic partition table
Before:
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 998 255471+ 6 FAT16
What are "blocks"? What is that "+"?
How big is this partition?
Is start/end shown came from LBA fields or CHS fields?
Why are we torturing the user??
After:
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/sdb1 * 0,1,1 996,15,32 32 510974 510943 249M 6 FAT16
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 22 Aug 2016 19:41:05 +0000 (21:41 +0200)]
man: fix parsing of "DEFINE pager xyz". Closes 8976
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 22 Aug 2016 18:56:58 +0000 (20:56 +0200)]
init: fix for FreeBSD console opening. Closes 9031
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 22 Aug 2016 18:19:34 +0000 (20:19 +0200)]
unshare: --network should be --net. Closes 9116
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Kang-Che Sung [Wed, 3 Aug 2016 06:14:04 +0000 (14:14 +0800)]
docs: Update filenames in keep_data_small.txt
The filenames in docs/keep_data_small.txt are a little bit outdated.
It's better to change it to the current name.
decompress_unzip.c -> decompress_gunzip.c
(since commit
774bce8e8ba1e424c953e8f13aee8f0778c8a911)
libbb/messages.c -> libbb/ptr_to_globals.c
(since commit
574f2f43948bb21d6e4187936ba5a5afccba25f6)
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 22 Aug 2016 17:54:12 +0000 (19:54 +0200)]
hush: fix "redirects can close script fd" bug
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 21 Aug 2016 20:00:20 +0000 (22:00 +0200)]
build system: different fix for include/applet_tables.h/include/NUM_APPLETS.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 21 Aug 2016 01:39:39 +0000 (03:39 +0200)]
wget/ssl_helper: update to wolfssl-3.9.8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 20 Aug 2016 13:58:34 +0000 (15:58 +0200)]
hush: do not leak script fds into NOEXEC children
We set all opened script fds to CLOEXEC, thus making then go away
after fork+exec.
Unfortunately, CLOFORK does not exist. NOEXEC children will still see those fds open.
For one, "ls" applet is NOEXEC. Therefore running "ls -l /proc/self/fd"
in a script from standalone shell shows this:
lrwx------ 1 root root 64 Aug 20 15:17 0 -> /dev/pts/3
lrwx------ 1 root root 64 Aug 20 15:17 1 -> /dev/pts/3
lrwx------ 1 root root 64 Aug 20 15:17 2 -> /dev/pts/3
lr-x------ 1 root root 64 Aug 20 15:17 3 -> /path/to/top/level/script
lr-x------ 1 root root 64 Aug 20 15:17 4 -> /path/to/sourced/SCRIPT1
...
with as many open fds as there are ". SCRIPTn" nest levels.
Fix it by closing these fds after fork (only for NOEXEC children).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 20 Aug 2016 13:16:00 +0000 (15:16 +0200)]
hush: bit better comments in redirect code. No logic changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 19 Aug 2016 18:15:26 +0000 (20:15 +0200)]
hush: `cmd` and arithmetic also need the fix for FILE rewind
Discovered by running testsuite with a newest glibc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 19 Aug 2016 16:23:56 +0000 (18:23 +0200)]
hush: fix a bug in FEATURE_SH_STANDALONE=y config. Closes 9186
Run this in a "sh SCRIPT":
sha256sum /dev/null
echo END
sha256sum is a NOEXEC applet. It runs in a forked child. Then child exit()s.
By this time, entire script is read, and buffered in a FILE object
from fopen("SCRIPT"). But fgetc() did not consume entire input.
exit() lseeks back by -9 bytes, from <eof> to 'e' in 'echo'.
(this may be libc-specific).
This change of fd position *is shared with the parent*!
Now parent can read more, and it thinks there is another "echo END".
End result: two "echo END"s are run.
Fix this by _exit()ing instead.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 19 Aug 2016 09:07:31 +0000 (11:07 +0200)]
top: move free(prev_hist) out of signal path
It was seen being called recursively on repeated signals,
leading to double free
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 16 Aug 2016 18:39:52 +0000 (20:39 +0200)]
ifplugd: if SIOCSIFFLAGS fails with ENODEV, don't die
Some user managed to hit a race where iface is gone between SIOCGIFFLAGS
and SIOCSIFFLAGS (!). If SIOCSIFFLAGS fails, treat it the same as failed
SIOCGIFFLAGS
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 16 Aug 2016 13:27:30 +0000 (15:27 +0200)]
less: fix bracket search to match behavior of less 481
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 16 Aug 2016 13:09:40 +0000 (15:09 +0200)]
less: fix SEGV
testcase: echo "" | less, then press ')' key
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Natanael Copa [Wed, 3 Aug 2016 14:21:53 +0000 (16:21 +0200)]
gzip: add test that checks that -9 compresses better than -1
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Natanael Copa [Wed, 3 Aug 2016 14:21:52 +0000 (16:21 +0200)]
gzip: fix compression level bug. Closes 9131
fix broken logic to get the gzip_level_config value from options -1 to
-9.
This fixes an off-by-one bug that caused gzip -9 output bigger files
than the other compression levels.
It fixes so that compression level 1 to 3 are actually mapped to level 4
as comments say.
It also fixes that levels -4 to -9 is mapped to correct level and avoids
out-of-bounds access.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Natanael Copa [Sun, 14 Aug 2016 21:30:29 +0000 (23:30 +0200)]
lineedit: trivial codeshrink for vi-mode
Introduce and use BB_isalnum_or_underscore().
function old new delta
BB_isalnum_or_underscore - 43 +43
vi_word_motion 162 150 -12
vi_end_motion 163 145 -18
vi_back_motion 198 179 -19
BB_isalnum 39 - -39
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/3 up/down: 43/-88) Total: -45 bytes
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 14 Aug 2016 00:54:27 +0000 (02:54 +0200)]
build system: fix include/NUM_APPLETS.h generation
TBH, it's more like "work around my bad makefile-fu" than "fix"...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 14 Aug 2016 00:08:56 +0000 (02:08 +0200)]
libiproute: eliminate some redundant zero stores
function old new delta
do_iprule 974 955 -19
rtnl_dump_request 173 146 -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-46) Total: -46 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 13 Aug 2016 23:30:34 +0000 (01:30 +0200)]
ip: fix an improper optimization: req.r.rtm_scope may be nonzero here
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 13 Aug 2016 21:23:48 +0000 (23:23 +0200)]
cp: fix -i for POSIX mode. Closes 9106
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Miroslav Lichvar [Mon, 1 Aug 2016 18:24:24 +0000 (20:24 +0200)]
ntpd: respond only to client and symmetric active packets
The busybox NTP implementation doesn't check the NTP mode of packets
received on the server port and responds to any packet with the right
size. This includes responses from another NTP server. An attacker can
send a packet with a spoofed source address in order to create an
infinite loop of responses between two busybox NTP servers. Adding
more packets to the loop increases the traffic between the servers
until one of them has a fully loaded CPU and/or network.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 30 Jul 2016 20:29:10 +0000 (22:29 +0200)]
service/fw example: do not ruin $if[], use different name
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 25 Jul 2016 19:34:57 +0000 (21:34 +0200)]
wget: run s_client helper with -servername HOST
This is necessary for multi-hosted TLSed web sites.
function old new delta
spawn_https_helper_openssl 334 441 +107
Based on a patch by Jeremy Chadwick <jdc@koitsu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 25 Jul 2016 15:12:46 +0000 (17:12 +0200)]
ssl_helper.sh: strip was invoked incorrectly
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 25 Jul 2016 14:28:57 +0000 (16:28 +0200)]
var_service/fw: optionally flush all netdevs; optionally prefer one 0/0 routing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 25 Jul 2016 01:56:00 +0000 (03:56 +0200)]
ash: fix handling of ${VAR: -2}
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 22 Jul 2016 16:48:38 +0000 (18:48 +0200)]
config: disentangle PREFER_APPLETS from SH_STANDALONE and SH_NOFORK
On user request.
I thought enabling/disabling them all together is more consistent.
Evidently, some people do want them to be separately selectable.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 21 Jul 2016 12:40:08 +0000 (14:40 +0200)]
hush: fix a possible bug
Not sure this was actually a triggerable bug, but the code looked flaky.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 19 Jul 2016 15:48:55 +0000 (17:48 +0200)]
typo fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 16 Jul 2016 16:33:55 +0000 (18:33 +0200)]
ash: do not leave SIGQUIT ignored on "exec CMD"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 14 Jul 2016 18:58:39 +0000 (20:58 +0200)]
cp: make verbose cp show symlink copies too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 14 Jul 2016 18:06:44 +0000 (20:06 +0200)]
sendmail: include -H and -S in short help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 14 Jul 2016 17:14:54 +0000 (19:14 +0200)]
sendmail: improve help text
* explain which server we contact by default
* explain when auth is done
* -t is not implied! remove that from help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 12 Jul 2016 11:54:35 +0000 (13:54 +0200)]
trylink: use "mktemp tmp.XXXXXXXXXX" to placate OS X
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 11 Jul 2016 17:51:08 +0000 (19:51 +0200)]
{md5,shaN}sum: make -c EMPTY fail
function old new delta
md5_sha1_sum_main 466 485 +19
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 10 Jul 2016 18:15:28 +0000 (20:15 +0200)]
examples: add a useful "see abridged log" script for ntpd service example
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 8 Jul 2016 10:52:24 +0000 (12:52 +0200)]
cpio: tweak help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 6 Jul 2016 19:58:02 +0000 (21:58 +0200)]
getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST
In many cases, this aqllows to drop use of opt_complementary.
Approximately -400 bytes:
function old new delta
getopt32 1423 1502 +79
opt_string 17 18 +1
OPT_STR 24 25 +1
uniq_main 416 406 -10
timeout_main 279 269 -10
sulogin_main 270 260 -10
readprofile_main 1825 1815 -10
ps_main 543 533 -10
pidof_main 245 235 -10
pgrep_main 611 601 -10
od_main 2600 2590 -10
mkfs_minix_main 2684 2674 -10
mkfs_ext2_main 2603 2593 -10
microcom_main 712 702 -10
makemime_main 315 305 -10
ionice_main 282 272 -10
inetd_main 2074 2064 -10
ifplugd_main 1144 1134 -10
halt_main 353 343 -10
getopt_main 636 626 -10
fdisk_main 2854 2844 -10
env_main 206 196 -10
dmesg_main 319 309 -10
conspy_main 1214 1204 -10
awk_main 981 971 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/22 up/down: 81/-220) Total: -139 bytes
text data bss dec hex filename
919373 906 14060 934339 e41c3 busybox_old
918969 906 14060 933935 e402f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 6 Jul 2016 15:16:27 +0000 (17:16 +0200)]
whois: implement -i
function old new delta
whois_main 654 675 +21
packed_usage 30355 30356 +1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 6 Jul 2016 13:45:41 +0000 (15:45 +0200)]
whois: make it actually work
It was doing way too simplistic work of just querying the server,
no redirects, no query massaging. This required user to know a lot about whois,
and enter at least three queries for each host to get meaningful information.
function old new delta
whois_main 209 646 +437
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 5 Jul 2016 19:43:28 +0000 (21:43 +0200)]
build system: fix a few warnings for allnoconfig build
Not that allnoconfig build is useful in any way...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Tue, 5 Jul 2016 13:07:50 +0000 (14:07 +0100)]
libbb: suppress warning about run_applet_and_exit
When busybox is configured to contain a single applet an unnecessary
declaration of run_applet_and_exit results in a warning. Move the
declaration to avoid this.
Reported-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 4 Jul 2016 15:38:01 +0000 (17:38 +0200)]
arp: fix buffer overflow. Closes 9071
function old new delta
arp_main 1910 1898 -12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 3 Jul 2016 18:26:44 +0000 (20:26 +0200)]
udhcpc: run "deconfig" script in manual renew state too. closes 9061
The bug was seen when the following is done:
# killall 1 udhpc; killall 2 udhpc
Performing a DHCP renew
state: 2 -> 5
Sending renew...
Entering released state
state: 5 -> 6 <<<<<<<<<<<<<< not calling script!!!!
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 3 Jul 2016 15:58:54 +0000 (17:58 +0200)]
ntpd: daemonize before DNS resolution
This resolves the following use case problem:
"I start ntpd by default from /etc/init.d
There might be no working network connection (not configured properly for
whatever reason, hardware problems, whatelse).
With busybox 1.25 ntpd seems to loop forever if now NTP servers are found,
blocking the boot process and I never get a login to solve a possible pb or
to do a first time configuration."
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 29 Jun 2016 13:00:52 +0000 (15:00 +0200)]
build system: make CONFIG_FEATURE_USE_BSS_TAIL less funky
CONFIG_FEATURE_USE_BSS_TAIL code was aliasing bb_common_bufsiz1 to _end.
This is unreliable: _end may be not sufficiently aligned.
Change code to simply enlarge COMMON_BUFSIZE when we detect that _end
has significant amount of space to the end of page.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Natanael Copa [Thu, 23 Jun 2016 08:42:40 +0000 (10:42 +0200)]
df: use f_frsize instead of f_bsize for correct sizes
Use the correct field f_frsize instead of f_bsize.
The statfs f_bsize is the "Optimal transfer block size" while the
f_frsize is the "Fragment size (since Linux 2.6)". On some FUSE
filesystems those may differ.
Fixes bug 9046
URL: https://bugs.busybox.net/show_bug.cgi?id=9046
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Bartosz Golaszewski [Thu, 23 Jun 2016 15:19:50 +0000 (17:19 +0200)]
i2cdump: don't use common_bufsiz1
Commit
e6a2f4cc changed the way common_bufsiz1 works. Now it needs to
be initialized before using, but i2cdump wasn't updated by said patch.
Since the fact that we're using common_bufsiz1 here isn't obvious (no
G_INIT() macro, no other global variables), drop it and simply
allocate the integer array required for block reads on the stack.
Tested with i2c block read on a Lenovo Thinkpad laptop.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Jonas Danielsson [Thu, 23 Jun 2016 16:26:32 +0000 (18:26 +0200)]
ping: populate icmp_id field for "simple" ping too
The ICMP RFC says that identifier and sequence number may be zero.
Having them zero for a Echo message, along with a data of zero's
as well will result in a Echo reply message with only zero's.
Some NAT implementations seem to get the checksum wrong on these
packages. Setting a checksum of 0x0 instead of 0xffff.
Through NAT:
Internet Control Message Protocol
Type: 0 (Echo (ping) reply)
Code: 0
Checksum: 0x0000 [incorrect, should be 0xffff]
Identifier (BE): 0 (0x0000)
Identifier (LE): 0 (0x0000)
Sequence number (BE): 0 (0x0000)
Sequence number (LE): 0 (0x0000)
Data (56 bytes)
Data:
000000000000000000000000000000000000000000000000...
[Length: 56]
Without NAT:
Internet Control Message Protocol
Type: 0 (Echo (ping) reply)
Code: 0
Checksum: 0xffff [correct]
Identifier (BE): 0 (0x0000)
Identifier (LE): 0 (0x0000)
Sequence number (BE): 0 (0x0000)
Sequence number (LE): 0 (0x0000)
[Request frame: 189]
[Response time: 0.024 ms]
Data (56 bytes)
Data:
000000000000000000000000000000000000000000000000...
[Length: 56]
And this in turn will make some hardware MAC checksum offloading
engines drop the packet.
(This was seen with a Synopsis MAC, the same one used in for instance the
stmmac Ethernet driver in the linux kernel.)
This change can be seen as a workaround for bugs in other layers.
But just setting an identifier for the Echo message packet will
avoid prodding the hornets nest.
function old new delta
common_ping_main 424 500 +76
Signed-off-by: Jonas Danielsson <jonasdn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 22 Jun 2016 01:10:21 +0000 (03:10 +0200)]
Start 1.26.0 development cycle
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 20 Jun 2016 22:15:49 +0000 (00:15 +0200)]
Bump version to 1.25.0
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 21 Jun 2016 00:04:16 +0000 (02:04 +0200)]
libarchive: fix xmalloc_open_zipped_read_close()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 20 Jun 2016 21:50:26 +0000 (23:50 +0200)]
setsid: fix broken -c
This did not work: setsid sh -c 'anything'
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 20 Jun 2016 14:28:53 +0000 (16:28 +0200)]
typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 20 Jun 2016 10:23:35 +0000 (12:23 +0200)]
scripts/trylink: libbusybox fix
gcc 6.1.1 can emit empty line with spaces
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 20 Jun 2016 09:42:00 +0000 (11:42 +0200)]
libarchive: fix open_zipped()
Last commit broke it (on both MMU and NOMMU)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 20 Jun 2016 09:06:42 +0000 (11:06 +0200)]
libarchive: fix xmalloc_open_zipped_read_close() on NOMMU
The somewhat new "unpack in memory" code was broken
for xmalloc_open_zipped_read_close() on NOMMU: we seek back
over signature, but then expect it to be already consumed.
Stop seeking back in this case.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 20 Jun 2016 09:04:04 +0000 (11:04 +0200)]
randomconfig fixes 5: false positive for tar; mount emits corrupted message
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 20 Jun 2016 08:59:06 +0000 (10:59 +0200)]
modprobe-small: fix bogus handling of unpack errors
"modprobe minix; echo $?"
Was:
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz': No such file or directory
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz': No such file or directory
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz'
modprobe: 'kernel/fs/minix/minix.ko.xz': Success
0
Now:
modprobe: corrupted data
modprobe: read error from 'kernel/fs/minix/minix.ko.xz'
1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 19 Jun 2016 23:40:19 +0000 (01:40 +0200)]
randomconfig fixes 4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 19 Jun 2016 22:36:21 +0000 (00:36 +0200)]
randomconfig fixes 3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 19 Jun 2016 19:54:04 +0000 (21:54 +0200)]
randomconfig fixes 2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 19 Jun 2016 16:15:33 +0000 (18:15 +0200)]
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Tue, 7 Jun 2016 11:12:07 +0000 (12:12 +0100)]
libbb: move common code into run_applet_and_exit
Both calls to run_applet_and_exit are followed by the same code
to print an error message and return status 127. Remove this
duplication and make run_applet_and_exit static.
function old new delta
run_applet_and_exit 675 667 -8
main 119 92 -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-35) Total: -35 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Ron Yorston [Tue, 7 Jun 2016 09:26:24 +0000 (10:26 +0100)]
Allow "busybox <applet>" to work when busybox is disabled
A recent commit made it possible to disable BusyBox's --install
and --list options. However it also stopped "busybox <applet>
<params>" from working.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 6 Jun 2016 00:26:49 +0000 (02:26 +0200)]
ntpd: retry initial DNS resolution (forever, no timeout for now).
Some users start ntpd on boot, and don't babysit it. If it dies because
DNS is not yet up and therefore NTP servers can't be found, users are
not happy.
Example behavior with a peer name which can't be resolved:
ntpd: bad address 'qwe.rty.ghj.kl'
...5 sec...
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
ntpd: bad address 'qwe.rty.ghj.kl'
...
Based on the patch by Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
function old new delta
resolve_peer_hostname - 81 +81
ntpd_main 1130 1061 -69
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 81/-69) Total: 12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Natanael Copa [Thu, 19 May 2016 15:31:59 +0000 (17:31 +0200)]
libbb: fix time parsing of [[CC]YY]MMDDhhmm[.SS]. Closes 8951
If SS is not given a value, it is assumed to be zero.
http://pubs.opengroup.org/onlinepubs/
9699919799/utilities/touch.html
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 31 May 2016 00:42:49 +0000 (02:42 +0200)]
Make busybox an optional applet
If it's disabled, code shrinks by about 900 bytes:
function old new delta
usr_bin 10 - -10
usr_sbin 11 - -11
install_dir 20 - -20
applet_install_loc 184 - -184
run_applet_and_exit 686 21 -665
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 0/1 up/down: 0/-890) Total: -890 bytes
text data bss dec hex filename
911327 493 7336 919156 e0674 busybox_old
909848 493 7336 917677 e00ad busybox_unstripped
but busybox executable by itself does not say anything useful:
$ busybox
busybox: applet not found
Based on the patch by Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 26 May 2016 22:46:38 +0000 (00:46 +0200)]
cp: add -u/--update and --remove-destination
Based on the patch by wdlkmpx@gmail.com
function old new delta
copy_file 1546 1644 +98
add_partition 1270 1362 +92
ask_and_unlink 95 133 +38
do_iproute 132 157 +25
decode_one_format 710 715 +5
cp_main 369 374 +5
ubirename_main 198 202 +4
read_package_field 232 230 -2
bb_make_directory 421 412 -9
packed_usage 30505 30476 -29
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/3 up/down: 267/-40) Total: 227 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 26 May 2016 19:35:46 +0000 (21:35 +0200)]
arping: avoid use of ether_ntoa(). Closes 8926
This is the only non-debug use of ether_ntoa(). By not using it,
we reduce bss:
function old new delta
arping_main 1568 1665 +97
static.asc 18 - -18
ether_ntoa 57 - -57
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/0 up/down: 97/-75) Total: 22 bytes
text data bss dec hex filename
911020 493 7352 918865 e0551 busybox_old
911069 493 7336 918898 e0572 busybox_unstripped
Also, "standard" arping zero-pads MAC. ether_ntoa() does not.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 6 May 2016 16:25:56 +0000 (18:25 +0200)]
sed: fix append command to match GNU sed 4.2.1
This closes one testcase failure
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 24 Apr 2016 16:21:32 +0000 (18:21 +0200)]
flock: merge spawn_and_wait() code patchs for -c and sans-c uses
function old new delta
flock_main 334 319 -15
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 24 Apr 2016 16:19:49 +0000 (18:19 +0200)]
flock: fix -c; improve error handling of fork+exec
function old new delta
flock_main 254 334 +80
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Szabolcs Nagy [Sun, 24 Apr 2016 15:39:02 +0000 (17:39 +0200)]
ip: fix problem on mips64 n64 big endian musl systems
Use designated initializers for struct msghdr.
The struct layout is non-portable and musl libc does not match what busybox expects.
Signed-off-by: Szabolcs Nagy <nsz@port70.net>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 24 Apr 2016 14:18:03 +0000 (16:18 +0200)]
sed: understand \n,\r and \t in i and a commands. Closes 8871
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 24 Apr 2016 12:13:35 +0000 (14:13 +0200)]
generate_BUFSIZ.sh: yet another tweak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 22 Apr 2016 16:09:21 +0000 (18:09 +0200)]
*: slap on a few ALIGN1/2s where appropriate
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"
text data bss dec hex filename
829901 4086 1904 835891 cc133 busybox_before
829665 4086 1904 835655 cc047 busybox
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Fri, 22 Apr 2016 00:00:04 +0000 (02:00 +0200)]
scripts/trylink: document DATA_SEGMENT_ALIGN() hack
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 21 Apr 2016 22:24:53 +0000 (00:24 +0200)]
generate_BUFSIZ.sh: catch BUFSIZE < 1024 also on "big" builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 21 Apr 2016 21:52:35 +0000 (23:52 +0200)]
build system: fix generate_BUFSIZ.sh to not alternate 1k and malloc builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 21 Apr 2016 19:47:45 +0000 (21:47 +0200)]
libbb: constify *bb_common_bufsiz1 (if it is compiled to be a pointer)
This lets gcc optimize much better:
text data bss dec hex filename
922846 910 13056 936812 e4b6c busybox_unstripped.nonconst
920255 910 13056 934221 e414d busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 21 Apr 2016 19:03:51 +0000 (21:03 +0200)]
libbb: make "COMMON_BUFSIZE = 1024 bytes, the buffer will be malloced" work
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 21 Apr 2016 16:54:36 +0000 (18:54 +0200)]
udhcp: add setup_common_bufsiz() as needed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>