aboutsummaryrefslogtreecommitdiff
path: root/coreutils
AgeCommit message (Collapse)Author
2016-01-17dos2unix: try to preserve ownership. closes 8311Denys Vlasenko
function old new delta dos2unix_main 426 441 +15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-01-13truncate: use O_WRONLY|O_NONBLOCKMike Frysinger
This matches coreutils behavior. We don't read the fd, and truncation does not need blocking. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-01-13truncate: always set mode when opening file to avoid fortify errorsAri Sundholm
Busybox crashes due to no mode being given when opening: $ ./busybox truncate -s 1M foo *** invalid open64 call: O_CREAT without mode ***: ./busybox terminated ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x7338f)[0x7f66d921338f] /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f66d92aac9c] /lib/x86_64-linux-gnu/libc.so.6(+0xeb6aa)[0x7f66d928b6aa] ./busybox[0x4899f9] ======= Memory map: ======== 00400000-004d0000 r-xp 00000000 00:1a 137559 /home/ari/busybox/busybox 006cf000-006d0000 r--p 000cf000 00:1a 137559 /home/ari/busybox/busybox 006d0000-006d1000 rw-p 000d0000 00:1a 137559 /home/ari/busybox/busybox 006d1000-006d4000 rw-p 00000000 00:00 0 014e7000-01508000 rw-p 00000000 00:00 0 [heap] 7f66d8f8a000-7f66d8fa0000 r-xp 00000000 08:07 1579008 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f66d8fa0000-7f66d919f000 ---p 00016000 08:07 1579008 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f66d919f000-7f66d91a0000 rw-p 00015000 08:07 1579008 /lib/x86_64-linux-gnu/libgcc_s.so.1 7f66d91a0000-7f66d935b000 r-xp 00000000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so 7f66d935b000-7f66d955a000 ---p 001bb000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so 7f66d955a000-7f66d955e000 r--p 001ba000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so 7f66d955e000-7f66d9560000 rw-p 001be000 08:07 1578994 /lib/x86_64-linux-gnu/libc-2.19.so 7f66d9560000-7f66d9565000 rw-p 00000000 00:00 0 7f66d9565000-7f66d966a000 r-xp 00000000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so 7f66d966a000-7f66d9869000 ---p 00105000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so 7f66d9869000-7f66d986a000 r--p 00104000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so 7f66d986a000-7f66d986b000 rw-p 00105000 08:07 1579020 /lib/x86_64-linux-gnu/libm-2.19.so 7f66d986b000-7f66d988e000 r-xp 00000000 08:07 1578981 /lib/x86_64-linux-gnu/ld-2.19.so 7f66d9a64000-7f66d9a67000 rw-p 00000000 00:00 0 7f66d9a8a000-7f66d9a8d000 rw-p 00000000 00:00 0 7f66d9a8d000-7f66d9a8e000 r--p 00022000 08:07 1578981 /lib/x86_64-linux-gnu/ld-2.19.so 7f66d9a8e000-7f66d9a8f000 rw-p 00023000 08:07 1578981 /lib/x86_64-linux-gnu/ld-2.19.so 7f66d9a8f000-7f66d9a90000 rw-p 00000000 00:00 0 7ffc47761000-7ffc47782000 rw-p 00000000 00:00 0 [stack] 7ffc477ab000-7ffc477ad000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] Aborted (core dumped) $ Fix this by simply always setting the mode, as it doesn't hurt even when O_CREAT is not specified. This bug is a regression introduced in fc3e40e, as xopen(), which was originally used, would automatically set the mode. Signed-off-by: Ari Sundholm <ari@tuxera.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-10-30stat: make -f optional. This allows to build stat for non-linux systemsDenys Vlasenko
function old new delta packed_usage 30761 30706 -55 Based on the patch by Ron Yorston. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-26tr: support octal rangesRichard Genoud
now, we can do printf "a\tb\tcdef\n" | ./busybox tr -d "\1-\14b-e" af and bonus, we save some bytes. function old new delta expand 718 699 -19 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-19) Total: -19 bytes Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-23libbb: factor out code which queries screen widthDenys Vlasenko
function old new delta get_terminal_width - 17 +17 stty_main 1196 1197 +1 pstree_main 321 319 -2 ls_main 735 731 -4 watch_main 232 225 -7 bb_progress_update 714 706 -8 ps_main 555 543 -12 run_applet_and_exit 708 695 -13 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/6 up/down: 18/-46) Total: -28 byte Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19sort: fix ENDCHAR handling in "-kSTART,N.ENDCHAR"Denys Vlasenko
function old new delta get_key 505 503 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19sort: code shrinkDenys Vlasenko
function old new delta compare_keys 738 695 -43 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19remove extra debug printoutDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19sort: fix key with delimiters breakageDenys Vlasenko
function old new delta get_key 509 505 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19libbb: make parse_chown_usergroup_or_die() set unspecified uid/gid to -1Denys Vlasenko
function old new delta parse_chown_usergroup_or_die 102 115 +13 chown_main 190 175 -15 start_stop_daemon_main 1043 1027 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 13/-31) Total: -18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19od: get rid of (almost all) staticsDenys Vlasenko
function old new delta od_main 2565 2600 +35 check_and_close 113 115 +2 static.prev_pair_equal 1 - -1 static.first 1 - -1 exit_code 1 - -1 string_min 4 - -4 n_specs 4 - -4 in_stream 4 - -4 format_address 4 - -4 file_list 4 - -4 bytes_per_block 4 - -4 get_lcm 120 115 -5 pseudo_offset 8 - -8 ------------------------------------------------------------------------------ (add/remove: 0/10 grow/shrink: 2/1 up/down: 37/-40) Total: -3 bytes text data bss dec hex filename 938487 932 17392 956811 e998b busybox_old 938519 924 17360 956803 e9983 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-16cpio: implement -R/--ownerAaro Koskinen
Implement -R/--owner to force ownership of files. function old new delta cpio_main 532 586 +54 get_header_cpio 909 939 +30 print 36 65 +29 cpio_o 804 832 +28 cpio_TRAILER - 11 +11 packed_usage 30667 30662 -5 static.trailer 11 - -11 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 4/1 up/down: 152/-16) Total: 136 bytes Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-15du: extra compat: with -k and -m, round sizes upDenys Vlasenko
function old new delta print 36 65 +29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-14libiproute: rename invarg(a,b) to invarg_1_to_2(a,b)Denys Vlasenko
invarg(a,b) - "invalid argument", but how a and b enter the message? invarg_1_to_2(a,b) is somewhat easier to read: "invalid argument 'a' to 'b'" Audit of usage revealed a number of bad uses, with too long messages. text data bss dec hex filename 938848 932 17448 957228 e9b2c busybox_old 938788 932 17448 957168 e9af0 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07build system: -fno-builtin-printfDenys Vlasenko
Benefits are: drops reference to out-of-line putchar(), fixes a few cases of failed string merge. function old new delta i2cdump_main 1488 1502 +14 sha256_process_block64 423 433 +10 sendmail_main 1183 1185 +2 list_table 1114 1116 +2 i2cdetect_main 1235 1237 +2 fdisk_main 2852 2854 +2 builtin_type 119 121 +2 unicode_conv_to_printable2 325 324 -1 scan_recursive 380 378 -2 mkfs_minix_main 2687 2684 -3 buffer_fill_and_print 178 169 -9 putchar 152 - -152 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 7/4 up/down: 34/-167) Total: -133 bytes text data bss dec hex filename 937788 932 17676 956396 e97ec busybox_old 937564 932 17676 956172 e970c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07libbb: more compact API for bb_parse_mode()Denys Vlasenko
function old new delta make_device 2182 2188 +6 parse_command 1440 1443 +3 parse_params 1497 1499 +2 install_main 773 769 -4 mkdir_main 168 160 -8 getoptscmd 641 632 -9 builtin_umask 158 147 -11 bb_parse_mode 431 410 -21 umaskcmd 286 258 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/6 up/down: 11/-81) Total: -70 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-05uudecode: tolerate text input with CR+LF line endsDenys Vlasenko
function old new delta read_stduu 265 308 +43 uudecode_main 313 317 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-09-19sort: fix -kN,M handling (was including last separator into the comparison)Denys Vlasenko
Testcase: $ printf '%s\n' a/a:a a:b | sort -t: -k1,1 a:b a/a:a Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-03uname: make OS name configurableRon Yorston
A mailing list thread in September 2013 discussed changing the string returned by the non-POSIX 'uname -o' option. Nothing ever came of this because there was no agreement as to what the string should be. Make the string configurable so that people can decide for themselves. Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31echo: make escape sequences depend on fancy modeMike Frysinger
Currently when you disable fancy echo, escape sequences are hardcoded enabled (e.g. as if you used `echo -e` all the time). The opposite behavior is more desirable (always disable -e support) because: * This seems to contradict the spirit of the kconfig help text (where it says enable support for -n/-e flags), although you could say that we aren't supporting the -e flag directly as `echo -e` will show the -e flag. * POSIX makes escape sequences optional, and even says they are there only on XSI-conformant systems. * It saves space (~100 bytes on x86_64). * It makes things faster! * It makes it behave more like bash where you need an explicit -e flag in order for escape sequences to be interpreted. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-21sync: add support for -d -f FILEDenys Vlasenko
Based on the patch by Ari Sundholm <ari@tuxera.com> function old new delta sync_main 20 163 +143 packed_usage 30653 30673 +20 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 163/0) Total: 163 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-13Removes stray empty line from codeManinder Singh
This patch removes stray empty line from busybox code reported by script find_stray_empty_lines Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-06-07fix whitespacesManinder Singh
reported by script :- scripts/fix_ws.sh Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-06-07chown: fix help textJunling Zheng
Signed-off-by: Junling Zheng <zhengjunling@huawei.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-25truncate: do not die when a file doesn't exist and no-create flag is onAri Sundholm
Additionally, open(2) failures do not make the program die immediately. This makes the behavior of the program match coreutils more closely. function old new delta truncate_main 161 221 +60 Signed-off-by: Ari Sundholm <ari@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-25typo fixesManinder Singh
Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-21special-case {true,false,test} --helpDenys Vlasenko
This also removes their help texts. function old new delta run_applet_no_and_exit 442 452 +10 packed_usage 30713 30625 -88 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-02*: Switch to POSIX utmpx APIBernhard Reutner-Fischer
UTMP is SVID legacy, UTMPX is mandated by POSIX. Glibc and uClibc have identical layout of UTMP and UTMPX, both of these libc treat _PATH_UTMPX as _PATH_UTMP so from a user-perspective nothing changes except the names of the API entrypoints. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-22truncate: new appletDenys Vlasenko
Add the actual new source file :( Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-22dd: move suffix struct to xatonum.cAri Sundholm
This way it can be used by other applets without duplication. Signed-off-by: Ari Sundholm <ari@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12od: fix printing of high-bit charsRon Yorston
Example: echo £ | od -c Signed-off-by: Ron Yorston <rmy@tigress.co.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12libbb: introduce and use is_prefixed_with()Denys Vlasenko
function old new delta is_prefixed_with - 18 +18 complete_username 78 77 -1 man_main 737 735 -2 fsck_device 429 427 -2 unpack_ar_archive 80 76 -4 strip_unsafe_prefix 105 101 -4 singlemount 1054 1050 -4 rtc_adjtime_is_utc 90 86 -4 resolve_mount_spec 88 84 -4 parse_one_line 1029 1025 -4 parse_conf 1460 1456 -4 may_wakeup 83 79 -4 loadkmap_main 219 215 -4 get_irqs_from_stat 103 99 -4 get_header_cpio 913 909 -4 findfs_main 79 75 -4 fbsplash_main 1230 1226 -4 load_crontab 776 771 -5 expand_vars_to_list 1151 1146 -5 date_main 881 876 -5 skip_dev_pfx 30 24 -6 make_device 2199 2193 -6 complete_cmd_dir_file 773 767 -6 run_applet_and_exit 715 708 -7 uudecode_main 321 313 -8 pwdx_main 197 189 -8 execute 568 560 -8 i2cdetect_main 1186 1176 -10 procps_scan 1242 1230 -12 procps_read_smaps 1017 1005 -12 process_module 746 734 -12 patch_main 1903 1891 -12 nfsmount 3572 3560 -12 stack_machine 126 112 -14 process_timer_stats 449 435 -14 match_fstype 111 97 -14 do_ipaddr 1344 1330 -14 open_list_and_close 359 343 -16 get_header_tar 1795 1779 -16 prepend_new_eth_table 340 323 -17 fsck_main 1811 1794 -17 find_iface_state 56 38 -18 dnsd_main 1321 1303 -18 base_device 179 158 -21 find_keyword 104 82 -22 handle_incoming_and_exit 2785 2762 -23 parse_and_put_prompt 774 746 -28 modinfo 347 317 -30 find_action 204 171 -33 update_passwd 1470 1436 -34 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/49 up/down: 18/-540) Total: -522 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-23ls: heed compiler warningDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-18ls: trivial code shrinkDenys Vlasenko
function old new delta display_single 914 893 -21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-16ls: fix year 9999 bug :)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-07dd: add optional support for status=noxfer/noneAri Sundholm
While at it, added 'B' number suffixes, upstream compat function old new delta dd_main 1469 1543 +74 dd_suffixes 88 112 +24 packed_usage 30156 30176 +20 dd_output_status 372 388 +16 static.status_words - 13 +13 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/0 up/down: 147/0) Total: 147 bytes Signed-off-by: Ari Sundholm <ari@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-24trim extra newlines in help textsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-24install: fix help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-24install: implement -t DIRAaro Koskinen
Some packages want to install themselves using "-t" to specify the directory (as supported by GNU coreutils). Add support for the option for compatibility reasons. function old new delta install_longopts 76 95 +19 install_main 769 777 +8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0) Total: 27 bytes Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-20df: fix -T option when ENABLE_FEATURE_HUMAN_READABLE=0Ari Sundholm
Signed-off-by: Ari Sundholm <ari@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-17df: implement -T optionAri Sundholm
function old new delta df_main 863 998 +135 packed_usage 29827 29861 +34 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 169/0) Total: 169 bytes Signed-off-by: Ari Sundholm <ari@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-01test: fix mishandling of "test '(' = '('" and similarDenys Vlasenko
function old new delta test_main 246 350 +104 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-27stat: fix printing selinux context and null-dereferenceMichael Gernoth
busybox stat tries to always print the selinux context, even if it is not requested which leads to a segmentation fault due to dereferencing a null-pointer. This also changes the format-string used to print the context to so it actually produces useful output. Signed-off-by: Michael Gernoth <michael@gernoth.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22unlink: new appletIsaac Dunham
function old new delta unlink_main - 45 +45 packed_usage 29667 29686 +19 Signed-off-by: Isaac Dunham <ibid.ag@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-19Add conditional support for -v / --verboseDenys Vlasenko
With FEATURE_VERBOSE off, practically no size change. With it on: function old new delta remove_file 493 556 +63 install_main 719 765 +46 bb_make_directory 383 419 +36 rmdir_main 162 191 +29 copy_file 1516 1544 +28 mv_main 502 525 +23 cmp_main 677 693 +16 bbconfig_config_bz2 5264 5279 +15 mkdir_main 158 168 +10 install_longopts 66 76 +10 rm_main 167 175 +8 nexpr 840 846 +6 scan_tree 275 280 +5 fsck_main 1807 1811 +4 ed_main 2541 2545 +4 expand_one_var 1574 1575 +1 swap_on_off_main 420 418 -2 parse_command 1443 1440 -3 redirect 1279 1274 -5 do_load 946 918 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 16/4 up/down: 304/-38) Total: 266 bytes Based on the patch by Igor Živković. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07shuf: trim help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07shuf: do not use strings for -i RANGE caseDenys Vlasenko
function old new delta shuf_main 482 496 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07shuf: improve help textBartosz Golaszewski
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07shuf: fix a segfault on 'shuf -e'Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>