aboutsummaryrefslogtreecommitdiff
path: root/coreutils (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'busybox' into mergeRon Yorston2024-07-131-4/+0
|\|
| * 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>
* | Merge branch 'busybox' into mergeRon Yorston2024-06-232-11/+10
|\|
| * libbb: add bit counting function, use where appropriateDenys Vlasenko2024-05-311-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-311-4/+5
| | | | | | | | | | | | | | | | | | | | | | 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>
| * 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>
* | kill: killing a zombie process should failRon Yorston2024-05-141-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A process which has exited may still have its process handle held open by its children. Such a process doesn't appear in the process table. It is thus similar to a zombie process in UNIX. Using kill(1) to interact with such a process was seen to succeed, contrary to expectation. The code for "ordinary" signals in kill(2) did check if the process was still active but didn't treat an attempt to kill an inactive process as an error. Furthermore, sending SIGKILL or the fake signal 0 to a process didn't even check if the process was still active. Rearrange the implementation of kill(2) so that an attempt to signal an inactive process is treated as an error. This also consolidates handling of SIGKILL and signal 0 with "ordinary" signals. Saves 96 bytes. (GitHub issue #416)
* | yes: code shrinkRon Yorston2024-04-181-5/+0
| | | | | | | | | | | | | | | | | | Now that putchar() is implemented using winansi_fputc() it isn't necessary to perform an explicit substitution in 'yes'. This was previously done so 'yes' could check for a broken pipe. Saves 16-32 bytes.
* | timeout: fix handling of timeoutsRon Yorston2024-04-081-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'timeout' applet, by default, accepted fractional seconds but ignored the fraction. Moreover, in busybox-w32, even the integer part was incorrectly handled. Rewrite the (Windows) code to fix both problems. A patch has also been submitted to fix upstream. If that is accepted the Windows port will need to be updated to match. Saves 8-16 bytes. (GitHub issue #400)
* | md5/shaXsum: accept uppercase hex stringsRon Yorston2024-04-031-0/+4
| | | | | | | | | | | | | | | | | | 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. (GitHub issue #394)
* | ls: support NO_COLOR environment variableRon Yorston2024-01-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | If the NO_COLOR environment variable is set and is not empty 'ls' won't output ANSI colour codes. This is an alternative to the existing approach of setting 'LS_COLORS=none'. See https://no-color.org/. Costs 24-32 bytes. (GitHub issue #382)
* | Merge branch 'busybox' into mergeFRP-5236-g7dff7f376Ron Yorston2023-12-053-21/+24
|\|
| * sleep: Update docPetr Vorel2023-11-071-7/+8
| | | | | | | | | | | | | | | | | | 4c20d9f2b removed FEATURE_FLOAT_SLEEP option, thus since then there are only two variants. Fixes: 4c20d9f2b ("extend fractional duration support to "top -d N.N" and "timeout"") Signed-off-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * install: Fix chown resetting suid/sgid bits from chmodNero2023-10-021-7/+9
| | | | | | | | | | | | | | | | | | | | Since Linux 2.2.13, chown(2) resets the suid/gid bits for all users. This patch changes the ordering so that chmod gets called after chown. This behavior follows GNU coreutils. Signed-off-by: Nero <nero@w1r3.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sleep: fix "sleep -- ARGS"Denys Vlasenko2023-10-022-7/+7
| | | | | | | | | | | | | | | | | | | | | | function old new delta sleep_main 116 119 +3 printf_main 860 837 -23 single_argv 50 25 -25 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 3/-48) Total: -45 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | sort: add support for sorting version stringsRon Yorston2023-10-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | Add an implementation of strverscmp from musl so that the 'sort -V' option works. Add '-V' to the trivial usage message. Costs 248-256 bytes. (GitHub issue #370)
* | Merge branch 'busybox' into mergeRon Yorston2023-08-311-3/+17
|\|
| * tsort: avoid use-after-freeRon Yorston2023-08-311-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the input data contained a cycle it was possible for tsort to attempt to access freed nodes. This sometimes resulted in the test case 'echo a b b a | tsort' crashing. Don't free nodes when they're removed from the graph. function old new delta tsort_main 621 596 -25 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-25) Total: -25 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2023-08-108-8/+8
|\|
| * introduce and use exitcode_tDenys Vlasenko2023-07-178-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta strings_main 422 420 -2 setfattr_main 175 173 -2 brctl_main 1548 1546 -2 makedevs_main 979 975 -4 rev_main 337 332 -5 getfattr_main 307 302 -5 cut_main 1201 1196 -5 cksum_main 398 393 -5 umount_main 573 565 -8 ln_main 516 508 -8 expand_main 660 652 -8 df_main 1068 1060 -8 renice_main 346 332 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/13 up/down: 0/-76) Total: -76 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | nproc: fix build with long options disabledRon Yorston2023-08-061-2/+2
| | | | | | | | Allow nproc to build without error when LONG_OPTS is disabled.
* | date: allow system date to be setRon Yorston2023-07-161-25/+0
| | | | | | | | | | | | | | | | | | Implement clock_settime(2) and enable the '-s' option to allow the system time to be set. This requires elevated privileges. The code in date.c is now identical to upstream BusyBox. Costs 256-272 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2023-07-1372-86/+86
|\|
| * Update applet size estimatesDenys Vlasenko2023-07-1072-86/+86
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2023-06-162-43/+86
|\|
| * od: -l,I,L indeed depend on sizeof(long), fix thisDenys Vlasenko2023-05-262-11/+20
| | | | | | | | | | | | | | | | | | | | function old new delta .rodata 105255 105252 -3 od_main 1917 1901 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-19) Total: -19 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * od: actually remove -IL from --help, as comment saysDenys Vlasenko2023-05-261-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * od: support -DOHXILDenys Vlasenko2023-05-262-17/+30
| | | | | | | | | | | | | | | | | | | | function old new delta od_main 1866 1917 +51 .rodata 105306 105321 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 66/0) Total: 66 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb/dump: conditionalize code used only by xxd and odDenys Vlasenko2023-05-261-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * od: fix default format, shrinkDenys Vlasenko2023-05-261-20/+22
| | | | | | | | | | | | | | | | | | | | function old new delta od_main 556 568 +12 .rodata 104613 104555 -58 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 12/-58) Total: -46 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * od: stop printing extra trailing spacesDenys Vlasenko2023-05-251-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta .rodata 104598 104613 +15 display 1475 1485 +10 od_main 549 556 +7 rewrite 971 967 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 32/-4) Total: 28 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * od: implement -BDenys Vlasenko2023-05-251-11/+12
| | | | | | | | | | | | | | | | | | | | function old new delta .rodata 105305 105306 +1 od_main 1880 1866 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 1/-14) Total: -13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * od: correct -i, enable tests which pass for DESKTOP tooDenys Vlasenko2023-05-252-2/+6
| | | | | | | | | | | | | | function old new delta .rodata 105302 105305 +3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * od: for !DESKTOP, match output more closely to GNU coreutils 9.1, implement -sDenys Vlasenko2023-05-251-21/+34
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * od: fix -ODavid Leonard2023-05-251-1/+1
| | | | | | | | | | | | | | | | od with option -O (4-byte octal) was incorrectly displaying 2-byte decimal when built without CONFIG_DESKTOP Signed-off-by: David Leonard <d+busybox@adaptive-enterprises.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Fixes for old mingw-w64Ron Yorston2023-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Allow current busybox-w32 to build with the CentOS 6 version of mingw-w64. - Fix declaration of setlinebuf(). (GitLab issue 116) - Define ENABLE_VIRTUAL_TERMINAL_INPUT. (GitLab issue 117) - Define IO_REPARSE_TAG_APPEXECLINK. - Avoid a compiler warning in coreutils/shuf.c.
* | ls: code shrinkRon Yorston2023-06-071-10/+11
| |
* | ls: check whether link is hiddenRon Yorston2023-06-061-0/+17
| | | | | | | | | | | | | | | | | | | | When using 'ls -L' to list the target of a symlink (or equivalent) we must first check whether the link itself is hidden and thus subject to special treatment by the '-a' or '-A' options. Adds 80 bytes. (GitHub issue #331)
* | ls: allow hidden system files to be omittedRon Yorston2023-06-011-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'ls' applet in busybox-w32 treated files with the hidden attribute as though they had a leading '.'. Some such files also have the system attribute set. Since these aren't of much interest to most users and since several of them have long unsightly names there's some advantage in allowing them to be omitted from the listing. Implement this by omitting hidden system files if the '-a' or '-A' option is given twice. Adds 80-88 bytes (GitHub issue #328)
* | Merge branch 'busybox' into mergeRon Yorston2023-05-232-41/+39
|\|
| * 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>
| * 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>
* | win32: changes to signal handlingRon Yorston2023-05-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | 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.
* | 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-175-27/+92
|\|
| * 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>
| * shuf: another tweak to COMMON_PREFIX_HACK codeDenys Vlasenko2023-04-131-8/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>