aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* ls: allow backslashes to be replaced in displayed pathsfix_backslashRon Yorston2020-08-191-0/+15
| | | | | | | | | | | | | | | | | | Normally 'ls' displays paths exactly as the user enters them: $ ls .//file .//file In busybox-w32 paths using backslash as a separator are displayed in a form that can't be reused as input to the shell: $ ls .\\file .\file Allow backslashes to be replaced with forward slashes if the environment variable BB_FIX_BACKSLASH is set to 1. See GitHub issue #196.
* busybox: create custom installation directoryRon Yorston2020-08-151-5/+6
| | | | | If a custom installation directory is specified try to create it. Don't worry if we can't, we'll find out when the links fail.
* busybox: add option to install to Unix-style pathsRon Yorston2020-08-142-12/+35
| | | | | The command 'busybox --install -u' installs links to Unix-style paths in the system drive.
* win32: use built-in applets for non-existent binaries with Unix-style pathsRon Yorston2020-08-135-11/+83
| | | | | | | | | | | | | | | | | | | | Shell scripts moved from Unix may contain hard-coded paths to binaries such as /bin/sh. A recent commit made it possible to execute such binaries reliably, but that does require them to be installed. As an alternative solution: if a binary with a standard Unix path prefix can't be found but is available as a built-in applet, run the applet. Add the function unix_path() to detect paths starting with /bin, /usr/bin, /sbin or /usr/sbin. Use this function in: - the 'which' applet - shellexec(), describe_command() and find_command() in ash - mingw_spawn_1() See GitHub issue #195.
* httpd: code shrinkRon Yorston2020-08-131-3/+2
| | | | Use the new need_system_drive() function in httpd. Saves 16 bytes.
* win32: handle Unix-style absolute paths for executablesRon Yorston2020-08-137-4/+68
| | | | | | | | | | | | | | | | | | | | | | As noted in commit 548ec7045 (win32: interpret absolute paths as relative to %SYSTEMDRIVE%) a path starting with a '/' in the Unix world is treated as relative to the current drive by Windows. To avoid ambiguity that commit considered certain such paths to be relative to %SYSTEMDRIVE%. Extend this to paths representing executables. Add the functions need_system_drive() and auto_add_system_drive() to detect the need for a system drive prefix and to add it if necessary. Use these functions in: - the 'which' applet - the find_executable() function - tab-completion code - PATH look-up, shellexec(), describe_command() and find_command() in ash - parse_interpreter() and mingw_spawn_1() With these changes executable paths starting with a slash are handled consistently, whatever the current drive.
* win32: use a static buffer in get_system_drive()Ron Yorston2020-08-134-18/+16
| | | | | | | Allocate static storage for the system drive string instead of making a new allocation on every call. This is easier to manage. Adds 16 bytes.
* win32: code shrinkRon Yorston2020-08-135-7/+17
| | | | | | | | | | Add a new function, has_path(), to detect that an executable name doesn't require a path look-up. Also, since is_absolute_path() is now only used in shell/ash.c move its definition there from include/mingw.h. Saves 128 bytes.
* which: handle paths of form 'c:path'Ron Yorston2020-08-131-2/+5
| | | | | | | Add another case where paths of the form 'c:path' need special treatment. Adds 16 bytes.
* win32: move code to fork (de)compressor to a functionRon Yorston2020-08-054-38/+29
| | | | | | | | Use a new common function, mingw_fork_compressor(), to implement fork_transformer() in open_transformer.c and vfork_compressor() in tar.c. Saves 160 bytes.
* which: rearrange conditional compilationRon Yorston2020-08-041-1/+6
| | | | The code for standalone shell mode should only be built for WIN32.
* win32: update strptime(3) implementationRon Yorston2020-08-031-12/+19
| | | | | | | | | | Update to latest code from gnulib. This adds a '%q' (quarter) field descriptor. Remove the 'neg' variable from the code to handle the '%z' (timezone) field descriptor. Since our struct tm lacks a tm_gmtoff member '%z' is only supported "for reasons of symmetry". Since the computed value is never used there's no need to negate it.
* build system: reinstate PLATFORM_LINUXRon Yorston2020-08-032-0/+2
| | | | | | | Removing 'select PLATFORM_LINUX' from ps and stat has no material effect: it just causes match_fstype.o to be built needlessly. Remove this difference from upstream.
* install: enable in default buildRon Yorston2020-08-032-10/+14
| | | | | Attempting to set file ownership and permissions may not work exactly as on *NIX.
* win32: code shrink kill(2)Ron Yorston2020-07-253-33/+19
| | | | | | | | - Drop exit_code argument from kill_SIGTERM_by_handle() - Pass signal number rather than exit code to other functions - Merge kill_SIGKILL() and kill_SIGTEST() Saves 112 bytes.
* win32: update link to Microsoft document on command-line argumentsRon Yorston2020-07-211-1/+1
|
* ts: correct output in 64-bit buildRon Yorston2020-07-191-0/+8
| | | | | | | | | | | ts failed to output the correct time when built for 64-bit Windows. In 64-bit builds time_t is a 64-bit quantity whereas the tv_sec member of struct timeval is 32-bit. https://sourceforge.net/p/mingw-w64/bugs/783/ Use a temporary time_t value in 64-bit builds.
* win32: alter build flagsFRP-3532-g01a256149Ron Yorston2020-07-091-1/+1
| | | | | Add -fno-builtin-strndup to the build flags, otherwise builds with link-time optimisation can't find strndup.
* win32: import strndup from gnulibRon Yorston2020-07-093-0/+42
|
* Merge branch 'busybox' into mergeRon Yorston2020-07-0946-390/+584
|\
| * libbb: code shrink in last_char_is()Denys Vlasenko2020-06-301-8/+9
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * compare_string_array: code shrinkMartin Lewis2020-06-291-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code shrink and prevention of possible out of bounds access. function old new delta nth_string 36 26 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10) Total: -10 bytes text data bss dec hex filename 981342 16915 1872 1000129 f42c1 busybox_old 981332 16915 1872 1000119 f42b7 busybox_unstripped Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * procps: code shrinkMartin Lewis2020-06-291-2/+10
| | | | | | | | | | | | | | | | | | | | | | function old new delta skip_whitespace_if_prefixed_with - 17 +17 procps_read_smaps 911 854 -57 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/1 up/down: 17/-57) Total: -40 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpc: fix a TODO in fill_envp using option scannerMartin Lewis2020-06-291-114/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fill_envp now iterates over the packet only once instead of a few hundred times using the new option scanner. function old new delta udhcp_scan_options - 189 +189 putenvp - 46 +46 init_scan_state - 22 +22 udhcp_get_option 227 104 -123 udhcp_run_script 835 601 -234 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 0/2 up/down: 257/-357) Total: -100 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcp: add option scannerMartin Lewis2020-06-292-42/+62
| | | | | | | | | | | | | | Added an option scanner to udhcp to enable iteration over packet options. Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * wget: fix openssl options for cert verificationScott Court2020-06-291-4/+17
| | | | | | | | | | | | | | | | | | | | | | function old new delta is_ip_address - 54 +54 spawn_https_helper_openssl 461 486 +25 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 79/0) Total: 79 bytes Signed-off-by: Scott Court <z5t1@z5t1.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * acpid: only display -p if supported in usageNorbert Lange2020-06-292-2/+4
| | | | | | | | | | Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dhcpd: remove hardcoded pidfile pathNorbert Lange2020-06-291-1/+7
| | | | | | | | | | Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dpkg: prevent important directories from being removedNorbert Lange2020-06-291-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | busybox will remove directory symlinks, which is at odds with common layouts that have some of bin/lib/lib32/lib64 symlinked. this adds a exludelist for critcal and often symlinked directories. Fixes: Bug 12551 function old new delta remove_file_array 139 231 +92 Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * nc_bloaty: support udp broadcast portsNorbert Lange2020-06-291-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a -b option, identical to debians "traditional" netcat. This allows sending (subnet) UDP Broadcasts. function old new delta packed_usage 33420 33441 +21 nc_main 1041 1057 +16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 37/0) Total: 37 bytes Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Start 1.33.0 development cycleDenys Vlasenko2020-06-261-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Bump version to 1.32.01_32_0Denys Vlasenko2020-06-261-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * gzip -d with zcat enabled but gunzip disabled was misbehavingDenys Vlasenko2020-06-251-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * make_single_applets.sh: switch off nologin deps optionDenys Vlasenko2020-06-241-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * bc: placate a "defined but not used" warningDenys Vlasenko2020-06-241-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * nologin: make it possible to build it as single appletDenys Vlasenko2020-06-245-64/+110
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * suppress a few compile warningsDenys Vlasenko2020-06-242-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-243-2/+6
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-236-6/+31
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixDenys Vlasenko2020-06-231-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-231-0/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-232-1/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-232-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * examples/udhcp/simple.script: fix IPv6 support when using udhcpcStefan Agner2020-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The udhcpc script calls ip addr flush .. which flushes addresses of any address family, including IPv6. However, busybox udhcpc is IPv4 only and should not influence IPv6 addressing. Hence use ip addr flush with family constraint. The script particularly broke IPv6 SLAAC: Typically when udhcpc calls the script the kernel already assigned the IPv6 link-local address. The flush removes the link-local IPv6 address again and prohibits proper IPv6 operation such as SLAAC since neighbor discovery protocol relies on IPv6 link-local addressing. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> [Taken from https://git.openembedded.org/openembedded-core/commit/meta/recipes-core/busybox/files/simple.script?id=b77541dbb2f442e51842f9d24c8745a6df2d1478] Signed-off-by: Quentin Schulz <quentin.schulz@streamunlimited.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpc6: use correct multicast MACUwe Glaeser2020-06-211-1/+5
| | | | | | | | | | | | | | | | function old new delta static.MAC_DHCP6MCAST_ADDR - 6 +6 Signed-off-by: Uwe Glaeser <uwe.glaeser@dormakaba.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * nmeter: add %T (zero-based timestamp) formatDenys Vlasenko2020-06-101-14/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta collect_tv - 132 +132 collect_monotonic - 61 +61 nmeter_main 754 778 +24 gmtime - 21 +21 init_monotonic - 18 +18 init_functions 44 48 +4 packed_usage 33432 33420 -12 collect_time 125 19 -106 ------------------------------------------------------------------------------ (add/remove: 5/0 grow/shrink: 2/2 up/down: 260/-118) Total: 142 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Makefile.flags: restrict Wno-constant-logical-operand and ↵Biswapriyo Nath2020-06-101-0/+2
| | | | | | | | | | | | | | | | | | | | Wno-string-plus-int options for clang these options were added in b4ef2e3467d8e980ccf13c9dd342459c013b455f commit gcc shows unrecognized command-line option warnings Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * deluser: check if specified home is a directory before removing itSören Tempel2020-06-091-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Alpine, some users use /dev/null as a home directory. When removing such a user with `deluser --remove-home` this causes the /dev/null device file to be removed which is undesirable. To prevent this pitfall, check if the home directory specified for the user is an actual directory (or a symlink to a directory). Implementations of similar tools for other operating systems also implement such checks. For instance, the OpenBSD rmuser(1) implementation [0]. [0]: https://github.com/openbsd/src/blob/b69faa6c70c5bfcfdddc6138cd8e0ee18cc15b03/usr.sbin/adduser/rmuser.perl#L143-L151 function old new delta deluser_main 337 380 +43 Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dhcpc: refactor xmalloc_optname_optval to shrink binary sizeMartin Lewis2020-06-092-27/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta len_of_option_as_string 14 13 -1 dhcp_option_lengths 14 13 -1 udhcp_str2optset 641 637 -4 static.xmalloc_optname_optval 777 718 -59 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-65) Total: -65 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd: allow '-h' to work when daemonized with NOMMU enabledRon Yorston2020-06-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit d1b75e184 (httpd: permit non-default home directory with NOMMU enabled) only works when used with the '-f' (foreground) option. When '-f' isn't specified and NOMMU is enabled bb_daemonize_or_rexec() is called to daemonize the server. Since the server process has been re-execed the previous patch results in the xchdir() not being called. Fix this by resetting the re_execed variable in this case. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>