aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-03-24whitespace fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-23paste: delimiter list use should restart for each new output lineDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-23typo fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-23paste: new appletMaxime Coste
function old new delta paste_main - 493 +493 packed_usage 31019 31070 +51 applet_names 2569 2575 +6 applet_main 1484 1488 +4 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/0 up/down: 554/0) Total: 554 bytes Signed-off-by: Maxime Coste <mawww@kakoune.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-16dd: call fsync() only once before exiting if conv=fsync is specifiedRostislav Skudnov
Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-16Revert "umount: make -d always active, add -D to suppress it"Denys Vlasenko
This reverts commit 86a03bee1d3d6990c03bf500836b19ec8a1c1f12. Since now our "mount -oloop" creates AUTOCLEARed loopdevs, we no longer need our umount to destroy loopdevs to match the usual util-linux behaviour. Now this revert fixes another, opposite bug: "explicit" mount /dev/loopN and then umount must not drop loopdevs! User complaint is as follows: It seems LOOP_CLR_FD called on a loop-*partition* removes the mapping of the whole *device* - which results in the following: root@LEDE:/# loop=$(losetup -f) root@LEDE:/# echo ${loop} /dev/loop2 root@LEDE:/# losetup ${loop} /IMAGE root@LEDE:/# ls -l ${loop}* brw------- 1 root root 7, 2 Mar 6 20:09 /dev/loop2 root@LEDE:/# partprobe ${loop} root@LEDE:/# ls -l ${loop}* brw------- 1 root root 7, 2 Mar 6 20:09 /dev/loop2 brw------- 1 root root 259, 8 Mar 6 21:59 /dev/loop2p1 brw------- 1 root root 259, 9 Mar 6 21:59 /dev/loop2p2 brw------- 1 root root 259, 10 Mar 6 21:59 /dev/loop2p3 brw------- 1 root root 259, 11 Mar 6 21:59 /dev/loop2p4 brw------- 1 root root 259, 12 Mar 6 21:59 /dev/loop2p5 brw------- 1 root root 259, 13 Mar 6 21:59 /dev/loop2p6 brw------- 1 root root 259, 14 Mar 6 21:59 /dev/loop2p7 brw------- 1 root root 259, 15 Mar 6 21:59 /dev/loop2p8 root@LEDE:/# mount ${loop}p8 /MOUNT # mount loop partition root@LEDE:/# losetup -a | grep $loop # loop dev mapping still there /dev/loop2: 0 /mnt/IMAGE root@LEDE:/# strace umount /MOUNT 2> /log # unmount loop partition root@LEDE:/# losetup -a | grep ${loop} # loop device mapping is gone root@LEDE:/# grep -i loop /log open("/dev/loop2p7", O_RDONLY|O_LARGEFILE) = 3 ioctl(3, LOOP_CLR_FD) = 0 root@LEDE:/# The strace was done to figure out, if maybe umount wrongly ioctl()'s the parent device instead of the partition - it doesn't. I already wasn't a fan of umount implicitly removing the mapping in the first place (as I usually setup and release loop devices with `losetup` and scripts needed to call umount differently in order to work and outside busybox). However taking above (kernel-)behaviour into account - umount calling ioctl(LOOP_CLR_FD) unconditionally potentially causes some nasty side effects Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-16mount: create loop devices with LO_FLAGS_AUTOCLEAR flagDenys Vlasenko
The "autolooped" mount (mount [-oloop] IMAGE /DIR/DIR) always creates AUTOCLEARed loopdevs, so that umounting drops them (and this does not require any code in the umount userspace). This happens since circa linux-2.6.25: commit 96c5865559cee0f9cbc5173f3c949f6ce3525581 Date: Wed Feb 6 01:36:27 2008 -0800 Subject: Allow auto-destruction of loop devices IOW: in this case, umount does not have to use -d to drop the loopdev. The explicit loop mount (mount /dev/loopN /DIR/DIR) does not do this. In this case, umount without -d should not drop loopdev. Unfortunately, bbox umount currently always implies -d, this probably needs fixing. function old new delta set_loop 537 597 +60 singlemount 1101 1138 +37 losetup_main 419 432 +13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 110/0) Total: 110 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-13runit: fix chpst -n -N -u USERDenys Vlasenko
busybox's chpst first switches user/group and then tries to call nice(). Once the root priviledges are dropped, process priority can only be lowered. So negative nice values don't work anymore. Upstream version of chpst correctly calls nice() before switching user. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-13vi: don't touch file with :x when modified_count == 0Denys Vlasenko
Along with it, there are other changes - Check for uppercase X is removed as the expression will be always false and :X itself is another totally different command in standard vim - The status line will show number of written lines instead of lines requested by the colon command. This is also how the standard vim is doing, though the difference is that '!' has to be explicitly specified in vim to allow partial writes Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-17reset: before calling execvp(), reset needs to flush stdoutGlenn Matthews
Signed-off-by: Glenn Matthews <glmatthe@cisco.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-17Fix FEATURE_{GZIP,BZIP2}_DECOMPRESS link errorKang-Che Sung
... when gzip is selected but not gunzip nor zcat, or when bzip2 is selected but not bunzip2 nor bzcat. This regression is introduced in b130f9f758b6404c6d0911a1c120937ae6ab47f8 ("Allow 'gzip -d' and 'bzip2 -d' without gunzip or bunzip2") Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-17udhcpc: make sure we do not overflow poll timeoutDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-17nc_bloaty: use poll() instead of select()Denys Vlasenko
function old new delta readwrite 829 715 -114 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-16udhcp: use poll() instead of select()Denys Vlasenko
function old new delta udhcp_sp_read 65 46 -19 udhcp_sp_fd_set 79 54 -25 udhcpd_main 1530 1482 -48 udhcpc_main 2780 2730 -50 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-142) Total: -142 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-16udhcp: do not clobber errno by signal handlerDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-16nc: use poll() instead of select()Denys Vlasenko
function old new delta nc_main 943 866 -77 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-16tls: covert i/o loop from using select() to poll()Denys Vlasenko
function old new delta tls_run_copy_loop 377 282 -95 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-12sendmail: allow "+" symbol in recipient. Closes 9646Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-12modprobe-small: define and use DEPMOD_OPT_n (option mask)Kang-Che Sung
Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-12modprobe-small: document '-n' in depmod usageKang-Che Sung
Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-07modprobe_small: if only MODPROBE and DEPMOD are selected, no need to test ↵Denys Vlasenko
for them function old new delta modprobe_main 321 306 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-05Reorder modutils config options & fix yet more dependencyKang-Che Sung
- modprobe can indirectly benefit from FEATURE_2_4_MODULES and FEATURE_INSMOD_TRY_MAP options. - The position of config FEATURE_INSMOD_TRY_MMAP prevented some other config options from indenting under FEATURE_2_4_MODULES. Reorder to fix this. - FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is now moved to Config.src under "Common options" section. (I wished to edit this config so that it also work with "big" modutils, but it's not done at the moment. Sorry.) Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-05modutils: fix config options dependency (2)Kang-Che Sung
- The modprobe-small implementation of rmmod no longer chdir's to "/lib/modules/`uname -r`" as it was not necessary for rmmod's operation. (And it no longer need to die if such modules directory doesn't exist.) - Configs DEFAULT_MODULES_DIR and DEFAULT_DEPMOD_FILE no longer depend on MODPROBE_SMALL as the latter may not enable depmod or modprobe that requires these configs. - Clarify DEFAULT_DEPMOD_FILE's description regarding the ".bb" name suffix. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-04httpd: use "Content-Length", not "-length"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-04Replace int -> uint to avoid signed integer overflowRostislav Skudnov
An example of such an error (should be compiled with DEBUG_SANITIZE): runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-04tls: fold AES CBC en/decryption into single functionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-03wget/tls: session_id of zero length is ok (arxiv.org responds with such)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-03ash: add INT_OFF/ON around allocationsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-02ps: avoid -o stat to contain spaces. Closes 9631Denys Vlasenko
function old new delta procps_scan 1227 1236 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-01cmdline module options can be disabled on "big" modutilsKang-Che Sung
Allow module options on command line to be disabled on "big" modutils. Config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is renamed to FEATURE_CMDLINE_MODULE_OPTIONS and no longer depends on !MODPROBE_SMALL (I'm not sure if disabling this is useful on "big" modutils, but at least the macro can serve as a marker and ensure both implementations of same feature have consistent behavior.) Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-01modutils: remove redundant "select PLATFORM_LINUX" configsKang-Che Sung
It is enough to have only applets' configs select PLATFORM_LINUX. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-01modprobe-small: move lsmod code out of modprobe_main()Kang-Che Sung
Having lsmod code inside modprobe_main() makes some of the applet name checking code awkward. Besides, this make busybox x86_64 binary a few bytes smaller. :) function old new delta lsmod_main - 23 +23 modprobe_main 599 564 -35 ------------------------------------------------------------------- (add/remove: 1/0 grow/shrink: 0/1 up/down: 23/-35) Total: -12 bytes Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-02-01modprobe-small: improve config help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-31ash: improve / fix glob expansionFelix Fietkau
When using musl libc glob() a very long string can cause glob() to fail, which leads to an out of memory error being raised by ash. This can happen easily if a very long quoted string contains *, even though no glob expansion should ever be performed on it (since it's quoted). Fix this by properly parsing control characters and escaping and only accept unquoted metacharacters. While we're at it, unify this check for libc and built-in glob expansion Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-30taskset: simplify code a bit; tweak --helpDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-30modprobe-small: fix --help texts, they are from "big" modutilsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-30modutils: fix config options dependencyKang-Che Sung
module.aliases and module.symbols files have no use in modprobe-small implementation. So FEATURE_MODUTILS_ALIAS and FEATURE_MODUTILS_SYMBOLS will depend on !MODPROBE_SMALL. The try_to_mmap_module() function is not called in modprobe-small.c, so I will let FEATURE_INSMOD_TRY_MMAP depend on !MODPROBE_SMALL for now. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Likewise, FEATURE_2_4_MODULES is not used by modprobe-small. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-30wget: add a big explanation what TLS code implements and what does notDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-30libbb: match_fstype() is unreadable in the extreme, fixing itDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29vi,fsck: do not use build timestamp unconditionally. Closes 9626Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29taskset: separate "current" and "new" stringsDenys Vlasenko
Better for constant sharing: text data bss dec hex filename 912997 485 6856 920338 e0b12 busybox_old 912988 485 6856 920329 e0b09 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29typo in commentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29taskset: rewrite to be task size-agnosticDenys Vlasenko
function old new delta packed_usage 31130 31190 +60 taskset_main 623 525 -98 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 60/-98) Total: -38 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29*: add comment about APPLET_ODDNAME formatDenys Vlasenko
It confused me more than once Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-26httpd: defend against attempts to OOM us. Closes 9611Denys Vlasenko
We were strdup'ing "Cookie: foo" every time we saw it. function old new delta handle_incoming_and_exit 2733 2821 +88 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-26adduser: help for -G GRP is misleading, fix itDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-26sh: fix FEATURE_SH_STANDALONE help text: it does not enable NOFORKDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-26libbb: spawn_and_wait() fflushes before forking NOEXEC; child reinits logmodeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-26link: new appletDenys Vlasenko
coreutils grew itself a tiny simplistic alternative to ln: Usage: link FILE LINK Create hard LINK to FILE function old new delta link_main - 75 +75 packed_usage 31114 31131 +17 applet_names 2564 2569 +5 applet_main 1480 1484 +4 applet_install_loc 185 186 +1 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/0 up/down: 102/0) Total: 102 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-25xxd: make -p output lines actually end with a newlineDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>