aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * tls: P256: fix obscure x86_64 asm misbehavior, closes 15679Denys Vlasenko2024-07-111-10/+29
| | | | | | | | | | | | | | | | | | | | gcc does not necessarily clear upper bits in 64-bit regs if you ask it to load a 32-bit constant. Cast it to unsigned long. Better yet, hand-write loading of the constant with a smaller instruction. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * md5/shaXsum: accept uppercase hex stringsRon Yorston2024-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | The coreutils versions of md5sum and the like accept uppercase hex strings from checksum files specified with the '-c' option. Use a case-insensitive comparison so BusyBox does the same. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * vi: Ensure that the edit buffer ends in a newlinePetja Patjas2024-07-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently vi assumes that the edit buffer ends in a newline. This may not be the case. For example: $ printf test > test $ vi test <press 'o'> We fix this by inserting a newline to the end during initialization. Signed-off-by: Petja Patjas <pp01415943@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | make: allow pragmas to apply recursivelyRon Yorston2024-07-121-14/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | Pragmas set when pdpmake is run are exported to the environment variable PDPMAKE_PRAGMAS as a space-separated list of pragma names. This environment variable is read when pdpmake starts and any pragmas it contains are applied. Thus pragmas are passed to recursive invocations of pdpmake. PDPMAKE_PRAGMAS can also be set by the user. Adds 240-288 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2024-07-105-101/+159
|\|
| * ash: remove defunct control character to save a few bytesRon Yorston2024-07-101-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 549deab5a (ash: move parse-time quote flag detection to run-time) did away with the need to distinguish between backquotes inside and outside quotes. This left a gap among the control characters used in argument strings. Removing this gap saves a few bytes. function old new delta .rodata 167346 167338 -8 cmdputs 399 388 -11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-19) Total: -19 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Makefile.flags: suppress clang warnings when cross-compilingRon Yorston2024-07-101-3/+3
| | | | | | | | | | | | | | | | | | Extend the changes introduced by commit b4ef2e3467 (Makefile.flags: suppress some clang-9 warnings) so they also cover the case where clang is used as a cross-compiler. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix parsing of alias expansion + bash featuresRon Yorston2024-07-101-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An alias expansion immediately followed by '<' and a newline is parsed incorrectly: ~ $ alias x='echo yo' ~ $ x< yo ~ $ sh: syntax error: unexpected newline The echo is executed and an error is printed on the next command submission. In dash the echo isn't executed and the error is reported immediately: $ alias x='echo yo' $ x< dash: 3: Syntax error: newline unexpected $ The difference between BusyBox and dash is that BusyBox supports bash-style process substitution and output redirection. These require checking for '<(', '>(' and '&>' in readtoken1(). In the case above, when the end of the alias is found, the '<' and the following newline are both read to check for '<('. Since there's no match both characters are pushed back. The next input is obtained by reading the expansion of the alias. Once this string is exhausted the next call to __pgetc() calls preadbuffer() which pops the string, reverts to the previous input and recursively calls __pgetc(). This request is satisified from the pungetc buffer. But the first __pgetc() doesn't know this: it sees the character has come from preadbuffer() so it (incorrectly) updates the pungetc buffer. Resolve the issue by moving the code to pop the string and fetch the next character up from preadbuffer() into __pgetc(). function old new delta pgetc 28 589 +561 __pgetc 607 - -607 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 561/-607) Total: -46 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: mktime() with no arguments is not allowedDenys Vlasenko2024-07-101-2/+1
| | | | | | | | | | | | It was SEGVing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: improve comments and constants, no code changesDenys Vlasenko2024-07-101-20/+27
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * qwk: code shrinkDenys Vlasenko2024-07-091-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta mk_splitter 100 96 -4 as_regex 103 99 -4 parse_expr 991 986 -5 awk_split 544 538 -6 awk_getline 559 552 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-26) Total: -26 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: restore assignment precedence to be lower than ternary ?:Denys Vlasenko2024-07-092-22/+74
| | | | | | | | | | | | | | Something is fishy with constrcts like "3==v=3" in gawk, they should not work, but do. Ignore those for now. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: do not infinitely recurse getvar_s() if CONVFMT is set to a numeric valueDenys Vlasenko2024-07-091-6/+14
| | | | | | | | | | | | | | | | | | | | | | function old new delta fmt_num 247 257 +10 evaluate 3385 3379 -6 getvar_s 111 102 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 10/-15) Total: -5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix use after free (CVE-2023-42363)Natanael Copa2024-07-091-8/+13
| | | | | | | | | | | | | | | | | | | | function old new delta evaluate 3377 3385 +8 Fixes https://bugs.busybox.net/show_bug.cgi?id=15865 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * chown: stop accepting deprecated USER.GROUP syntax, only : separator is allowedDenys Vlasenko2024-07-081-5/+1
| | | | | | | | | | | | | | function old new delta parse_chown_usergroup_or_die 115 94 -21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * wget: ignore header casingSertonix2024-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HTTP headers are case insensitive and therefore the check if a default header has been overwritten needs to be case insensitive. Without this patch `--header 'user-agent: test'` results in `User-Agent: Wget` and `user-agent: test` being send. function old new delta ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes text data bss dec hex filename 1040876 16443 1840 1059159 102957 busybox_old 1040876 16443 1840 1059159 102957 busybox_unstripped Signed-off-by: Sertonix <sertonix@posteo.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: restore value of imported variable on unexportRon Yorston2024-07-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shell variables imported from the environment are marked with a special flag and backslashes in their values are (by default) replaced with forward slashes. Sometimes this may not be what we want. Modify the 'export' shell built-in so unexporting a variable of this type restores its original value from the environment and removes its special flag. It can then be re-exported. Adds 32 bytes. (GitHub issue #428)
* | ash: read profile script relative to binaryRon Yorston2024-07-084-3/+15
| | | | | | | | | | | | | | As well as trying to read '/etc/profile' also look for the script 'etc/profile' relative to the location of the running binary. Adds 64-96 bytes.
* | win32: code shrink system drive handling (2)Ron Yorston2024-07-071-1/+1
| | | | | | | | | | | | Now that get_system_drive() no longer returns a NULL pointer on error chdir_system_drive() needs to check for an empty string instead.
* | win32: code shrink system drive handlingRon Yorston2024-07-075-35/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A previous commit (e3bfe3695) revised the use of getsysdir() to obtain the system directory, and hence the system drive. See the commit message for the history to that point. Further improvements are possible: - Remove getsysdir() and push the calls to GetSystemDirectory() down into get_system_drive() and get_proc_addr(). - Check the return value of GetSystemDirectory(). It's unlikely to fail, but better safe than sorry. - Instead of making all callers of get_system_drive() check for a NULL return value always return a non-NULL pointer. If the drive can't be found an empty string is returned instead (which is what the callers were using anyway). - The function need_system_drive() was only used in one place (in httpd). Move the code there and remove the function. - Use concat_path_file() where possible. Saves 76-144 bytes.
* | ash: special hack for libtoolRon Yorston2024-07-071-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | Libtool assumes the host environment is MSYS2 and will be confused by Windows-style command switches. The "/c" in "cmd /c" looks like a path, which MSYS2 incorrectly decodes to "c:/". Anticipating this, libtool encodes these calls as "cmd //c" which does not work outside MSYS2. A busybox-w32 patch makes it behave like MSYS2 in just this one case. Adds 88-96 bytes. (GitHub issue #297 and https://github.com/skeeto/w64devkit/issues/50)
* | win32: properly restore BB_ env varsRon Yorston2024-07-021-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some BB_ shell variables get special treatment: they're updated in the environment immediately on any change. One case was missed: if such a variable was unset or not exported and was overridden by a local variable it wasn't unset in the environment when the local variable went out of scope. Add the code required to do this. Adds 48-64 bytes. (GitHub issue #423)
* | win32: don't allow BB_TERMINAL_MODE=6Ron Yorston2024-06-281-1/+1
| | | | | | | | | | | | | | | | The BB_TERMINAL_MODE variable is only documented to work for values between 0 and 5. Due to an oversight it also accepted the value 6. Like other unsupported values 6 is now replaced with the default value configured at build time.
* | win32: add definition for old mingw-w64FRP-5398-g89ae34445Ron Yorston2024-06-251-0/+4
| |
* | win32: code shrink exit_code_to_wait_status_cmd()Ron Yorston2024-06-241-4/+4
| | | | | | | | Saves 16 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2024-06-2334-155/+562
|\|
| * typo fixDenys Vlasenko2024-06-012-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: fix 64-bit bb_popcnt_longDenys Vlasenko2024-05-311-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: add bit counting function, use where appropriateDenys Vlasenko2024-05-318-52/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although "naive" counting function is not too slow and is smaller, using it on e.g. each of 1024 words of CPU mask feels wrong. function old new delta bb_popcnt_32 - 52 +52 get_prefix 323 321 -2 nproc_main 206 199 -7 d4_run_script 739 731 -8 ipcalc_main 533 507 -26 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/4 up/down: 52/-43) Total: 9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * nproc: prepare for arbitrarily large CPU masksDenys Vlasenko2024-05-315-27/+38
| | | | | | | | | | | | | | | | | | | | | | function old new delta get_malloc_cpu_affinity - 76 +76 nproc_main 216 206 -10 process_pid_str 250 206 -44 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/2 up/down: 76/-54) Total: 22 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: print prompt and editing operations to stderrDenys Vlasenko2024-04-131-28/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For shells, this is mandated by standards function old new delta input_backward 215 231 +16 read_line_input 3015 3028 +13 draw_custom 66 78 +12 put_cur_glyph_and_inc_cursor 149 159 +10 put_prompt_custom 47 56 +9 show_history 40 46 +6 input_tab 927 933 +6 input_delete 136 142 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/0 up/down: 78/0) Total: 78 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * docproc: avoid segfault during file closingYan Zhu2024-04-131-0/+1
| | | | | | | | | | | | | | | | | | In the function find_export_symbols, since the fopen file does not exit when it fails, there is a dereference problem in fclose(fp), which will cause a segmentation fault. Signed-off-by: Yan Zhu <zhuyan2015@foxmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix segfault when compiled by clangRon Yorston2024-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A 32-bit build of BusyBox using clang segfaulted in the test "awk assign while assign". Specifically, on line 7 of the test input where the adjustment of the L.v pointer when the Fields array was reallocated L.v += Fields - old_Fields_ptr; was out by 4 bytes. Rearrange to code so both gcc and clang generate code that works. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * crond: log5 fix typo, replace log level '4' with '5'Jones Syue2024-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | log5() with crondlog(5, msg, va) seems making logging more consistent. function old new delta ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes Signed-off-by: Jones Syue <jonessyue@qnap.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
| * ash: fix handling of single-quoted strings in pattern substitutionDenys Vlasenko2024-02-265-0/+29
| | | | | | | | | | | | | | function old new delta subevalvar 1576 1588 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ip link: support for the CAN netlinkDario Binacchi2024-02-263-11/+333
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I developed this application to test the Linux kernel series [1]. As described in it I could not use the iproute2 package since the microcontroller is without MMU. function old new delta do_set_can - 920 +920 packed_usage 34645 34908 +263 get_float_1000 - 164 +164 .rodata 105427 105539 +112 do_iplink 1313 1381 +68 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/0 up/down: 1527/0) Total: 1527 bytes cc: Marc Kleine-Budde <mkl@pengutronix.de> [1] https://marc.info/?l=linux-netdev&m=167999323611710&w=2 Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: detect when terminating "done"/"fi" is missingDenys Vlasenko2024-02-259-1/+22
| | | | | | | | | | | | | | | | | | | | function old new delta parse_stream 2271 2292 +21 .rodata 105408 105427 +19 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 40/0) Total: 40 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: set G.ifs sooner (prevents segfault)Denys Vlasenko2024-02-251-28/+34
| | | | | | | | | | | | | | | | | | | | | | function old new delta set_G_ifs - 151 +151 run_list 1024 1031 +7 run_pipe 1567 1445 -122 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 158/-122) Total: 36 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ls: do not truncate username/groupname to 8 charsDenys Vlasenko2024-02-251-2/+2
| | | | | | | | | | | | | | function old new delta .rodata 105412 105408 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: code shrink BB_CRITICAL_ERROR_DIALOGSRon Yorston2024-06-232-2/+3
| | | | | | | | | | | | Rewrite the test for the value of BB_CRITICAL_ERROR_DIALOGS. Saves 16-48 bytes.
* | win32: only access mode argument of open(2) if requiredRon Yorston2024-06-221-3/+5
| | | | | | | | | | | | | | | | | | The wrapper function 'mingw_open()' should only read the optional third argument if the 'O_CREAT' flag bit is set. Adds 16 bytes. (GitHub issue #425)
* | win32: add env var to control error dialogsRon Yorston2024-06-226-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the environment variable BB_CRITICAL_ERROR_DIALOGS is set to 1 critical error dialogs are enabled. If unset or set to any other value they aren't. In either case the error messages introduced by commit 790e37727 (win32: revert 'don't set error mode') are issued. The shell exports BB_CRITICAL_ERROR_DIALOGS to the environment immediately on any change so the setting takes effect at once. Adds 104-160 bytes. (GitHub issue #423)
* | win32: revert 'don't set error mode'Ron Yorston2024-06-222-29/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit eb376b5d1 (win32: don't set error mode) removed a call to SetErrorMode(SEM_FAILCRITICALERRORS). But the documentation says: Best practice is that all applications call the process-wide SetErrorMode function with a parameter of SEM_FAILCRITICALERRORS at startup. This is to prevent error mode dialogs from hanging the application. Doing this prevents the system from displaying useful information, though. The application should attempt to tell the user what went wrong. Reinstate the call to SetErrorMode() and try to provide an error message, at least for the situation mentioned in issue #423 and other similar cases. Adds 360-368 bytes. (GitHub issue #423)
* | ash: allow HISTFILE=/dev/null to work as intendedRon Yorston2024-06-191-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was noted that setting HISTFILE=/dev/null in upstream BusyBox prevented shell history from being saved to a history file. This failed in busybox-w32 with an error from lseek(2). The lseek(2) wrapper was rather conservative in the file types it accepted. Allowing FILE_TYPE_CHAR makes it possible to seek on /dev/null, thus avoiding the issue with HISTFILE. In addition, the wrapper for open(2) now converts the Unix-style mode argument to Windows-style. (GitHub issue #425)
* | win32: code shrink APE detection; avoid UBRon Yorston2024-06-191-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Detecting Actually Portable Executable binaries used a longer signature than seems necessary. Six characters should be enough for anyone. When right shifting a byte by 24 bits, cast it to unsigned to avoid undefined behaviour. Saves 24-32 bytes. (GitHub issue #424)
* | make: update default rulesRon Yorston2024-06-161-14/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | The default rules were changed in the 2024 standard: - Fortran is no longer supported - The CC macro is set to 'c17' instead of 'c99' In addition to these changes, CC is set to 'cc' as a non-POSIX extension: on my system, at least, there isn't a 'c17' compiler. Adds 208-224 bytes.
* | win32: detect Actually Portable Executable binariesRon Yorston2024-06-161-15/+23
| | | | | | | | | | | | | | | | | | Check for the signature of Actually Portable Executable binaries and treat them as executable. Adds 40-64 bytes. (GitHub issue #424)
* | win32: don't set error modeRon Yorston2024-06-161-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit a8c63f25b3 (win32: improve filesystem detection and display) added a call to SetErrorMode(SEM_FAILCRITICALERRORS). This was on the strength of the documentation for GetVolumeInformation() which suggests that otherwise a message box will appear to prompt the user to put media in an empty floppy or CD drive. This would disrupt the expected behaviour of applets like 'df'. In practice it seems the call to SetErrorMode() is unnecessary. It also results in other errors going unreported. Remove the call to SetErrorMode(). Saves 8-20 bytes. (GitHub issue #423)
* | make: update for POSIX 2024Ron Yorston2024-06-146-27/+31
| | | | | | | | | | | | | | | | | | | | | | | | Now that POSIX.1-2024 has been released we can replace all references to the 202X draft standard with 2024. Make this change throughout the code and testsuite. The pragma 'posix_2024' has been added. 'posix_202x' remains as an alias for the same. The 2024 standard is enforced by default in POSIX mode.
* | win32: allow for trailing separator in PATHRon Yorston2024-06-144-38/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In recent versions of Windows the PATH environment variable has a trailing semicolon. This is insignificant to Windows because it's ignored. busybox-w32 conforms to the POSIX interpretation of PATH which treats an empty path element as denoting the current directory. As result, on these versions of Windows executables may by default be run from the current directory, contrary to usual Unix practice. Attempt to detect and remove the trailing semicolon on applet start up. If the user insists, they can add a trailing semicolon to the shell variable PATH and it will be respected in the conventional manner. Adds 88-112 bytes. (GitHub issue #422)