aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * 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.
* | man: search for man pages relative to the executableRon Yorston2018-03-191-0/+10
| | | | | | | | | | | | | | Add a 'man' directory in the same directory as the current BusyBox executable to the end of the list of paths searched for man pages. See GitHub issue #102.
* | win32: don't test DLLs for executable formatRon Yorston2018-03-181-0/+5
| | | | | | | | | | | | | | | | | | | | | | Moving detection of file formats from access(2) to stat(2) in commit 650f67507 was acknowledged to slow down stat. One problematic case is c:/windows/system32 which contains about 2000 DLLs and was found to slow 'ls' unacceptably. Treat DLLs as a special case in has_exec_format. See GitHub issue #101.
* | win32: add a function to convert backslashes to slashesRon Yorston2018-03-184-24/+18
| |
* | win32: try harder to get file attributesRon Yorston2018-03-171-0/+16
| | | | | | | | | | | | | | | | | | Reading the attributes of files like c:/pagefile.sys fails with error code ERROR_SHARING_VIOLATION, which breaks 'ls'. If this happens try an alternative API call to get the attributes. See GitHub issue #101.
* | win32: tidy up popen implementationRon Yorston2018-03-153-209/+76
| | | | | | | | | | | | | | | | | | Make mingw_popen_fd sufficiently general that it can be used to implement the other two popen routines. mingw_popen now just creates a command line and passes it to mingw_popen_fd. The one call to mingw_popen2 has been replaced by a call to mingw_popen_fd.
* | wget: add support for httpsRon Yorston2018-03-157-11/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow wget to support https URLs. Changes are: - Add mingw_popen2 which uses a named pipe to allow bidirectional communication with a child process; - Modify ssl_client to accept a WIN32 handle instead of a file descriptor as an argument; - Allow tls_get_random to open /dev/urandom; - Using the above changes implement a WIN32 version of spawn_ssl_client in wget. This closes GitHub issue #75. Also, enable authentication in wget.
* | ash: remove special treatment of device filesRon Yorston2018-03-152-21/+3
| | | | | | | | | | Since device files are now handled in mingw_open there's no need for any special treatment in ash redirection.
* | win32: restrict visibility of special devicesRon Yorston2018-03-154-8/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling of the special devices /dev/zero and /dev/urandom was inconsistent: - they could be used as arguments to 'cat' but not 'od'; - they could not be used in shell redirection. Restrict the use of these devices to two places: - as input files to 'dd' with the 'if=' argument; - internally within 'shred'. See GitHub issue #98.
* | Merge branch 'busybox' into mergeRon Yorston2018-03-1546-323/+500
|\|
| * tcpsvd: fix fallout from opt_complementary removalDenys Vlasenko2018-03-111-3/+8
| | | | | | | | | | | | | | | | text data bss dec hex filename 933035 473 6836 940344 e5938 busybox_old 933051 473 6836 940360 e5948 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * readprofile: code shrinkDenys Vlasenko2018-03-111-34/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta defaultpro 14 - -14 defaultmap 17 - -17 readprofile_main 1762 1719 -43 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/1 up/down: 0/-74) Total: -74 bytes text data bss dec hex filename 933081 473 6836 940390 e5966 busybox_old 933035 473 6836 940344 e5938 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ntpd: choose initial FREQHOLD_cnt dynamicallyDenys Vlasenko2018-03-111-12/+54
| | | | | | | | | | | | | | function old new delta update_local_clock 834 858 +24 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpd: clamp down huge auto_times to ~2M seconds, better EINTR poll handlingDenys Vlasenko2018-03-111-5/+20
| | | | | | | | | | | | | | | | | | | | | | EINTR _should_ only happen on two signals we trap, and safe_poll _should_ work here just fine, but there were kernel bugs where spurious EINTRs happen (e.g. on ptrace attach). Be safe. function old new delta udhcpd_main 1437 1468 +31 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ntpd: suppress in-kernel frequency correction in first 8 adjtimex callsDenys Vlasenko2018-03-101-11/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In other words: try to correct initially existing clock offset first, before assuming that our clock drifts. function old new delta update_local_clock 826 834 +8 ntp_init 550 557 +7 filter_datapoints 179 173 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 15/-6) Total: 9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpd: fix "not dying on SIGTERM"Denys Vlasenko2018-03-107-34/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: commit 52a515d18724bbb34e3ccbbb0218efcc4eccc0a8 "udhcp: use poll() instead of select()" Feb 16 2017 udhcp_sp_read() is meant to check whether signal pipe indeed has some data to read. In the above commit, it was changed as follows: - if (!FD_ISSET(signal_pipe.rd, rfds)) + if (!pfds[0].revents) return 0; The problem is, the check was working for select() purely by accident. Caught signal interrupts select()/poll() syscalls, they return with EINTR (regardless of SA_RESTART flag in sigaction). _Then_ signal handler is invoked. IOW: they can't see any changes to fd state caused by signal haldler (in our case, signal handler makes signal pipe ready to be read). For select(), it means that rfds[] bit array is unmodified, bit of signal pipe's read fd is still set, and the above check "works": it thinks select() says there is data to read. This accident does not work for poll(): .revents stays clear, and we do not try reading signal pipe as we should. In udhcpd, we fall through and block in socket read. Further SIGTERM signals simply cause socket read to be interrupted and then restarted (since SIGTERM handler has SA_RESTART=1). Fixing this as follows: remove the check altogether. Set signal pipe read fd to nonblocking mode. Always read it in udhcp_sp_read(). If read fails, assume it's EAGAIN and return 0 ("no signal seen"). udhcpd avoids reading signal pipe on every recvd packet by looping if EINTR (using safe_poll()) - thus ensuring we have correct .revents for all fds - and calling udhcp_sp_read() only if pfds[0].revents!=0. udhcpc performs much fewer reads (typically it sleeps >99.999% of the time), there is no need to optimize it: can call udhcp_sp_read() after each poll unconditionally. To robustify socket reads, unconditionally set pfds[1].revents=0 in udhcp_sp_fd_set() (which is before poll), and check it before reading network socket in udhcpd. TODO: This might still fail: if pfds[1].revents=POLLIN, socket read may still block. There are rare cases when select/poll indicates that data can be read, but then actual read still blocks (one such case is UDP packets with wrong checksum). General advise is, if you use a poll/select loop, keep all your fds nonblocking. Maybe we should also do that to our network sockets? function old new delta udhcp_sp_setup 55 65 +10 udhcp_sp_fd_set 54 60 +6 udhcp_sp_read 46 36 -10 udhcpd_main 1451 1437 -14 udhcpc_main 2723 2708 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/3 up/down: 16/-39) Total: -23 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * remove stray newline in "iplink --help"Denys Vlasenko2018-03-081-1/+1
| | | | | | | | | | | | | | function old new delta packed_usage 32547 32550 +3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ip: fix "ip -oneline a"Denys Vlasenko2018-03-081-1/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>