summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* cpio: tweak --helpHEADmasterDenys Vlasenko2023-05-091-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* nslookup: code shrinkDenys Vlasenko2023-05-091-1/+7
| | | | | | | | | | | function old new delta send_queries 725 723 -2 nslookup_main 822 820 -2 add_query 89 86 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-7) Total: -7 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* nslookup: ensure unique transaction IDs for the DNS queriesDenys Vlasenko2023-05-091-4/+390
| | | | | | | | | | | | Based on patch by Uwe Kleine-König. It makes sense to actually see the nitty-gritty details of DNS querying, so bringing in (commented-out) musl's DNS request code. function old new delta nslookup_main 760 822 +62 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: add comment about abort on syntax error %{^}Denys Vlasenko2023-05-091-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: fix "Config.in:117 error: Overlong line"Denys Vlasenko2023-05-081-3/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: fix an interactive abort on errorDenys Vlasenko2023-05-081-0/+8
| | | | | | | function old new delta parse_and_run_stream 140 155 +15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: Make it possible to build with 64bit time_tUwe Kleine-König2023-05-072-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | On most 32bit architectures time_t (and a few other time related types) are a signed 32bit wide integer type. As a consequence they can only represent dates between Fri Dec 13 08:45:52 PM UTC 1901 (-0x80000000 seconds before Jan 1 1970) and Tue Jan 19 03:14:07 AM UTC 2038 (0x7fffffff seconds after Jan 1 1970). Given that some machines that are built today have an expected lifetime of >15 years, this needs to be extended. To to that, define the cpp symbol _TIME_BITS to 64 which results in some magic in glibc to make time_t (and the few other time related types) 64 bit wide. This new switch CONFIG_TIME64 is in the spirit of CONFIG_LFS and only expected to have the expected effect with glibc. On musl for examples time_t already defaults to 64bit wide types. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* readlink: code shrinkDenys Vlasenko2023-05-071-5/+4
| | | | | | | function old new delta readlink_main 111 103 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* nmeter: improve %T fractionals displayDenys Vlasenko2023-05-071-0/+18
| | | | | | | function old new delta nmeter_main 751 786 +35 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: we can pack 21, not 20, 3-bit elements into packed wheel wordsDenys Vlasenko2023-04-231-36/+35
| | | | | | | | | | function old new delta packed_wheel 192 184 -8 factor_main 171 163 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-16) Total: -16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ip: code shrinkDenys Vlasenko2023-04-232-5/+82
| | | | | | | function old new delta ipaddr_list_or_flush 1089 1079 -10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* readlink: support --, -n alwaysEric Blake2023-04-161-17/+12
| | | | | | | | | | | | | | | | | | | | | | | POSIX will be standardizing readlink (just the -n option) and realpath (just -E and -e options): https://www.austingroupbugs.net/view.php?id=1457 Change things for readlink so that the POSIX-mandated -n and -- work even when disabling the non-standard (and partially non-working) -f when FEATURE_READLINK_FOLLOW is clear. POSIX also wants readlink to be verbose by default (if the argument is not a symlink, readlink must output a diagnostic); I did NOT address that one, because I'm waiting to see what the GNU Coreutils folks do: https://lists.gnu.org/archive/html/bug-coreutils/2023-03/msg00035.html Partial fix for https://bugs.busybox.net/show_bug.cgi?id=15466 function old new delta packed_usage 34538 34557 +19 Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tr: display usage for incorrect argumentsRon Yorston2023-04-161-1/+1
| | | | | | | | | | | | | tr must have one or two non-option arguments. Display the usage message if any other number is present. function old new delta .rodata 108389 108392 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 3/0) Total: 3 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash,hush: tab completion of functions and aliasesRon Yorston2023-04-162-6/+40
| | | | | | | | | | | | | | | | | | | | | | Since commit 9e2a5668f (ash,hush: allow builtins to be tab-completed, closes 7532) ash and hush have supported tab completion of builtins. Other shells, bash and ksh for example, also support tab completion of functions and aliases. Add such support to ash and hush. function old new delta ash_command_name - 92 +92 hush_command_name - 63 +63 ash_builtin_name 17 - -17 hush_builtin_name 38 - -38 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 0/0 up/down: 169/-55) Total: 100 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Avi Halachmi <avihpit@yahoo.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* hush: quote variable values printed by "set" (match ash behavior)Denys Vlasenko2023-04-132-4/+19
| | | | | | | function old new delta builtin_set 258 301 +43 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shuf: another tweak to COMMON_PREFIX_HACK codeDenys Vlasenko2023-04-131-8/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: clean more files on make cleanTomas Paukrt2023-04-121-0/+1
| | | | | Signed-off-by: Tomas Paukrt <tomaspaukrt@email.cz> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
* shuf: fix pfx_len calculationDenys Vlasenko2023-04-121-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shuf: remove redundant codeDenys Vlasenko2023-04-121-2/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shuf: add (disabled) code to support very long numbers in -i LO-HIDenys Vlasenko2023-04-121-6/+58
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: fix crash when icanon set with -echoAkos Somfai2023-04-121-2/+2
| | | | | | | | | When icanon is set with -echo (e.g. ssh from an emacs shell) then S.state will remain null but later it will be deferenced causing ash to crash. Fix: additional check on state. Signed-off-by: Akos Somfai <akos.somfai@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sleep: fix error exit when called as "sh" builtinDenys Vlasenko2023-04-121-1/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* seq: fix yet another case of negative parameters not workingDenys Vlasenko2023-04-112-2/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* seedrng: fix for glibc <= 2.24 not providing random headerThomas Devoogdt2023-04-111-4/+10
| | | | | | | | | | - dropped the wrong define (not sure why it was there) - <sys/random.h> not available if glibc <= 2.24 - GRND_NONBLOCK not defined if <sys/random.h> not included - ret < 0 && errno == ENOSYS has to be true to get creditable set Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* seedrng: fix for glibc <= 2.24 not providing getrandom()Denys Vlasenko2023-04-101-0/+14
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* appletlib: fix "warning: unused variable applet_no"Tomas Paukrt2023-04-101-1/+1
| | | | | Signed-off-by: Tomas Paukrt <tomaspaukrt@email.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix sleep built-in not running INT trap immediately on ^CDenys Vlasenko2023-04-101-9/+7
| | | | | | | function old new delta sleep_for_duration 169 149 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* mkfs_vfat: do not generate same volume_id when run in rapid successionDenys Vlasenko2023-04-101-2/+3
| | | | | | | function old new delta mkfs_vfat_main 1502 1523 +21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* seq: accept negative parametersDenys Vlasenko2023-04-102-2/+24
| | | | | | | | | | function old new delta seq_main 429 476 +47 packed_usage 34557 34538 -19 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 47/-19) Total: 28 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.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>