aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* build system: use static ssp libraryRon Yorston2020-11-121-1/+1
| | | | | | | | | | | | The previous commit got rid of a link error but generates a binary that isn't standalone: it requires libssp-0.dll. Force the use of the static ssp library. This also requires mingwex to be added to LDLIBS, since that's what has a dependency on ssp. Other workarounds are to compile with non-zero _FORTIFY_SOURCE (which increases the size of the binary) or to add '-u ___strcpy_chk' to LDFLAGS (likely to be fragile).
* build: add ssp libraryRon Yorston2020-11-111-1/+1
| | | | | | | With recent MinGW-w64 we get an undefined reference to __strcpy_chk if we don't include ssp. https://sourceforge.net/p/mingw-w64/bugs/818/
* win32: make location of Unix-style absolute paths configurableRon Yorston2020-08-311-1/+1
| | | | | | | | | | | | | | | | | Previously busybox-w32 was enhanced so certain Unix-style absolute paths of the form '/dir/file' were treated as being relative to the system drive. (Notionally as reported by %SYSTEMDRIVE% but in fact derived from the API call GetSystemDirectory().) Make the location of such files configurable by the BB_SYSTEMROOT environment variable. - BB_SYSTEMROOT should probably only refer to a Windows-style absolute path, but this isn't checked. - Set BB_SYSTEMROOT using the Windows Control Panel or setx, not as a shell variable: the shell itself won't see the environment variable.
* ash, ls: improve support for 'c:path'Ron Yorston2020-08-284-21/+9
| | | | | | | | | | Revert commit 249f68e3c (win32: append '/' to bare drive name in opendir). Instead add better handling for paths of the form 'c:path' to ls and expmeta() in ash. Adds 64 bytes.
* printf: ensure '\045' is printed as '%'Ron Yorston2020-08-281-5/+10
| | | | | | | | | Using printf() instead of fputs() to save a few bytes was a false economy. printf() eats percent signs. See GitHub issue #199. Adds 32 bytes.
* ash: replace backslashes in argument to 'cd' built-inRon Yorston2020-08-271-1/+1
| | | | | | | Since the new current directory is normalised it might as well also have forward slashes. See GitHub issue #198.
* printf: prevent '\0' in format string from truncating outputFRP-3578-g359211429Ron Yorston2020-08-241-1/+9
| | | | | | | | | Commit 4a2af48e6 (printf: emit more contiguous text to improve escape sequences) didn't treat an escaped null byte in the format string correctly. The output string was truncated at the null byte. Detect this case, output the partial string and the null byte and carry on.
* httpd: silence compiler warnings about %llx formatRon Yorston2020-08-231-1/+1
|
* win32: update default configurationRon Yorston2020-08-232-2/+10
|
* libbb: reinstate NULL check in last_char_is()Ron Yorston2020-08-231-1/+1
| | | | | | | | Upstream commit 79a4032ee removed the test for a NULL argument to last_char_is(). As reported in the upstream bug tracker this can cause tar to segfault: https://bugs.busybox.net/show_bug.cgi?id=13131
* Merge branch 'busybox' into mergeRon Yorston2020-08-23131-417/+572
|\
| * httpd: Make Deny/Allow by IP config support optionalSergey Ponomarev2020-08-161-18/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When disabled: function old new delta if_ip_denied_send_HTTP_FORBIDDEN_and_exit 52 - -52 handle_incoming_and_exit 2201 2097 -104 scan_ip 170 - -170 parse_conf 1365 1065 -300 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/2 up/down: 0/-626) Total: -626 bytes Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd: Support caching via ETag headerSergey Ponomarev2020-08-151-3/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If server responds with ETag then next time client can resend it via If-None-Match header. Then httpd will check if file wasn't modified and if not return 304 Not Modified status code. The ETag value is constructed from file's last modification date in unix epoch and it's size: "hex(last_mod)-hex(file_size)" e.g. "5e132e20-417" (with quotes). That means that it's not completely reliable as hash functions but fair enough. The same form of ETag is used by Nginx so load balancing of static content is safe. function old new delta handle_incoming_and_exit 2135 2201 +66 http_response 88 96 +8 send_headers 676 683 +7 parse_conf 1362 1365 +3 http_response_type 22 24 +2 send_file_and_exit 847 841 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/1 up/down: 86/-6) Total: 80 bytes Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd: Don't add Last-Modified header to responseSergey Ponomarev2020-08-151-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | The Last-Modified header is used for caching. The client (browser) will send back the received date to server via If-Modified-Since request header. But both headers MUST be an RFC 1123 formatted string. And the formatting consumes resources on request parsing and response generation. Instead we can use ETag header. This simplifies logic and the only downside is that in JavaScript the document.lastModified will return null. Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd: Don't add Date header to responseSergey Ponomarev2020-08-151-2/+16
| | | | | | | | | | | | | | | | | | RFC 2616 sec. 14.18 says that server MUST send Date header. But in fact the header make sense only for Cache-Control and can be omitted. In the same time the Date eats power, CPU and network resources which are critical for embedded systems. Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd: Update to HTTP/1.1Sergey Ponomarev2020-08-151-8/+8
| | | | | | | | | | | | | | | | | | HTTP v1.1 was released in 1999 year and it's time to update BB HTTPD. Browsers may behave badly with HTTP/1.0 E.g. Chrome does not send the If-None-Match header with ETag. Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hwclock: Fix settimeofday for glibc v2.31+Eddie James2020-08-151-3/+11
| | | | | | | | | | | | | | | | | | The glibc implementation changed for settimeofday, resulting in "invalid argument" error when attempting to set both timezone and time with a single call. Fix this by calling settimeofday twice Signed-off-by: Eddie James <eajames@linux.ibm.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * grep: for -L, exitcode 0 means files *without* matches were found, closes 13151Denys Vlasenko2020-08-152-15/+22
| | | | | | | | | | | | | | | | | | This is a recent change in GNU grep as well (after 3.1) function old new delta grep_file 1215 1228 +13 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * build system: drop PLATFORM_LINUXRon Yorston2020-08-13109-146/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PLATFORM_LINUX is a hidden configuration option which is disabled by default and enabled at over a hundred locations for features that are deemed to be Linux specific. The only effect of PLATFORM_LINUX is to control compilation of libbb/match_fstype.c. This file is only needed by mount and umount. Remove all references to PLATFORM_LINUX and compile match_fstype.c if mount or umount is enabled. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpc: add support for long optionsMartin Lewis2020-08-132-35/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Duplicate options are currently overridden (only the last option is kept). This leads to unexpected behavior when using long options. The patch adds support for long options in compliance with RFC 3396. Fixes #13136. function old new delta udhcp_run_script 601 725 +124 optitem_unset_env_and_free - 38 +38 putenvp 46 59 +13 static.xmalloc_optname_optval 718 717 -1 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/1 up/down: 175/-1) Total: 174 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ip address: Add support for "valid_lft" and "preferred_lft" optionsChristian Eggers2020-07-312-7/+62
| | | | | | | | | | Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ip: Add support for "noprefixroute" optionChristian Eggers2020-07-312-16/+33
| | | | | | | | | | | | | | | | | | | | | | The "noprefixroute" option suppresses automatic generation of a routing table entry based on the interface's ip address. The ifa_flags field has only 8 bit. If higher bits are set, rta_tb[IFA_FLAGS] has to be used instead. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * shell: Fix "read -d ''" behaviorChristian Eggers2020-07-315-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With bash's read builtin it is possible to read from a file (e.g. device-tree) until the first '\0' character: IFS= read -r -d '' VARIABLE < file In busybox ash the -d extension is also implemented, but checking the read character for '\0' has to be performed after comparing with the delimiter. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd_indexcgi.c: use CSS for odd/even rowsSergey Ponomarev2020-07-311-8/+2
| | | | | | | | | | Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * httpd_indexcgi.c: minimize style CSSSergey Ponomarev2020-07-311-37/+37
| | | | | | | | | | | | | | Remove new lines \n and some semicolons ;. This minimize page style size from 655 to 604 Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lsscsi: code shrinkDenys Vlasenko2020-07-201-15/+12
| | | | | | | | | | | | | | | | | | | | function old new delta lsscsi_main 298 302 +4 get_line 56 45 -11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 4/-11) Total: -7 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ntpd: fix refid reported in server mode, closes 13056Denys Vlasenko2020-07-204-7/+41
| | | | | | | | | | | | | | | | | | | | function old new delta resolve_peer_hostname 129 196 +67 recv_and_process_peer_pkt 2475 2476 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 68/0) Total: 68 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * networking: support ftp PASV responses not ending with ')'Denys Vlasenko2020-07-191-0/+2
| | | | | | | | | | | | | | | | | | Patch by Baruch Burstein <bmburstein@gmail.com> function old new delta parse_pasv_epsv 153 181 +28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: shrink last_char_is(), no longer allow NULL string argumentDenys Vlasenko2020-07-191-10/+5
| | | | | | | | | | | | | | function old new delta last_char_is 40 28 -12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * domain_codec: optimize dname_dec and convert_dnameMartin Lewis2020-07-121-78/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dname_dec: now iterates over the packet only once. convert_dname: remove redundant checks and code shrink. While testing I've noticed that some of the tests didn't compile properly, so I fixed them. function old new delta dname_dec 286 267 -19 dname_enc 166 143 -23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-42) Total: -42 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * crontab: Fix -e with editors saving using renaming strategyGray Wolf2020-07-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some editors (like vim) use renaming strategy to save file. That means they save a file to some random name and then rename it to final location. The advantage is that such save is atomic. However, crontab -e holds open fd to the temporary file, meaning it never sees the changes. The temporary file needs to be re-opened after the editor terminates for the changes to properly save. Fixes #12491 Signed-off-by: Gray Wolf <wolf@wolfsden.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: code shrink Unix-style path handlingRon Yorston2020-08-237-96/+50
| | | | | | | | | | | | | | | | Replace auto_add_system_drive() with alloc_system_drive() which leaves space for a possible filename extension. This makes it possible to drop alloc_win32_extension() and auto_win32_extension(). Saves 144 bytes.
* | ash: use stack, not heap, to add system drive to pathRon Yorston2020-08-211-16/+27
| | | | | | | | Make the code a bit tidier, no change to functionality or size.
* | win32: allow putenv() to set empty valuesRon Yorston2020-08-211-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WIN32 _putenv() can't set an environment variable with an empty value because 'NAME=' is treated as a request to delete the variable. Allow mingw_putenv() to set an empty value by first setting a fake value and then truncating it. This problem has always been present in mingw_putenv() but it became particularly pressing when ash started treating all applets as NOEXEC. The environment of NOEXEC applets is created by clearing the current environment and using putenv() to set a new one from the shell variables. Empty variable were not being set. See GitHub issue #197.
* | win32: env.c code shrink and clarificationRon Yorston2020-08-211-7/+6
| | | | | | | | | | | | | | | | Use xasprintf() to create string in unsetenv(). Clarify when we're using WIN32 _putenv(). No change in functionality; saves 16 bytes.
* | 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.