aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* hush: code shrinktab_completionRon Yorston2023-04-133-11/+9
| | | | | | | | | | | | | | | | | | | | Handle both arrays of builtin as the same type. function old new delta ash_command_name - 154 +154 hush_command_name - 97 +97 complete_cmd_dir_file 876 880 +4 ash_builtin_name 17 - -17 hush_builtin_name 38 - -38 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 1/0 up/down: 255/-55) Total: 200 bytes In the case where ash is disabled and hush is enabled but with support for functions disabled this reduces the bloat from 31 to 6 bytes. (GitHub issue #301) Signed-off-by: Ron Yorston <rmy@pobox.com>
* ash: fix tab completionRon Yorston2023-04-111-2/+2
| | | | | | | | | | | | | | | | | | | The initial index for the command and alias tables was incorrect. Change since 3165054d2: function old new delta ash_command_name - 155 +155 hush_command_name - 110 +110 complete_cmd_dir_file 876 880 +4 ash_builtin_name 17 - -17 hush_builtin_name 38 - -38 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 1/0 up/down: 269/-55) Total: 214 bytes (GitHub commit #301) Signed-off-by: Ron Yorston <rmy@pobox.com>
* ash,hush: improvements to tab completionRon Yorston2023-04-112-35/+45
| | | | | | | | | | | | | | | | | | | | | Cosmetic changes. Avoid accessing beyond the end of the command and alias arrays in ash. Code shrink. Change since commit 3165054d2: function old new delta ash_command_name - 153 +153 hush_command_name - 110 +110 complete_cmd_dir_file 876 880 +4 ash_builtin_name 17 - -17 hush_builtin_name 38 - -38 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 1/0 up/down: 267/-55) Total: 212 bytes (GitHub issue #301) Signed-off-by: Ron Yorston <rmy@pobox.com>
* ash,hush: tab completion of functions and aliasesRon Yorston2023-04-104-15/+84
| | | | | | | | | | | | | | | | | | Rework the 'get_exe_name' functions in ash and hush so functions and aliases are considered when tab-completing a command. function old new delta ash_command_name - 188 +188 hush_command_name - 118 +118 complete_cmd_dir_file 876 880 +4 ash_builtin_name 17 - -17 hush_builtin_name 38 - -38 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 1/0 up/down: 310/-55) Total: 255 bytes (GitHub issue #301) Signed-off-by: Ron Yorston <rmy@pobox.com>
* ash,hush: rename get_builtin_nameRon Yorston2023-04-102-5/+5
| | | | | | | | | Rename get_builtin_name() in ash and hush to avoid confusing bloatcheck. No functional changes. (GitHub issue #301) Signed-off-by: Ron Yorston <rmy@pobox.com>
* libbb: consolidate NOMMU fix of restoring high bit in argv[0][0]Denys Vlasenko2023-04-065-9/+8
| | | | | | | | | | | function old new delta fork_or_rexec 46 56 +10 bootchartd_main 1087 1079 -8 cpio_main 674 661 -13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 10/-21) Total: -11 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: sleep builtin with no arguments should not exitDenys Vlasenko2023-04-032-2/+15
| | | | | | | | | | function old new delta sleep_main 116 143 +27 .rodata 105245 105268 +23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 50/0) Total: 50 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: printf builtin with no arguments should not exitDenys Vlasenko2023-04-031-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: code shrink: do not take address of prefix(), allowing it to inlineDenys Vlasenko2023-04-031-8/+4
| | | | | | | | | | function old new delta getjob 281 285 +4 prefix 13 - -13 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 4/-13) Total: -9 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: code shrink - reuse is_prefixed_with() from libbbDenys Vlasenko2023-04-031-2/+4
| | | | | | | | | | | function old new delta changepath 67 68 +1 legal_pathopt 70 66 -4 prefix 34 13 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 1/-25) Total: -24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: get rid of separate mail_var_path_changed flag variableDenys Vlasenko2023-04-031-10/+9
| | | | | | | | | | | | | | | | We can just clear mailtime_hash to zero and have the same effect. function old new delta changemail 8 11 +3 mail_var_path_changed 1 - -1 cmdloop 398 382 -16 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 3/-17) Total: -14 bytes text data bss dec hex filename 1054786 559 5020 1060365 102e0d busybox_old 1054773 559 5020 1060352 102e00 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix still-broken new mail detectionDenys Vlasenko2023-04-031-4/+4
| | | | | | | | padvance() exit condition is return value < 0, not == 0. After MAIL changing twice, the logic erroneously concluded that "you have new mail". Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix broken new mail detectionDenys Vlasenko2023-04-031-1/+0
| | | | | | | | | | Mea culpa, in "Do not allocate stack string in padvance" commit (I left an extraneous "break" statement). function old new delta cmdloop 329 398 +69 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush (NOMMU): fix LINENO in execed childrenDenys Vlasenko2023-04-011-0/+15
| | | | | | | | | | | function old new delta hush_main 1815 1851 +36 re_execute_shell 601 635 +34 .rodata 102721 102726 +5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 75/0) Total: 75 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: speed up "big heredoc" codeDenys Vlasenko2023-04-011-7/+15
| | | | | | | | | | function old new delta hush_main 1810 1815 +5 .rodata 102723 102721 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 5/-2) Total: 3 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add TODO commentDenys Vlasenko2023-04-011-0/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: code shrinkDenys Vlasenko2023-04-011-3/+3
| | | | | | | | | | function old new delta describe_command 323 320 -3 dotcmd 324 309 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18) Total: -18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: exec: Stricter pathopt parsing - lost chunkDenys Vlasenko2023-03-311-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: improve trap and jobs builtins in child shellsRon Yorston2023-03-313-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | The trap and jobs builtins can be used to report information about traps and jobs. This works when they're called from the current shell but in a child shell the required information is usually cleared. Special hacks allow: - trap to work with command substitution; - jobs to work with command substitution or in a pipeline. Neither works with process substitution. - Relax the test for the trap hack so it also supports pipelines. - Pass the command to be evaluated to forkshell() in evalbackcmd() so trap and jobs both work with process substitution. function old new delta forkchild 629 640 +11 argstr 1502 1496 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 11/-6) Total: 5 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* modprobe: call finit_module with MODULE_INIT_COMPRESSED_FILE if module name ↵Denys Vlasenko2023-03-312-2/+22
| | | | | | | | | | | | | | | doesn't end with .ko IOW: if name doesn't end with .ko, assume it's .gz/.xz or similar, and ask kernel to uncompress it. If finit_module(MODULE_INIT_COMPRESSED_FILE) fails, retry with finit_module(0). function old new delta bb_init_module 151 197 +46 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: make EPOCH variables work if RANDOM is disabledRon Yorston2023-03-291-1/+1
| | | | | | | | | | | | | | | Commit 1d37186fe2 (ash: add bash-compatible EPOCH variables) added support for the EPOCHSECONDS and EPOCHREALTIME variables. These variables are dynamic and therefore require the VDYNAMIC flag to be non-zero. However, this is only the case if support for the RANDOM variable is enabled. Give VDYNAMIC a non-zero value if either EPOCH variables or RANDOM are enabled. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: fix matching of directories when searching PATHRon Yorston2023-03-291-2/+2
| | | | | | | | | | | | | | | Commit 8baa643a3 (lineedit: match local directories when searching PATH) included subdirectories of the current directory in the search when tab-completing commands. Unfortunately a short time later commit 1d180cd74 (lineedit: use strncmp instead of is_prefixed_with (we know the length)) broke this feature by returning an incorrect length for the array of paths. Fix the length and reinstate matching of subdirectories. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb/sha: do not read shaNI variable twice, and factor out its settingDenys Vlasenko2023-03-291-12/+16
| | | | | | | | | | | | My gcc inlines both calls, so instead of "-20 bytes" I get only this: function old new delta sha256_begin 84 83 -1 sha1_begin 114 111 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-4) Total: -4 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb/sha: fix sha-NI instruction detectionDenys Vlasenko2023-03-291-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* httpd: do not mangle cgi-bin/SCRIPT/params URLsDenys Vlasenko2023-03-281-36/+38
| | | | | | | | | | | | | If cgi-bin/ prefix is seen, do not test the rest for existence, whether it's a dir, and such. function old new delta handle_incoming_and_exit 2200 2212 +12 Reported here: https://lists.zx2c4.com/pipermail/cgit/2023-March/004825.html Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* find: implement -okDavid Leonard2023-03-282-3/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html -ok utility_name [argument ...] ; The -ok primary shall be equivalent to -exec, except that the use of a <plus-sign> to punctuate the end of the primary expression need not be supported, and find shall request affirmation of the invocation of utility_name using the current file as an argument by writing to standard error as described in the STDERR section. If the response on standard input is affirmative, the utility shall be invoked. Otherwise, the command shall not be invoked and the value of the -ok operand shall be false. function old new delta do_exec 438 517 +79 parse_params 1833 1845 +12 static.params 288 292 +4 .rodata 100771 100775 +4 packed_usage 34543 34541 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 99/-2) Total: 97 bytes Signed-off-by: David Leonard <d+busybox@adaptive-enterprises.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fixdep: avoid underflow when end of entry doesn't coincide with EOFArsen Arsenović2023-02-271-0/+5
| | | | | | | Bug: https://bugs.gentoo.org/893776 Closes: https://bugs.busybox.net/show_bug.cgi?id=15326 Signed-off-by: Arsen Arsenović <arsen@gentoo.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* unzip: document some options we might supportDenys Vlasenko2023-02-231-0/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* unzip: clear SUID/GID bits, implement -K to not clear themDenys Vlasenko2023-02-221-3/+12
| | | | | | | | | | | function old new delta unzip_main 2656 2715 +59 packed_usage 34517 34552 +35 .rodata 105250 105251 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 95/0) Total: 95 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* top: stop using div() from libc, compilers now do it betterDenys Vlasenko2023-02-131-9/+16
| | | | | | | | | | function old new delta div 23 - -23 display_process_list 1237 1178 -59 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/1 up/down: 0/-82) Total: -82 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: restore SIGHUP handling, this time explain why we do what we doDenys Vlasenko2023-01-301-20/+28
| | | | | | | function old new delta check_and_run_traps 229 278 +49 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: restore tty pgrp on SIGHUPDenys Vlasenko2023-01-301-5/+8
| | | | | | | | | | | | | Found one case where SIGHUP does need some handling. ash does not restore tty pgrp when killed by SIGHUP, and this means process which started ash needs to restore it, or it would get backgrounded when trying to use tty. function old new delta check_and_run_traps 214 229 +15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: remove special handling of SIGHUPDenys Vlasenko2023-01-301-18/+20
| | | | | | | | | | Kernel should do the right thing. (ash and dash do not have special SIGHUP handling.) function old new delta check_and_run_traps 278 214 -64 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: fix SIGWINCH and SIGCHLD (in hush) interrupting line input, closes 15256Denys Vlasenko2023-01-263-10/+20
| | | | | | | | | | function old new delta record_pending_signo 32 63 +31 lineedit_read_key 231 224 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 31/-7) Total: 24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* nmeter: increase maximum /proc file size (needed for large machines)Denys Vlasenko2023-01-241-3/+6
| | | | | | | function old new delta get_file 185 201 +16 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ntpd: correct comment: 2^-20 is ~1 microsecond (confused with 10^-20)Denys Vlasenko2023-01-181-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ntpd: fold d_to_tv() into its only callerDenys Vlasenko2023-01-181-8/+10
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ntpd: correct fixed->float conversions of fractionsDenys Vlasenko2023-01-171-4/+4
| | | | | | | | | | Need to divide by (1<<32), not by (1<<32)-1. Fraction of 0xffffffff is not 1 whole second. function old new delta .rodata 105264 105268 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ntpd: make NTP client and server Y2036/2038-readyMiroslav Lichvar2023-01-171-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | The 32-bit integer part of the NTP timestamp overflows in year 2036, which starts the second NTP era. Modify the timestamp conversion to shift values between 1900-1970 (in the first era) to the second era to enable the client to measure its offset correctly until year 2106 (assuming 64-bit time_t). Also update the conversion from double used when stepping the clock to work with 64-bit time_t after reaching the maximum 32-bit value in 2038 and the server conversion to work correctly in the next NTP era. function old new delta lfp_to_d 51 64 +13 step_time 326 332 +6 .rodata 105260 105264 +4 d_to_lfp 100 86 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 23/-14) Total: 9 bytes Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ed: don't use memcpy with overlapping memory regionsSören Tempel2023-01-051-1/+1
| | | | | | | | | | | | | | | | | | The memcpy invocations in the subCommand function, modified by this commit, previously used memcpy with overlapping memory regions. This is undefined behavior. On Alpine Linux, it causes BusyBox ed to crash since we compile BusyBox with -D_FORTIFY_SOURCE=2 and our fortify-headers implementation catches this source of undefined behavior [0]. The issue can only be triggered if the replacement string is the same size or shorter than the old string. Looking at the code, it seems to me that a memmove(3) is what was actually intended here, this commit modifies the code accordingly. [0]: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13504 Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Start 1.37.0 development cycleDenys Vlasenko2023-01-031-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Bump version to 1.36.01_36_0Denys Vlasenko2023-01-031-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: code shrinkDenys Vlasenko2023-01-031-4/+9
| | | | | | | function old new delta run_list 1032 1012 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: trivial code shrinkDenys Vlasenko2023-01-031-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* xxd: use bb_simple_perror_msg... where appropriateDenys Vlasenko2023-01-031-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shell: fix compile failures in some configsDenys Vlasenko2023-01-034-15/+31
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Makefile.flags: add resolv to LDLIBS for linux compilers too (not only gnu ones)Denys Vlasenko2023-01-021-0/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix double-free in FEATURE_CLEAN_UP=y configsDenys Vlasenko2023-01-021-4/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* mv: fix error in !VERBOSE configsDenys Vlasenko2023-01-021-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb/loop: fix compile failure (name collision)Denys Vlasenko2023-01-021-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>