aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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>
| * ipcs: further code shrinkDenys Vlasenko2018-03-081-24/+23
| | | | | | | | | | | | | | | | | | | | function old new delta packed_usage 32543 32547 +4 ipcs_main 1014 980 -34 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-34) Total: -30 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ipcs: code shrinkDenys Vlasenko2018-03-081-24/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta packed_usage 32539 32543 +4 format 1 - -1 do_shm 883 880 -3 do_sem 636 633 -3 do_msg 782 779 -3 ipcs_main 1049 1014 -35 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/4 up/down: 4/-45) Total: -41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * md5sum: use config help text similar to other "sum" toolsDenys Vlasenko2018-03-081-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * top: much faster cursor key navigation by avoiding process rescanDenys Vlasenko2018-03-071-6/+19
| | | | | | | | | | | | | | | | function old new delta handle_input 549 560 +11 top_main 889 891 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * top: do unsigned rather than signed division in do_stats()Denys Vlasenko2018-03-071-3/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * top: handle much larger VSZ valuesDenys Vlasenko2018-03-071-7/+5
| | | | | | | | | | | | | | function old new delta display_process_list 1018 999 -19 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * use gmtime_r() instead of gmtime()Denys Vlasenko2018-03-063-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids pulling in gmtime's static buffer: function old new delta svlogd_main 1401 1412 +11 send_headers 668 678 +10 gmtime 21 - -21 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 2/0 up/down: 21/-21) Total: 0 bytes text data bss dec hex filename 920221 555 5804 926580 e2374 busybox_old 920221 555 5740 926516 e2334 busybox_unstripped ^^^^ Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: code shrinkDenys Vlasenko2018-03-061-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta run_pipe 1589 1591 +2 pseudo_exec_argv 374 375 +1 builtin_type 114 115 +1 find_function 8 - -8 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 3/0 up/down: 4/-8) Total: -4 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * networking/interface.c: get rid of global dataDenys Vlasenko2018-03-051-85/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were data/bss: static.proc_read 1 - -1 int_list 4 - -4 int_last 4 - -4 We never call display_interfaces() twice, thus code to not scan /proc twice never triggers. function old new delta do_if_print - 1998 +1998 display_interfaces 145 249 +104 static.proc_read 1 - -1 add_interface 104 103 -1 int_list 4 - -4 int_last 4 - -4 if_readlist_proc 560 542 -18 if_readconf 141 - -141 do_if_fetch 643 - -643 ife_print 1296 - -1296 ------------------------------------------------------------------------------ (add/remove: 1/6 grow/shrink: 1/2 up/down: 2102/-2108) Total: -6 bytes text data bss dec hex filename 933084 473 6844 940401 e5971 busybox_old 933087 473 6836 940396 e596c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * networking/interface.c: get rid of global "smallint interface_opt_a"Denys Vlasenko2018-03-053-27/+20
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * networking/interface.c: code shrinkDenys Vlasenko2018-03-051-61/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta ife_print 1293 1296 +3 display_interfaces 145 146 +1 if_readconf 162 141 -21 if_readlist_proc 631 560 -71 do_if_fetch 753 643 -110 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/3 up/down: 4/-202) Total: -198 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * wget: fix fetching of https URLs with http proxyPeter Lloyd2018-03-051-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When fetching a https:// URL with HTTP proxy configured (e.g. with environment variable http_proxy=http://your-proxy:3128) busybox was making a https connection to the proxy. This was because the protocol scheme for the target URL was used to determine whether to connect to the proxy over SSL or not. When the proxy is in use, the decision on whether to connect to the proxy over https should based on the proxy URL not on the target URL. function old new delta wget_main 2381 2387 +6 Signed-off-by: Peter Lloyd <l-busybox@pgl22.co.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * make busybox more portableSean MacLennan2018-03-042-11/+9
| | | | | | | | | | | | | | | | Move some distro specific include files into the appropriate #ifdef blocks to make the code more portable. Signed-off-by: Sean MacLennan <seanm@seanm.ca> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: fix a='a\\'; echo "${a%\\\\}"Denys Vlasenko2018-03-0210-3/+39
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell: tweak bkslash_in_varexp.tests, add bkslash_in_varexp1.testsDenys Vlasenko2018-03-028-5/+50
| | | | | | | | | | | | | | | | | | It turns out bkslash_in_varexp.tests was a bash bug :] ash and hush fail "corrected" bkslash_in_varexp.tests as well, just not as badly as I thought (hush gets half of the cases right). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>