aboutsummaryrefslogtreecommitdiff
path: root/coreutils (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * touch: add SUSv3 options -a and -mXabier Oneca2021-04-121-14/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add missing -a and -m options to be fully SUSv3 compliant. function old new delta touch_main 415 510 +95 packed_usage 33824 33865 +41 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 136/0) Total: 136 bytes v2: Ignore -a/-m if not ENABLE_FEATURE_TOUCH_SUSV3. Signed-off-by: Xabier Oneca <xoneca@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * timeout,top,watch,ping: parse NN.N fractional duration in locales with other ↵Denys Vlasenko2021-03-233-4/+2
| | | | | | | | | | | | separators Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-03-011-5/+5
|\|
| * echo: do not assume that free() leaves errno unmodifiedNatanael Copa2021-02-231-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | musl libc's mallocng free() may modify errno if kernel does not support MADV_FREE which causes echo to echo with error when it shouldn't. Future versions of POSIX[1] will require that free() leaves errno unmodified but til then, do not rely free() implementation. Should fix downstream issues: https://github.com/alpinelinux/docker-alpine/issues/134 https://gitlab.alpinelinux.org/alpine/aports/-/issues/12311 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | nproc: port to WIN32 and enable by defaultRon Yorston2021-02-171-0/+30
| | | | | | | | | | | | Use the WIN32 API GetProcessAffinityMask() to obtain the number of processors configured and the number available to the current process. This only works for up to 64 processors.
* | win32: make readlink(2) implementation unconditionalRon Yorston2021-02-122-9/+0
| | | | | | | | | | | | | | There doesn't seem to be much advantage in having readlink(2) as a configuration option. Making it unconditional reduces divergence from upstream and allows the removal of a check for ENOSYS that's been in busybox-w32 since the start.
* | Merge branch 'busybox' into mergeRon Yorston2021-02-0513-27/+27
|\|
| * libbb: introduce and use fputs_stdoutRon Yorston2021-02-0312-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta fputs_stdout - 12 +12 zxc_vm_process 7237 7230 -7 yes_main 85 78 -7 write_block 380 373 -7 wrapf 305 298 -7 strings_main 437 430 -7 show_bridge 353 346 -7 rev_main 384 377 -7 put_prompt_custom 58 51 -7 put_cur_glyph_and_inc_cursor 168 161 -7 print_numbered_lines 152 145 -7 print_named_ascii 130 123 -7 print_name 135 128 -7 print_login_issue 386 379 -7 print_ascii 208 201 -7 powertop_main 1249 1242 -7 od_main 1789 1782 -7 logread_main 518 511 -7 head_main 804 797 -7 display_process_list 1319 1312 -7 cut_main 1002 995 -7 bb_dump_dump 1550 1543 -7 bb_ask_noecho 393 386 -7 baseNUM_main 702 695 -7 expand_main 755 745 -10 dumpleases_main 497 487 -10 write1 12 - -12 putcsi 37 23 -14 print_login_prompt 55 41 -14 paste_main 525 511 -14 cat_main 440 426 -14 print_it 245 230 -15 print_addrinfo 1188 1171 -17 print_rule 770 750 -20 print_linkinfo 842 822 -20 httpd_main 791 771 -20 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/34 up/down: 12/-341) Total: -329 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * nl: ensure '-b n' option displays file contentRon Yorston2021-02-022-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The command 'nl -b n' should output no line numbers, just some spaces as a placeholder followed by the actual file content. Add tests for line numbering by cat and nl. The correct results were obtained from coreutils. function old new delta print_numbered_lines 152 157 +5 .rodata 182456 182453 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 5/-3) Total: 2 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | printf: better support for escape sequencesRon Yorston2021-02-031-48/+60
| | | | | | | | | | | | | | | | | | | | | | | | Upstream printf outputs one character at a time which doesn't play well with emulation of ANSI escape sequences. Previous workarounds for this only applied in limited circumstances. Try a different approach: replace putchar() and printf() calls in the printf applet with custom routines which store the output in memory. It's only really output at the end of the program or when a newline is detected and a non-trivial amount has been collected.
* | printf: code shrinkRon Yorston2021-01-271-19/+7
| | | | | | | | | | | | | | | | | | | | Instead of constructing null-terminated strings to print, output the characters between the 's' and 't' pointers using fwrite(). This avoids having to output two separate strings when an escaped literal NUL character is encountered in the format string. Saves 32 bytes.
* | stat: improve conditional compilationRon Yorston2021-01-261-5/+4
| | | | | | | | | | | | | | | | | | If FEATURE_READLINK2 isn't enabled: - in print_stat() combine the code for 'n' and 'N' format; - in do_stat() let the compiler figure out that it doesn't need to emit code to print the symbolic link.
* | tls: avoid unnecessary changes to POSIX build, part 2Ron Yorston2021-01-253-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On reflection, the previous commit may have been ill-advised. There are many calls to open_read_close() and most shouldn't be able to access special devices. (Though in practice only a few are enabled in busybox-w32.) Nonetheless, I've implemented a new mechanism which uses the macro MINGW_SPECIAL() to mark calls to functions that are allowed to access special devices. An unrelated change is to avoid compiling fputs_stdout() in coreutils/printf.c for the POSIX build.
* | Merge branch 'busybox' into mergeRon Yorston2021-01-1421-211/+424
|\|
| * Fix mknod compilation on the FreeBSDAlex Samorukov2021-01-041-1/+3
| | | | | | | | | | | | | | | | <sys/sysmacros.h> is linux-only FreeBSD defines makedev in sys/types.h already included in the libbb.h. Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * factor: fix commentDenys Vlasenko2020-12-231-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * factor: detect squaresDenys Vlasenko2020-12-221-3/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we have a square, the speedup can be extremely large (in best case example below, it's ~40000 times faster): $ time ./busybox_old factor 18446743988964486098 18446743988964486098: 2 3037000493 3037000493 real 0m4.246s $ time ./busybox factor 18446743988964486098 18446743988964486098: 2 3037000493 3037000493 real 0m0.000s function old new delta isqrt_odd - 57 +57 print_w - 36 +36 factorize 218 236 +18 print_h - 7 +7 factorize_numstr 65 72 +7 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 2/0 up/down: 125/0) Total: 125 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * factor: fix typo in undefDenys Vlasenko2020-12-211-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * factor: code shrinkDenys Vlasenko2020-12-211-9/+8
| | | | | | | | | | | | | | function old new delta factor_main 176 171 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * factor: 30% faster trial division (better sieve)Denys Vlasenko2020-12-201-75/+95
| | | | | | | | | | | | | | | | | | | | | | function old new delta packed_wheel - 192 +192 factor_main 108 176 +68 factorize 284 218 -66 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 260/-66) Total: 194 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * help text tweaksDenys Vlasenko2020-12-183-3/+3
| | | | | | | | | | | | | | function old new delta packed_usage 33570 33502 -68 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dd: support for O_DIRECT i/oDenys Vlasenko2020-12-141-31/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on patch by Akash Hadke <hadkeakash4@gmail.com> function old new delta dd_read - 66 +66 clear_O_DIRECT - 55 +55 write_and_stats 102 135 +33 dd_main 1578 1601 +23 static.oflag_words 19 26 +7 static.iflag_words 22 29 +7 packed_usage 33665 33668 +3 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 5/0 up/down: 194/0) Total: 194 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * help text: replace [OPTIONS] with actual options (if not too long)Denys Vlasenko2020-12-134-5/+5
| | | | | | | | | | | | | | function old new delta packed_usage 33620 33665 +45 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * help text tweaksDenys Vlasenko2020-12-134-4/+4
| | | | | | | | | | | | | | function old new delta packed_usage 33547 33545 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nillyDenys Vlasenko2020-11-305-7/+7
| | | | | | | | | | | | | | | | text data bss dec hex filename 1021988 559 5052 1027599 fae0f busybox_old 1021236 559 5052 1026847 fab1f busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: introduce and use sleep1()Denys Vlasenko2020-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta sleep1 - 9 +9 run_shutdown_and_kill_processes 97 95 -2 restore_state_and_exit 116 114 -2 reread_partition_table 67 65 -2 flush_buffer_cache 80 78 -2 chat_main 1302 1300 -2 timeout_main 310 307 -3 telnet_main 1235 1232 -3 stop_handler 86 83 -3 process_action 1078 1075 -3 nbdclient_main 1185 1182 -3 init_main 789 786 -3 getty_main 1541 1538 -3 do_time 410 407 -3 runsv_main 1682 1677 -5 pause_and_low_level_reboot 59 54 -5 inetd_main 1917 1911 -6 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/16 up/down: 9/-50) Total: -41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: in @SECONDS date format, use 64-bit time if libc allowsDenys Vlasenko2020-11-281-0/+1
| | | | | | | | | | | | | | | | function old new delta packed_usage 33472 33486 +14 parse_datestr 919 916 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * date: tweak --help: -D FMT is used for -s TIME as wellDenys Vlasenko2020-11-281-26/+19
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * date: remove non-standard special-casing of date '+%f'Denys Vlasenko2020-11-281-4/+0
| | | | | | | | | | | | | | | | | | git log did not reveal why it is there. function old new delta date_main 1016 995 -21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * date: trim --help (no need to show long opts)Denys Vlasenko2020-11-281-19/+9
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * date: support -Ins, more compatible timezone display in -IDenys Vlasenko2020-11-281-7/+19
| | | | | | | | | | | | | | | | | | | | function old new delta date_main 941 1016 +75 static.isoformats 28 31 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 78/0) Total: 78 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * date: for -uR and -uIh, timezone still have to be shown at +hhmm, not as ↵Denys Vlasenko2020-11-281-5/+3
| | | | | | | | | | | | | | | | | | abbreviation function old new delta date_main 963 941 -22 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * fix commentsDenys Vlasenko2020-11-281-3/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sha3sum: fix --help: -a does not depend on FEATURE_MD5_SHA1_SUM_CHECKDenys Vlasenko2020-11-271-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * base32/64: decode in-placeDenys Vlasenko2020-11-271-5/+12
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * base32/64: implement -w COLDenys Vlasenko2020-11-271-22/+34
| | | | | | | | | | | | | | | | | | | | function old new delta baseNUM_main 568 655 +87 packed_usage 33478 33533 +55 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 142/0) Total: 142 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * base32: new appletDenys Vlasenko2020-11-261-10/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta baseNUM_main - 568 +568 decode_base32 - 275 +275 bb_uuenc_tbl_base32 - 34 +34 read_base64 218 236 +18 applet_names 2732 2739 +7 applet_main 1580 1584 +4 packed_usage 33480 33478 -2 base64_main 208 - -208 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 3/1 up/down: 906/-210) Total: 696 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2020-11-124-15/+95
|\|
| * shell: better support of [[ ]] bashismDenys Vlasenko2020-10-311-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Still rather rudimentary for ash function old new delta binop 433 589 +156 check_operator 65 101 +36 done_word 736 769 +33 test_main 405 418 +13 parse_stream 2227 2238 +11 ops_texts 124 133 +9 ops_table 80 86 +6 run_pipe 1557 1562 +5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/0 up/down: 269/0) Total: 269 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * uudecode: fix possible signed char bugDenys Vlasenko2020-10-071-4/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: shrink recursive_action() by reducing memory pressureDenys Vlasenko2020-10-012-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta recursive_action1 - 316 +316 file_action_grep 161 164 +3 add_to_prg_cache_if_socket 202 205 +3 depmod_main 509 511 +2 writeFileToTarball 488 489 +1 parse_module 281 282 +1 fileAction 207 208 +1 act 189 190 +1 add_to_dirlist 65 64 -1 writeTarFile 196 194 -2 uuidcache_init 47 45 -2 uuidcache_check_device 109 107 -2 true_action 8 6 -2 run_parts_main 310 308 -2 netstat_main 534 532 -2 lsusb_main 29 27 -2 lspci_main 45 43 -2 initial_scan 138 136 -2 grep_main 845 843 -2 find_main 482 480 -2 config_file_action 437 435 -2 chmod_main 142 140 -2 dirAction 14 10 -4 diff_main 1544 1540 -4 chown_main 154 148 -6 skip_dir 136 129 -7 dir_act 191 184 -7 recursive_action 453 69 -384 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 7/20 up/down: 328/-439) Total: -111 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash, ls: improve support for 'c:path'Ron Yorston2020-08-281-0/+5
| | | | | | | | | | | | | | | | | | | | Revert commit 249f68e3c (win32: append '/' to bare drive name in opendir). Instead add better handling for paths of the form 'c:path' to ls and expmeta() in ash. Adds 64 bytes.
* | printf: ensure '\045' is printed as '%'Ron Yorston2020-08-281-5/+10
| | | | | | | | | | | | | | | | | | Using printf() instead of fputs() to save a few bytes was a false economy. printf() eats percent signs. See GitHub issue #199. Adds 32 bytes.
* | printf: prevent '\0' in format string from truncating outputFRP-3578-g359211429Ron Yorston2020-08-241-1/+9
| | | | | | | | | | | | | | | | | | Commit 4a2af48e6 (printf: emit more contiguous text to improve escape sequences) didn't treat an escaped null byte in the format string correctly. The output string was truncated at the null byte. Detect this case, output the partial string and the null byte and carry on.
* | Merge branch 'busybox' into mergeRon Yorston2020-08-232-2/+0
|\|
| * build system: drop PLATFORM_LINUXRon Yorston2020-08-132-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PLATFORM_LINUX is a hidden configuration option which is disabled by default and enabled at over a hundred locations for features that are deemed to be Linux specific. The only effect of PLATFORM_LINUX is to control compilation of libbb/match_fstype.c. This file is only needed by mount and umount. Remove all references to PLATFORM_LINUX and compile match_fstype.c if mount or umount is enabled. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ls: allow backslashes to be replaced in displayed pathsfix_backslashRon Yorston2020-08-191-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally 'ls' displays paths exactly as the user enters them: $ ls .//file .//file In busybox-w32 paths using backslash as a separator are displayed in a form that can't be reused as input to the shell: $ ls .\\file .\file Allow backslashes to be replaced with forward slashes if the environment variable BB_FIX_BACKSLASH is set to 1. See GitHub issue #196.
* | build system: reinstate PLATFORM_LINUXRon Yorston2020-08-031-0/+1
| | | | | | | | | | | | | | Removing 'select PLATFORM_LINUX' from ps and stat has no material effect: it just causes match_fstype.o to be built needlessly. Remove this difference from upstream.
* | win32: code shrink kill(2)Ron Yorston2020-07-251-1/+1
| | | | | | | | | | | | | | | | - Drop exit_code argument from kill_SIGTERM_by_handle() - Pass signal number rather than exit code to other functions - Merge kill_SIGKILL() and kill_SIGTEST() Saves 112 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2020-07-091-4/+4
|\|