aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'busybox' into mergeRon Yorston2024-07-1317-84/+208
|\|
| * hush: do not exit interactive shell on some redirection errorsDenys Vlasenko2024-07-137-18/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ echo >&99 hush: dup2(99,1): Bad file descriptor $ echo >&9999 hush: fcntl(1,F_DUPFD,10000): Invalid argument $ echo 2>/dev/tty 10>&9999 hush: fcntl(10,F_DUPFD,10000): Invalid argument $ still alive!_ function old new delta static.setup_redirects 334 394 +60 .rodata 105661 105712 +51 dup_CLOEXEC 49 79 +30 save_fd_on_redirect 263 277 +14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 155/0) Total: 155 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: fix "exec 3>FILE" aborting if 3 is exactly the next free fdDenys Vlasenko2024-07-138-7/+42
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: avoid duplicate fcntl(F_SETFD, FD_CLOEXEC) during initDenys Vlasenko2024-07-131-8/+3
| | | | | | | | | | | | | | function old new delta hush_main 1149 1150 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: remove limitation on fd# lengthDenys Vlasenko2024-07-121-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "echo text >&0000000000002" works as you would expect, "echo text >&9999999999" properly fails instead of creating a file named "9999999999". function old new delta expredir 219 232 +13 readtoken1 3045 3053 +8 parsefname 204 201 -3 isdigit_str9 45 - -45 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/1 up/down: 21/-48) Total: -27 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: do not abort interactive mode on >&9999 redirectDenys Vlasenko2024-07-121-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With very large fd#, the error code path is different from one for closed but small fd#. Make it not abort if we are interactive: $ echo text >&99 # this wasn't buggy ash: dup2(9,1): Bad file descriptor $ echo text >&9999 # this was ash: fcntl(1,F_DUPFD,10000): Invalid argument function old new delta .rodata 105637 105661 +24 dup2_or_raise 35 38 +3 redirect 1084 1044 -40 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 27/-40) Total: -13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: fix CONFIG_FEATURE_TLS_SHA1=y + CONFIG_SHA1_HWACCEL=yDenys Vlasenko2024-07-121-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The check for result hash size was buggy for CONFIG_SHA1_HWACCEL=y. While at it, document CPUID use a bit better. function old new delta get_shaNI - 28 +28 sha1_end 66 79 +13 sha256_begin 83 60 -23 sha1_begin 111 88 -23 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/2 up/down: 41/-46) Total: -5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tls: P256: improve x86_64 multiplication asm codeDenys Vlasenko2024-07-121-22/+36
| | | | | | | | | | | | | | | | | | | | | | | | gcc is being rather silly. Usues suboptimal registers, and does not realize that i and j are never negative, thus usese even _more_ registers for temporaries to sign-extend i/j to 64-bit offsets. function old new delta sp_256_mont_mul_8 155 132 -23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * 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)