aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * 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>
* | drop: changes to ctrl-c handlingRon Yorston2023-05-231-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the new kill_child_ctrl_handler() function: - Ctrl-C can be used to terminate non-console applications. - Ctrl-C in an interactive cmd.exe or PowerShell session won't cause drop to terminate. Also: - Use getopt32() to process options. - Update usage messages. Adds 96-160 bytes.
* | win32: crtl-c interrupts non-console applicationsRon Yorston2023-05-232-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 9db9b34ad (win32: ignore ctrl-c in parent of execve(2)) prevented a parent process from reacting to Ctrl-C while it was waiting for its child to complete. This avoids the problem where a shell and an interactive child end up competing for input after a Ctrl-C. However, a child process which isn't attached to the console (a GUI application, for example) can't then be killed by Ctrl-C. Instead of completely ignoring Ctrl-C give the parent a handler which detects if its child is attached to the console. If so it's left to handle Ctrl-C itself and the parent ignores the interrupt. If not the parent terminates the child and all its children as if by SIGINT. Costs 200 bytes.
* | win32: changes to signal handlingRon Yorston2023-05-235-18/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use an exit code of the form (signal << 24) when a process exits due to a signal. This replaces the previous use of (signal + 128). This makes it easier to distinguish exit codes from signals. Allow kill(2) to handle all defined signals, not just EXIT, TERM and KILL. The kill and timeout applets now accept any defined signals. Convert certain Windows status codes Unix-style signal codes. In ash: - Exit as if with SIGINT in raise_interrupt() rather than call raise(SIGINT). The latter returns an exit code of 3. - Detect if a child process exits as if with SIGINT. If not and if the parent is an interactive top-level shell, reset pending_int. This prevents the parent from seeing an INT if the child hasn't reported it exited due to INT. (Probably due to it being an interactive shell.) Costs 132-136 bytes.
* | timeout: code shrinkRon Yorston2023-05-231-2/+6
| | | | | | | | | | | | | | | | | | In the win32 code the 'parent' variable is always zero. It's also used as the pid to be killed when the child process survives the initial kill attempt. Although this works as intended there's no need for the 'parent' variable. Saves 16 bytes.
* | su: add option to keep console open on shell exitRon Yorston2023-05-022-7/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The '-N' option keeps the console window open after the elevated shell exits. Previously this was achieved by passing the '-s' option along with '-c'. Recent changes allow scripts to be run without using '-c' so a new mechanism is required. su passes the '-N' flag to the shell. This causes the shell to issue a prompt and wait for user input when it exits. Costs 200-204 bytes.
* | su: add option to wait for shell exit codeRon Yorston2023-05-021-3/+27
| | | | | | | | | | | | | | The '-W' option causes su to wait for the elevated shell to terminate and returns its exit code. Costs 144 bytes.
* | make: special treatment of archive membersRon Yorston2023-05-011-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The standard says: If a target or prerequisite contains parentheses, it shall be treated as a member of an archive library. For the lib(member.o) expression lib refers to the name of the archive library and member.o to the member name. 'lib(member.o)' is referred to as an 'expression' rather than a name; 'lib' and 'member.o' are called names. Allow for this in is_valid_name() by splitting such expressions into separate archive/member names and checking these individually.
* | win32: further code shrink quote_args()Ron Yorston2023-04-281-19/+3
| | | | | | | | | | | | | | | | Squeeze a few more bytes out of quote_args(). (Thanks to GitHub user avih.) Saves 16 bytes.
* | win32: code shrink copying of argvRon Yorston2023-04-283-10/+19
| | | | | | | | | | | | | | There are two places where a copy of an argv array is made with extra space at the start. Move this code into a function. Saves 56-64 bytes.
* | iconv: use temporary file for outputRon Yorston2023-04-271-2/+11
| | | | | | | | | | | | | | | | On Linux iconv allows the output file specified with '-o' to be the same as the input file. Do the same for our version by creating a temporary output file and renaming it on completion. Costs 64-88 bytes.
* | yes: detect pipe fail errorRon Yorston2023-04-271-4/+5
| | | | | | | | | | | | | | | | Commit 418f43bea (yes: add explicit error check for WIN32) added a call to ferror() to detect when output to a pipe failed. Now that we check for pipe failures in the winansi code we can use that instead.
* | xargs: reinstate use of nofork appletsRon Yorston2023-04-271-22/+38
| | | | | | | | | | | | | | | | Commit 99402ca92 (xargs: kill children when interrupted by Ctrl-C) caused all child processes to be spawned, losing the advantage of running nofork applets without spawning. Costs 64 bytes.
* | win32: improved error for overlong command lineRon Yorston2023-04-271-1/+6
| | | | | | | | | | | | | | | | Report 'Arg list too long' rather than 'Invalid argument' when spawnveq() detects that the EINVAL return from spawnve() is due to the command line being too long. Costs 48-64 bytes.
* | win32: code shrink quote_args()Ron Yorston2023-04-271-58/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace parts of quote_args() with code from avih's GitHub PR #317. This overestimates the size of the buffer to avoid having to calculate the exact size. Retain the code to determine whether the argument needs to be quoted. Quoting arguments unconditionally wastes space on the command line and causes the test "xargs argument line too long" to fail. Saves 144-176 bytes.
* | su: pass additional arguments to shRon Yorston2023-04-261-9/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The real su allows a command file to be run, with arguments given on the command line. Similarly it allows the script run with '-c' to take arguments. In fact, any arguments can be passed to sh. Permit the same in the Windows implementation. For compatibility this requires a user name to be specified, even though we only support elevation. The user name must be 'root'. Also, ensure the '-c' command is properly quoted. Adds 144-152 bytes. (GitHub PR #317)
* | win32: export xappendword()Ron Yorston2023-04-235-16/+21
| | | | | | | | | | | | | | Export the function xappendword() from make. Use it in drop and watch. Saves 8-80 bytes, an unusually large disparity.
* | win32: case-sensitivity in tab completionRon Yorston2023-04-193-44/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tab-completion code treated all matches as case-insensitive because that's how Microsoft Windows handles filenames. This is now inadequate, as shell builtins, functions and aliases are case sensitive. Modify the treatment of case-sensitivity in tab completion: - Track whether each potential match is case-insensitive (filename) or case-sensitive (shell builtin, function or alias). - When comparing matches use a case-insensitive comparison if either value is a filename. Otherwise use a case-sensitive comparison. Adds 64 bytes.
* | dd: omit direct flagRon Yorston2023-04-181-4/+19
| | | | | | | | | | | | | | | | O_DIRECT isn't supported with open(2) on Microsoft Windows. All code related to the 'direct' input/output flag can be omitted. Saves 160 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2023-04-1715-53/+191
|\|
| * 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>
* | wget: enable progress bar in default configurationRon Yorston2023-04-163-3/+3
| | | | | | | | | | | | For some reason the progress bar in wget has never been enabled. Costs 1536-1600 bytes.
* | libbb: don't build useless functionsRon Yorston2023-04-162-0/+8
| | | | | | | | | | | | | | | | | | | | The functions ndelay_on(), ndelay_off() and close_on_exec_on() don't do anything useful because our fcntl(2) implementation doesn't support the features they require. Replace them with stubs. Saves 176-208 bytes.
* | ash: more Unix-style path fixesRon Yorston2023-04-161-7/+19
| | | | | | | | | | | | | | | | | | | | | | Commit 950b318a2 (ash: Unix-style paths, shell builtins and applets) broke running of Unix-style absolute paths from the shell by PATH search. The copy of the program name on the stack should only be used in the first call to tryexec() otherwise it interferes with the use of the stack by padvance(). Also, bring the code to handle Unix-style paths in find_command() into line with the revised code in shellexec().
* | win32: further fix incorrect path search in spawnvpRon Yorston2023-04-161-1/+3
| | | | | | | | | | | | | | | | Commit 9581d2396 (win32: fix incorrect path search in spawnvp) fixed the unwanted PATH search for relative or absolute paths but broke the desired PATH search for Unix-style paths. (GitHub issue #310)
* | win32: fix incorrect path search in spawnvpRon Yorston2023-04-141-3/+1
| | | | | | | | | | | | | | | | | | Commit 26ba73098e (win32: search PATH for missing Unix-style executables) rearranged the code of mingw_spawnvp(). As a result commands with a relative or absolute path could be incorrectly searched for on PATH. (GitHub issue #310)
* | Merge branch 'busybox' into mergeRon Yorston2023-04-0920-122/+271
|\|
| * 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>