aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-09-25ash: in heredoc code, fix access past the end of allocated memory. Closes 9276Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-25ash: fix handling of NULs in $'abc\000def\x00asd'. Closes 9286Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-25ifupdown: improve help text, add comment about run-parts error msgDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-24libbb: handle \S in /etc/issueDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-22AUTHORS: Add myself to AUTHORSLinus Walleij
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>
2016-09-21ash: use glob() from libcDenys Vlasenko
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>
2016-09-20examples/var_service/supplicant_if: new service exampleDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-20ifupdown: when flushing addresses with "ip", add label %label%Denys Vlasenko
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>
2016-09-20ash: fix handling of bashism $'xxx' with high-bit chars. Closes 9236Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-20hush: document better where bad redirect syntax is detectedDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-18libnetlink: fix alignment of netlink messagesHauke Mehrtens
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>
2016-09-18libbb: do not use fflush_unlocked, musl does not like fflush_unlocked(NULL)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-17ash: exit after subshell error when errexit option is setRostislav Skudnov
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>
2016-09-17fdisk: fix CONFIG_FEATURE_SUN_LABEL=y buildDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-17fix "aloc" -> "alloc" typosDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-17ash: add a FIXME for bug 9246Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-15svlogd: strip leading '!' from processor linesFrancis Rounds
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>
2016-09-15vi: make "g<key>" error message less likely to show garbageDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-15libbb:/send_to_from: do not require that "to" should have the same AF. ↵Denys Vlasenko
Closes 9146 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-15modutils: support finit_module syscallMike Frysinger
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>
2016-09-13less: switch off nonblock on kbd_fd before exitDenys Vlasenko
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>
2016-09-13less: fall back to using fd #1 for keyboard reading. Closes 9231Denys Vlasenko
function old new delta less_main 2535 2540 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-07mdev: create devices from /sys/devDenys Vlasenko
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>
2016-09-07sendmail: make it possible to pause after connection helper is startedDenys Vlasenko
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>
2016-09-06volume_id: Add support for UBIFSSerj Kalichev
Signed-off-by: Serj Kalichev <serj.kalichev@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-05libbb/xwrite: print errno on "short write" errorsDenys Vlasenko
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>
2016-09-01libbb/speed_table.c: survive B115200 and B230400 not fitting into 16 bitsDenys Vlasenko
Seen on OSX. While at it, expand baud table with B500000..B4000000 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-01*: placate some compile warnings on OSXDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-01sed: fix "sed n (flushes pattern space, terminates early)" testcase failureDenys Vlasenko
Patch based on work by Dengke Du <dengke.du@windriver.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-31wget: treat 201,202,203 as success codes too. Closes 9211Denys Vlasenko
This matches "standard" wget. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-29sha3sum: fix config text (it's no longer only 512-bit)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-29sha3: fix to conform to final SHA3 padding standard, add -a BITS optionDenys Vlasenko
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>
2016-08-26hexdump: fix numerous bugs in handling of backslashesDenys Vlasenko
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>
2016-08-26udhcpc: Unconditionally call deconfig script, not only if lease is activePeter Korsgaard
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>
2016-08-23build system: always rewrite NUM_APPLETS.hDenys Vlasenko
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>
2016-08-23fdisk: tweak some messagesDenys Vlasenko
"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>
2016-08-23fdisk: print much less cryptic partition tableDenys Vlasenko
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>
2016-08-22man: fix parsing of "DEFINE pager xyz". Closes 8976Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-22init: fix for FreeBSD console opening. Closes 9031Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-22unshare: --network should be --net. Closes 9116Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-22docs: Update filenames in keep_data_small.txtKang-Che Sung
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>
2016-08-22hush: fix "redirects can close script fd" bugDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-21build system: different fix for include/applet_tables.h/include/NUM_APPLETS.hDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-21wget/ssl_helper: update to wolfssl-3.9.8Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-20hush: do not leak script fds into NOEXEC childrenDenys Vlasenko
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>
2016-08-20hush: bit better comments in redirect code. No logic changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-19hush: `cmd` and arithmetic also need the fix for FILE rewindDenys Vlasenko
Discovered by running testsuite with a newest glibc Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-19hush: fix a bug in FEATURE_SH_STANDALONE=y config. Closes 9186Denys Vlasenko
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>
2016-08-19top: move free(prev_hist) out of signal pathDenys Vlasenko
It was seen being called recursively on repeated signals, leading to double free Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-16ifplugd: if SIOCSIFFLAGS fails with ENODEV, don't dieDenys Vlasenko
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>