aboutsummaryrefslogtreecommitdiff
path: root/coreutils
Commit message (Collapse)AuthorAgeFilesLines
* shuf: simplify check that we have at least one FILEGravatar Denys Vlasenko6 hours1-5/+2
| | | | | | | | | | | function old new delta .rodata 103190 103194 +4 packed_usage 33541 33537 -4 shred_main 354 337 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 4/-21) Total: -17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: more --help tweaksGravatar Denys Vlasenko7 hours1-1/+1
| | | | | | | function old new delta packed_usage 33552 33541 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: --help tweaksGravatar Denys Vlasenko20 hours6-12/+22
| | | | | | | function old new delta packed_usage 33589 33552 -37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* base32/64: accept -i "skip bad chars" option (currently in effect ↵Gravatar Denys Vlasenko41 hours1-2/+4
| | | | | | | | | unconditionally) function old new delta .rodata 103189 103190 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: more --help tweakingGravatar Denys Vlasenko3 days1-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: more --help tweaks, mostly expanding ts --helpGravatar Denys Vlasenko3 days4-5/+5
| | | | | | | function old new delta packed_usage 33554 33596 +42 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: --help tweaksGravatar Denys Vlasenko3 days3-9/+11
| | | | | | | | | | function old new delta .rodata 103190 103189 -1 packed_usage 33590 33566 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-25) Total: -25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: trim --help textGravatar Denys Vlasenko10 days1-9/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ls: don't output any colors with TERM=dumbGravatar Sören Tempel11 days1-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | The TERM variable is usually set to "dumb" to indicate that the terminal does not support any ANSI escape sequences. Presently, ls does not honor this variable and outputs colors anyhow which results in unreadable output, unless the user explicitly disables colors using `ls --color=never`. The rational behind this change is that ls should "just work" by default, even on dumb terminals. For this reason, this patch adds a check which additionally consults the TERM variable before printing any colors. This is analogous to the existing check for ensuring that standard output is a tty. As such, colors can still be forced with `--color=force`, even if TERM is set to dumb. function old new delta is_TERM_dumb - 40 +40 ls_main 579 598 +19 .rodata 103246 103251 +5 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 64/0) Total: 64 bytes Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tail: do not lose the tail of old file if new file (-F) is detectedGravatar Denys Vlasenko13 days1-12/+26
| | | | | | | | | | function old new delta tail_main 1619 1645 +26 .rodata 103246 103250 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 30/0) Total: 30 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tail: fix typo in variable nameGravatar Denys Vlasenko14 days1-6/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* head,tail: trim --help textGravatar Denys Vlasenko14 days2-14/+16
| | | | | | | function old new delta packed_usage 33598 33560 -38 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* echo: fix !ENABLE_FEATURE_FANCY_ECHO buildGravatar Denys Vlasenko2021-04-141-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: --help text tweaksGravatar Denys Vlasenko2021-04-1413-17/+17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: shorten --help textGravatar Denys Vlasenko2021-04-141-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: code shrinkGravatar Denys Vlasenko2021-04-141-6/+4
| | | | | | | function old new delta touch_main 424 421 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: fix -amGravatar Denys Vlasenko2021-04-141-5/+8
| | | | | | | function old new delta touch_main 414 424 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dd: support iflag=count_bytesGravatar Rafał Miłecki2021-04-131-18/+32
| | | | | | | | | | | | | | It allows passing amount of bytes in the count= function old new delta packed_usage 33599 33617 +18 static.iflag_words 29 41 +12 dd_main 1601 1607 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 36/0) Total: 36 bytes Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: fix previous commitGravatar Denys Vlasenko2021-04-131-1/+1
| | | | | | | function old new delta touch_main 423 414 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: make FEATURE_TOUCH_NODEREF unconditionalGravatar Denys Vlasenko2021-04-131-18/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: code shrinkGravatar Denys Vlasenko2021-04-131-4/+4
| | | | | | | function old new delta touch_main 450 423 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: code shrinkGravatar Denys Vlasenko2021-04-131-23/+17
| | | | | | | | | | function old new delta .rodata 103215 103218 +3 touch_main 460 450 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 3/-10) Total: -7 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: prevent usage of -r and -t at onceGravatar Xabier Oneca2021-04-131-7/+11
| | | | | | | coreutils forbids this combination. Signed-off-by: Xabier Oneca <xoneca@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: switch to using utimensat() and futimens()Gravatar Denys Vlasenko2021-04-131-41/+16
| | | | | | | | | | | | | | | | | | | | | | This patch changes the functions used to update timestamps in touch. Before, utimes() and lutimes() were used, which had certain disadvantages. They are unable to handle nanosecond timestamps, and implementations of certain features like -a and -m require running stat() in a loop. Almost all implementations of utimes() and lutimes() are wrappers for utimensat(), this is the case for glibc, ulibc and musl libc. function old new delta __futimens_time64 - 24 +24 __lutimes_time64 80 - -80 touch_main 539 456 -83 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 0/1 up/down: 24/-163) Total: -139 bytes Signed-off-by: urmum-69 <urmum69@snopyta.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: unbreak -hGravatar Denys Vlasenko2021-04-121-9/+10
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: remove unneeded GETOPT32 definesGravatar Xabier Oneca2021-04-121-18/+13
| | | | | | | | | | | | | | Long options handling (getopt32 vs getopt32long) is done in libbb.h, no need to care here of the same logic. This cleans the code a bit. Also, --no-create was grouped as a SUSv3 option, where as the short -c was not. Even if it is part of SUS, leave it out as was the short option. v2: Fix for disabled ENABLE_LONG_OPTS. getopt32long does not like IF_FEATURE_xxx() style conditionals... :/ Signed-off-by: Xabier Oneca <xoneca@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: fix atime set from reference fileGravatar Xabier Oneca2021-04-121-1/+2
| | | | | | | | When using a file's times as reference, use both atime and mtime for the files to be modified. Signed-off-by: Xabier Oneca <xoneca@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* touch: add SUSv3 options -a and -mGravatar Xabier 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 ↵Gravatar Denys Vlasenko2021-03-233-4/+2
| | | | | | separators Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* echo: do not assume that free() leaves errno unmodifiedGravatar Natanael 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>
* libbb: introduce and use fputs_stdoutGravatar Ron 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 contentGravatar Ron 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>
* Fix mknod compilation on the FreeBSDGravatar Alex 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 commentGravatar Denys Vlasenko2020-12-231-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: detect squaresGravatar Denys 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 undefGravatar Denys Vlasenko2020-12-211-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* factor: code shrinkGravatar Denys 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)Gravatar 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 tweaksGravatar Denys 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/oGravatar Denys 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)Gravatar 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 tweaksGravatar Denys 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-nillyGravatar Denys 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()Gravatar 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 allowsGravatar Denys 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 wellGravatar Denys Vlasenko2020-11-281-26/+19
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* date: remove non-standard special-casing of date '+%f'Gravatar 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)Gravatar Denys Vlasenko2020-11-281-19/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* date: support -Ins, more compatible timezone display in -IGravatar Denys 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 ↵Gravatar 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>