Denys Vlasenko [Tue, 27 Sep 2016 19:02:35 +0000 (21:02 +0200)]
mount: for cifs, dont insert "ip=ADDR" option if user gave it explicitly
This makes it possible to use scoped IPv6 addresses:
mount -t cifs -o ip=<ADDR>%<iface_id> //<ADDR>/test test
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 26 Sep 2016 18:47:17 +0000 (20:47 +0200)]
examples: wpa_supplicant.conf has a wrong field deleted in examples
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 26 Sep 2016 18:36:30 +0000 (20:36 +0200)]
mount: tweak "IPv6 scoped addr" commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 26 Sep 2016 17:53:04 +0000 (19:53 +0200)]
libbb: make xmalloc_sockaddr2dotted use NI_NUMERICSCOPE
Gives "mount -t cifs //fe80::6a05:caff:fe3e:dbf5%eth0/test test"
a chance to work: mount must pass "ip=numeric_IPv6%numeric_iface_id"
in the omunt option string. Currently, it does not.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 26 Sep 2016 12:37:12 +0000 (14:37 +0200)]
libbb/speed_table.c: expand comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Mon, 26 Sep 2016 06:52:52 +0000 (08:52 +0200)]
typo fix in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 25 Sep 2016 19:24:04 +0000 (21:24 +0200)]
ash: in heredoc code, fix access past the end of allocated memory. Closes 9276
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 25 Sep 2016 18:54:25 +0000 (20:54 +0200)]
ash: fix handling of NULs in $'abc\000def\x00asd'. Closes 9286
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 25 Sep 2016 00:05:24 +0000 (02:05 +0200)]
ifupdown: improve help text, add comment about run-parts error msg
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 24 Sep 2016 21:50:43 +0000 (23:50 +0200)]
libbb: handle \S in /etc/issue
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Linus Walleij [Tue, 20 Sep 2016 21:31:56 +0000 (23:31 +0200)]
AUTHORS: Add myself to AUTHORS
Instead of complaining that my authorship of the rewrite of
the mdev to use /sys/dev is totally gone from the git history
I bravely take credit by adding myself to the AUTHORS file
instead, he he.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Wed, 21 Sep 2016 14:25:58 +0000 (16:25 +0200)]
ash: use glob() from libc
Adapted from dash.
The "homegrown" glob code is retained (ifdef'ed out).
This changes was inspired by bug 9261, which detected out-of bounds use of heap
for 2098 byte long name in the "homegrown" code. This is still not fixed...
function old new delta
expandarg 960 982 +22
static.syntax_index_table 26 25 -1
static.spec_symbls 27 26 -1
static.metachars 4 - -4
addfname 42 - -42
msort 126 - -126
expmeta 528 - -528
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 1/2 up/down: 22/-702) Total: -680 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 20 Sep 2016 16:09:00 +0000 (18:09 +0200)]
examples/var_service/supplicant_if: new service example
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 20 Sep 2016 15:31:11 +0000 (17:31 +0200)]
ifupdown: when flushing addresses with "ip", add label %label%
User report:
or our board we setup eth0:0 on a 10.10.10.x/29 netwrok.
The problem is ip addr flush dev eth0:0 removes all ip addresses from
eth0. You can see this if you run
ip -stat -stat addr flush dev eth0:0
2: eth0 inet 172.27.105.10/22 brd 172.27.107.255 scope global eth0
valid_lft forever preferred_lft forever
2: eth0 inet 10.10.10.9/29 scope global eth0:0
valid_lft forever preferred_lft forever
2: eth0 inet6 fe80::a2f6:fdff:fe18:2b13/64 scope link
valid_lft forever preferred_lft forever
*** Round 1, deleting 3 addresses ***
*** Flush is complete after 1 round ***
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 20 Sep 2016 15:04:09 +0000 (17:04 +0200)]
ash: fix handling of bashism $'xxx' with high-bit chars. Closes 9236
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 20 Sep 2016 14:22:24 +0000 (16:22 +0200)]
hush: document better where bad redirect syntax is detected
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Hauke Mehrtens [Fri, 16 Sep 2016 20:40:28 +0000 (22:40 +0200)]
libnetlink: fix alignment of netlink messages
A padding to align a message should not only be added between
different attributes of a netlink message, but also at the end of the
message to pad it to the correct size.
Without this patch the following command does not work and returns an
error code:
ip link add type nlmon
Without this ip from busybox sends this:
sendmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=
00000000},
msg_namelen=12, msg_iov=[{iov_base={{len=45, ...},
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\22\0\t\0\1nlmon"}, iov_len=45}],
msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 45
return value: 2
The normal ip utile from iproute2 sends this:
sendmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=
00000000},
msg_namelen=12, msg_iov=[{iov_base={{len=48, ...},
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\22\0\t\0\1nlmon\0\0\0"}, iov_len=48}],
msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 48
return value: 0
With this patch ip from busybox sends this:
sendmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=
00000000},
msg_namelen=12, msg_iov=[{iov_base={{len=48, ...},
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\22\0\t\0\1nlmon\0\0\0"}, iov_len=48}],
msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 48
return value: 0
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sun, 18 Sep 2016 19:49:30 +0000 (21:49 +0200)]
libbb: do not use fflush_unlocked, musl does not like fflush_unlocked(NULL)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Rostislav Skudnov [Fri, 16 Sep 2016 19:04:02 +0000 (19:04 +0000)]
ash: exit after subshell error when errexit option is set
When "set -e" option is on, shell must exit when any command fails,
including compound commands of the form (compound-list) executed in a
subshell. Bash and dash shells have this behaviour.
Also add a corresponding testcase.
Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 17 Sep 2016 19:05:06 +0000 (21:05 +0200)]
fdisk: fix CONFIG_FEATURE_SUN_LABEL=y build
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 17 Sep 2016 18:58:22 +0000 (20:58 +0200)]
fix "aloc" -> "alloc" typos
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Sat, 17 Sep 2016 18:53:47 +0000 (20:53 +0200)]
ash: add a FIXME for bug 9246
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Francis Rounds [Wed, 14 Sep 2016 11:53:51 +0000 (11:53 +0000)]
svlogd: strip leading '!' from processor lines
When using svlogd's processor functionality to run arbitrary commands
on log rotation, the line in the config is executed verbatim, i.e. the
exclamation mark is included.
For example, if the config file contains:
s100
!cat
then when it's time to rotate the log files after each 100 bytes, sh -c
"!cat" will be run, instead of sh -c "cat" as intended. The result is
svlogd logging
/bin/bash: !cat: command not found
svlogd: warning: processor failed, restart: /tmp/svlogd/
over and over again as it keeps attempting to execute the processor and
failing (unless you happen to have a "!cat" binary around :)).
Skipping the exclamation mark when performing the wstrdup() fixes the
issue.
Signed-off-by: Francis Rounds <francis.rounds@4bridgeworks.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 15 Sep 2016 11:53:42 +0000 (13:53 +0200)]
vi: make "g<key>" error message less likely to show garbage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Thu, 15 Sep 2016 11:20:51 +0000 (13:20 +0200)]
libbb:/send_to_from: do not require that "to" should have the same AF. Closes 9146
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Mike Frysinger [Thu, 15 Sep 2016 10:16:33 +0000 (12:16 +0200)]
modutils: support finit_module syscall
On some systems like Chromium OS, loading modules from non-verified
filesystems is denied. Only finit_module is allowed because an open
fd is passed which can be checked against a verified location.
Change the module loading code to first attempt finit_module and if
that fails for whatever reason, fall back to the existing logic.
On x86_64, this adds ~80 bytes to modutils/modutils.o and ~68 bytes
to modutils/modprobe-small.o.
Signed-off-by: Mike Frysinger <vapier@chromium.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 13 Sep 2016 19:05:48 +0000 (21:05 +0200)]
less: switch off nonblock on kbd_fd before exit
This is only necessary if we use stdout fd.
function old new delta
less_exit 32 51 +19
less_main 2540 2543 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 22/0) Total: 22 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko [Tue, 13 Sep 2016 18:53:38 +0000 (20:53 +0200)]
less: fall back to using fd #1 for keyboard reading. Closes 9231
function old new delta
less_main 2535 2540 +5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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>