aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * ash: use pgetc_eatbnl() in more placesDenys Vlasenko2018-03-317-35/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of upstream commit: Date: Thu Mar 8 08:37:11 2018 +0100 Author: Harald van Dijk <harald@gigawatt.nl> parser: use pgetc_eatbnl() in more places dash has a pgetc_eatbnl function in parser.c which skips any backslash-newline combinations. It's not used everywhere it could be. There is also some duplicated backslash-newline handling elsewhere in parser.c. Replace most of the calls to pgetc() with calls to pgetc_eatbnl() and remove the duplicated backslash-newline handling. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Not adding "readtoken1(pgetc_eatbnl(), DQSYNTAX..." changes, since readtoken1() handles the "starts with backslash + newline" case itself. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: 'nolog' and 'debug' options cause "$-" to wreak havocMartijn Dekker2018-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit: Date: Tue Mar 6 17:40:37 2018 +0000 expand: 'nolog' and 'debug' options cause "$-" to wreak havoc Op 29-03-17 om 20:02 schreef Martijn Dekker: > Bug: if either the 'nolog' or the 'debug' option is set, trying to > expand "$-" silently aborts parsing of an entire argument. > > $ dash -o nolog -c 'set -fuC; echo "|$- are the options|"; set +o nolog; echo "|$- are the options|"' > | > |uCf are the options| > $ dash -o debug -c 'set -fuC; echo "|$- are the options|"; set +o debug; echo "|$- are the options|"' > | > |uCf are the options| This turned out to be easy to fix. The routine producing the "$-" expansion failed to skip options for which there is no option letter, but only a long-form name. In dash, 'nolog' and 'debug' are currently the only two such options. Patch below. - Martijn Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> In bbox ash, pipefail is the option which exhibited this. Signed-off-by: Martijn Dekker <martijn@inlv.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * stat: fix a typo: s/romfs/ramfs/, closes 10876Denys Vlasenko2018-03-311-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: fix a signedness bugDenys Vlasenko2018-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Testcase: set -- a ""; space=" "; printf "<%s>\n" "$@"$space Before: <a > After: <a> <> It usually does not bite since bbox forces -funsigned-char build. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash,hush: new test dollar_repl_slash_bash2.testsDenys Vlasenko2018-03-304-0/+6
| | | | | | | | | | | | This fails for ash. hush works. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix "char == CTLfoo" comparison signedness bugDenys Vlasenko2018-03-301-3/+3
| | | | | | | | | | | | | | It usually does not bite since bbox forces -funsigned-char build. But for some reason void linux people disabled that. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: use F_DUPFD_CLOEXEC and O_CLOEXECDenys Vlasenko2018-03-301-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta setjobctl 371 367 -4 setinputfile 226 220 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-10) Total: -10 bytes Based on patch by Mark Marshall <mark.marshall@omicronenergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * examples/var_service: new example: dnsmasq serviceDenys Vlasenko2018-03-307-0/+165
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * cpio: extract "unsafe" symlinks the same way tar/unzip doesNatanael Copa2018-03-301-0/+2
| | | | | | | | | | | | | | | | function old new delta cpio_main 588 596 +8 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * svok: new applet (daemontools compat)Denys Vlasenko2018-03-303-7/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta svok_main - 127 +127 packed_usage 32705 32757 +52 applet_names 2756 2761 +5 applet_main 1588 1592 +4 bb_banner 46 47 +1 sv 1286 1284 -2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/1 up/down: 189/-2) Total: 187 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ifplugd service example: always run up/down script on startupDenys Vlasenko2018-03-301-8/+9
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ifplugd: if SIOCSIFFLAGS fails with EADDRNOTAVAIL, don't dieStefan Agner2018-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using ifplugd on a RNDIS interface with monitor mode, using SIOCSIFFLAGS seems to fail with EADDRNOTAVAIL. Treat it the same as if iface disappeared again. This has been observed on a Tegra TK1 using Linux 4.14. There seem to be a race when the kernel is creating the device: ifplugd(usb0): started: BusyBox v1.24.1 (2018-03-27 09:47:48 CEST) ifplugd(usb0): interface doesn't exist, waiting ifplugd(usb0): interface appeared ifplugd(usb0): upping interface ifplugd(usb0): setting interface flags failed: Cannot assign requested address <exit> With this patch ifplugd is successful in upping the device the second time around: ifplugd(usb0): upping interface ifplugd(usb0): using SIOCETHTOOL detection mode ifplugd(usb0): interface appeared ifplugd(usb0): upping interface ifplugd(usb0): setting interface flags failed: Cannot assign requested address ifplugd(usb0): interface appeared ifplugd(usb0): upping interface ifplugd(usb0): using SIOCETHTOOL detection mode ifplugd(usb0): link is up ifplugd(usb0): executing '/etc/ifplugd/ifplugd.usb.action usb0 up' ifplugd up ifplugd(usb0): exit code: 0 function old new delta up_iface 120 127 +7 Signed-off-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * fbsplash: support configurable image positionPeter Korsgaard2018-03-291-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some setups (E.G. for supporting different screen resolutions), positioning the image somewhere else than the top left corner may be interesting. Add support for IMG_LEFT/IMG_TOP settings to specify the image location, similar to how it is done for the progress bar. function old new delta fbsplash_main 994 1038 +44 static.param_names 57 74 +17 packed_usage 32631 32647 +16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 77/0) Total: 77 bytes Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * grep: fix echo "aa" | busybox grep -F -w "a" (should not match)Denys Vlasenko2018-03-292-1/+7
| | | | | | | | | | | | | | function old new delta grep_file 1461 1470 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * fstrim: do not check that specified file is on a block deviceDenys Vlasenko2018-03-291-3/+11
| | | | | | | | | | | | | | | | | | Kernel will surely inform us in FITRIM does not make sense on a given file. function old new delta fstrim_main 241 221 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: add a FIXME commentDenys Vlasenko2018-03-281-0/+6
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash,hush: fix "saved" redirected fds still visible in childrenDenys Vlasenko2018-03-2814-13/+92
| | | | | | | | | | | | | | | | | | | | Based on a patch by Mark Marshall <mark.marshall@omicronenergy.com> function old new delta dup_CLOEXEC - 49 +49 fcntl_F_DUPFD 46 - -46 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: use BUILD_BUG_ON in utoa_to_buf()Denys Vlasenko2018-03-281-4/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ifupdown: do not fail if interface disappears during ifdownKaarle Ritvanen2018-03-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Interface may not exist because it got deleted by an ifdown hook script earlier. This may happen when a virtual interface, such as VLAN, has multiple iface blocks defined. function old new delta static_down6 14 40 +26 static_down 54 70 +16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 42/0) Total: 42 bytes Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ioctl(SIOCGIFINDEX) does not require clearing of entire ifrDenys Vlasenko2018-03-273-3/+3
| | | | | | | | | | | | | | | | | | | | function old new delta INET6_setroute 492 472 -20 do_iplink 1357 1330 -27 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-47) Total: -47 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * netstat: produce numeric-ip output for non-resolved namesMark Marshall2018-03-271-2/+5
| | | | | | | | | | | | | | | | | | | | | | If we don't ask for numerical output, and the symbolic look-up failed we used to get "(null)", but the numeric output would be better. function old new delta ip_port_str 109 121 +12 Signed-off-by: Mark Marshall <mark.marshall@omicronenergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ssl_client: fix option parsingRon Yorston2018-03-201-1/+1
| | | | | | | | | | | | | | | | The wrong character was used to indicate options taking an integer parameter. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * top: fix "warning: unused variable new_mask"Denys Vlasenko2018-03-191-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: add -o and -k to short --help tooDenys Vlasenko2018-03-161-5/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tar: add -k and -o to --helpDenys Vlasenko2018-03-161-3/+3
| | | | | | | | | | | | | | -o Don't restore user:group -k Don't replace existing files Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: add some debug for the forkshell data blockRon Yorston2018-04-011-0/+87
| |
* | ash: align funcblocksize handling with upstreamRon Yorston2018-04-011-68/+76
| | | | | | | | | | | | Upstream BusyBox removed the global funcblocksize variable. Instead a local variable with the same name is passed to and returned from all functions that calculate item sizes. Do the same here.
* | ash: align funcstring handling with upstreamRon Yorston2018-04-011-27/+30
| | | | | | | | | | | | | | | | | | Upstream BusyBox removed the funcstringsize variable. String sizes are included in funcblocksize then strings are copied into the data block starting from the end. Do the same here. Add a function to calculate string lengths, allowing for NULL string pointers (as nodeckstrup does already for MinGW).
* | ash: reorder items in forkshell data blockRon Yorston2018-04-011-48/+47
| | | | | | | | | | | | Put the nodeptr array before funcblock and funcstring. Since nodeptr now immediately follows the forkshell structure in the data block we can declare it in the structure and do away with nodeptr_offset.
* | libbb: improve stripping of extension from argv[0]Ron Yorston2018-03-311-15/+11
| | | | | | | | | | | | | | | | | | | | Use library routines to reduce the amount of code needed to strip the extension from argv[0] in the BusyBox main function. The name of the executable can now have any of the standard extensions, none at all, or a trailing dot. Related to GitHub issue #20.
* | ash: revise handling of builtin environment variables during forkRon Yorston2018-03-311-32/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit db03ff5ea made some improvements to the handling of builtin environment variables during forkshell. However, more can be done. Currently the calculated size of varinit doesn't match what's actually copied. It overestimates the amount of string space and the number of pointers. The text of each builtin environment variable is also copied twice: once as part of vartab and again from varinit. Remove the code to copy varinit via the forkshell block. Instead use information from vartab and varinit_data to reinitialise varinit and fix the links in vartab. In addition, ensure that the LINENO variable is properly initialised in the child.
* | ash: copy environment variables when importing themRon Yorston2018-03-301-0/+4
| | | | | | | | | | | | | | | | | | Clearing the environment on Microsoft Windows results in pointers used for shell variables becoming invalid. Take copies when the environment is imported. This only affects NOFORK applets invoked by tryexec, but the number of NOFORK applets has increased considerably in recent years.
* | busybox: let --list-full display nofork/noexec appletsRon Yorston2018-03-291-6/+22
| | | | | | | | | | | | The --list-full option to busybox-w32 was disabled because it didn't make sense to display Unix install paths. Repurpose this option to display whether applets are NOFORK or NOEXEC.
* | win32: return correct exit status from waitpidRon Yorston2018-03-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | The exit status from _cwait wasn't being correctly returned. This resulted, for example, in the exit status of xargs being incorrect. Running this: $ ls | xargs ls in a directory containing filenames with spaces should cause 'ls' to fail and 'xargs' to return an exit status of 123.
* | win32: save a few bytesRon Yorston2018-03-292-6/+6
| | | | | | | | | | | | | | | | In the recently-added code to pass applet names to child processes use local arrays to build the environment variables rather that allocating them every time. mingw_spawn can call mingw_spawn_proc instead of mingw_spawn_1.
* | win32: improve dependency checking for resourcesRon Yorston2018-03-291-2/+5
| |
* | ps: display applet names in process listingRon Yorston2018-03-282-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In standalone shell mode all busybox-w32 applets are displayed as 'busybox.exe' in a process listing. I haven't found a satisfactory way to query a running instance of busybox-w32 to determine which applet it's running. Handle a couple of cases: - the process running the process scan knows its own PID and knows which applet it is; - just before invoking applet_main set an environment variable whose name contains the PID and whose value is the current applet name. Children running a process scan will inherit their parent's environment and can therefore match the parent's PID to its applet name.
* | ps: clear status for each processRon Yorston2018-03-282-3/+6
| | | | | | | | | | | | | | | | | | The original procps_scan function takes care to clear the status information before handling each process. Do the same for the WIN32 version. This requires moving the snapshot handle to the part of the structure that isn't cleared on each iteration.
* | Add a VERSIONINFO resource to the binaryRon Yorston2018-03-282-2/+34
| | | | | | | | | | | | | | | | | | | | If icons are enabled we might as well store some version information. The string manipulation is based on this: https://stackoverflow.com/questions/8540485/how-do-i-split-a-string-in-make Closes issue #108.
* | Add a note about /dev/urandom to README.mdRon Yorston2018-03-271-0/+1
| |
* | timeout: futher improvementsRon Yorston2018-03-271-7/+19
| | | | | | | | | | | | | | | | | | When signal 0 is sent to the child process both coreutils and BusyBox timeout allow the child to continue running. busybox-w32 was sending the signal and then killing the child: be consistent. When timeout is interrupted by SIGTERM or Ctrl-C from an interactive shell kill the child too.
* | ash: use SIGTERM to kill processesRon Yorston2018-03-271-1/+9
| | | | | | | | | | When Ctrl-C is pressed try killing processes with SIGTERM initially. If they're still running after a short pause use sterner measures.
* | win32: changes to kill(2)Ron Yorston2018-03-272-14/+22
| | | | | | | | | | | | | | | | | | The names of the callbacks to kill processes with a given signal were confusing because they referred to the implementation rather than the intent. Create the new function kill_SIGTERM_by_handle which is more efficient when a handle to the process to be killed is already available.
* | Allow icon resources to be included in the binaryRon Yorston2018-03-2711-5/+83
| | | | | | | | | | Include two styles of icon from the GNOME Adwaita theme. These are enabled by default and add 30 Kbytes to the size of the binary.
* | timeout: return exit code 125 if option parsing failsRon Yorston2018-03-241-1/+4
| |
* | timeout: bring exit status into line with coreutilsRon Yorston2018-03-241-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coreutils documentation says of the exit status: 124 if command times out 125 if timeout itself fails 126 if command is found but cannot be invoked 127 if command cannot be found 137 if command is sent the KILL(9) signal (128+9) the exit status of command otherwise Make busybox-w32 'timeout' behaviour match this. Upstream BusyBox is unaffected. See GitHub issue #105.
* | win32: save a few bytes in device file supportRon Yorston2018-03-233-43/+40
| |
* | win32: allow use of shell's PRNG for /dev/urandomRon Yorston2018-03-226-17/+130
| | | | | | | | | | | | Allow either ISAAC or the shell's built-in pseudo-random number generator to be used for /dev/urandom. The latter is smaller so it's the default.
* | win32: tighten up code slightly in isaac.cRon Yorston2018-03-221-13/+5
| |
* | win32: small changes to reduce size of binaryRon Yorston2018-03-222-13/+8
| | | | | | | | | | | | | | | | Reduce the size of the binary by about 32 bytes: - use xzalloc to allocate static buffers so we don't have to initialise them; - avoid duplicated code in spawnveq.