aboutsummaryrefslogtreecommitdiff
path: root/coreutils (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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
|\
| * unexpand: correct behavior for --first-only --tabs=4Mark Edgar2020-06-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Prior to the patch, both -f and --first-only are in all cases either no-op or ignored. Without --tabs, --first-only is the default so specifying it is a no-op. With --tabs, --all is implied, and --first-only is intended to reset this. function old new delta expand_main 690 694 +4 Signed-off-by: Mark Edgar <medgar123@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ls: treat hidden files as if their names begin with a dotRon Yorston2020-07-091-0/+12
| | | | | | | | | | | | | | On Unix 'ls' treats filenames starting with a dot as hidden and only displays them if the '-a' or '-A' option is given. Extend similar treatment to files with the Windows hidden flag.
* | printf: emit more contiguous text to improve escape sequencesRon Yorston2020-06-041-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users have a reasonable expectation that printf should be able to construct ANSI escape sequences and have them take effect. This expectation isn't met because printf tends to output one character at a time whereas busybox-w32 needs escape sequences to be output contiguously Force printf to output contiguous text in two cases: - literal text in the format string - string arguments output using the '%b' format specifier (See GitHub issue #189.)
* | dd: fix handling of 'conv=notrunc seek=N'Ron Yorston2020-05-201-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e6680912a (dd: create a sparse file when seek=N is used) broke the use of 'conv=notrunc seek=N' to modify existing files. Rename seek_sparse() to make_sparse() and: - add an argument to specify the start of the sparse region; - call make_sparse() before ftruncate(); - call make_sparse() only if: * we can determine the size of the file; * the file is not open in append mode; * the file is being extended. This should fix GitHub issue #186.
* | timeout: fix utter brokennessRon Yorston2020-03-291-0/+1
| | | | | | | | | | The merge from upstream (commit d89ced75b, 2018-09-10) completely broke timeout. Apply a belated fix.
* | dd: create a sparse file when seek=N is usedRon Yorston2020-03-241-0/+3
| | | | | | | | | | | | | | When the seek=N argument is used mark the file as sparse and set the range that is sparse. See https://stackoverflow.com/questions/4011508/how-to-create-a-sparse-file-on-ntfs
* | date: code shrinkRon Yorston2020-02-111-0/+27
| | | | | | | | | | | | | | Since we don't have a working clock_settime(2) there's no point in claiming to support the '-s' option. Saves 96 bytes
* | Merge branch 'busybox' into mergeRon Yorston2020-01-085-17/+51
|\|
| * Remove stime() function callsAlistair Francis2019-11-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | stime() has been deprecated in glibc 2.31 and replaced with clock_settime(). Let's replace the stime() function calls with clock_settime() in preperation. function old new delta rdate_main 197 224 +27 clock_settime - 27 +27 date_main 926 941 +15 stime 37 - -37 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 2/0 up/down: 69/-37) Total: 32 bytes Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * chgrp: correct the usage for non-desktop chgrp callsLiu, Shuang (ADITG/ESM)2019-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When IF_DESKTOP is not defined, chown and chgrp only takes option -R -h, However the usage output of chgrp is wrong: $ ./busybox.nosuid chown Usage: chown [-Rh]... USER[:[GRP]] FILE... $ ./busybox.nosuid chgrp Usage: chgrp [-RhLHP]... GROUP FILE... $ ./busybox.nosuid chgrp -H group dummy chgrp: invalid option -- 'H' Usage: chgrp [-RhLHP]... GROUP FILE... The chgrp is now a wrapper of chown, so the recognized options shall be the same. This is introduced by 34425389e09353a8dacdd6b23a62553f699c544c I would expect the correct behavior shall be the same as chown. So suggest the below patch, the behavior shall be: $ ./busybox.nosuid chgrp Usage: chgrp [-Rh]... GROUP FILE... Signed-off-by: Shuang Liu <sliu@de.adit-jv.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * clang/llvm 9 fix - do not eliminate a store to a fake "const"Denys Vlasenko2019-10-251-1/+1
| | | | | | | | | | | | | | This is *much* better (9 kbytes better) than dropping "*const" optimization trick. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Remove syscall wrappers around clock_gettime, closes 12091Denys Vlasenko2019-10-241-13/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 12091 "Direct use of __NR_clock_gettime is not time64-safe". function old new delta runsv_main 1698 1712 +14 startservice 378 383 +5 get_mono 31 25 -6 date_main 932 926 -6 gettimeofday_ns 17 - -17 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/2 up/down: 19/-29) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * date: Use 64 prefix syscall if we have toAlistair Francis2019-10-081-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some 32-bit architectures no longer have the 32-bit time_t syscalls. Instead they have suffixed syscalls that returns a 64-bit time_t. If the architecture doesn't have the non-suffixed syscall and is using a 64-bit time_t let's use the suffixed syscall instead. This fixes build issues when building for RISC-V 32-bit with 5.1+ kernel headers. If an architecture only supports the suffixed syscalls, but is still using a 32-bit time_t fall back to the libc call. Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ln: --no-target-directory implies --no-dereferenceKaarle Ritvanen2019-10-081-4/+21
| | | | | | | | | | | | | | as in GNU coreutils Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tee: do not intercept SIGPIPEDenys Vlasenko2019-10-071-4/+20
| | | | | | | | | | | | | | | | | | GNU tee does this only with -p, which we don't have yet. function old new delta tee_main 306 295 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-08-1626-101/+127
|\|
| * stat: print nanosecond times, fix printing of empty linesDenys Vlasenko2019-08-031-39/+36
| | | | | | | | | | | | | | function old new delta human_time 36 73 +37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne2019-07-0225-54/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * expand: add commented-out code to handle NULsDenys Vlasenko2019-06-091-8/+35
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * expand,unexpand: drop broken test, add FIXME commentDenys Vlasenko2019-06-081-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-05-273-15/+15
|\|
| * ls: fix SEGV when --color is used and ENABLE_LS_COLOR=nDenys Vlasenko2019-05-261-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dd: fix handling of short result of full_write(), closes 11711Denys Vlasenko2019-05-141-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | $ dd bs=1G <sda1 of=/dev/sda1 dd: error writing '/dev/sda1': No space left on device 1+0 records in 0+0 records out 999292928 bytes (953.0MB) copied, 0.784617 seconds, 1.2GB/s function old new delta write_and_stats 99 102 +3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ln: correct 'ln -T' usage messageJohn L. Hammond2019-05-091-1/+1
| | | | | | | | | | Signed-off-by: John L. Hammond <jhammond@indeed.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-04-171-47/+49
|\|
| * stat: reduce storage for human-readable filesystem namesRon Yorston2019-04-121-44/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta static.humanname - 236 +236 static.fstype - 140 +140 print_statfs 339 341 +2 static.humantypes 288 - -288 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 1/0 up/down: 378/-288) Total: 90 bytes text data bss dec hex filename 982183 485 7296 989964 f1b0c busybox_old 982152 485 7296 989933 f1aed busybox_unstripped Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-04-042-92/+70
|\|
| * fsync,sync: merge into one source moduleDenys Vlasenko2019-04-022-81/+61
| | | | | | | | | | | | | | | | | | | | | | With FEATURE_SYNC_FANCY not set: function old new delta fsync_main 130 123 -7 With FEATURE_SYNC_FANCY set, should be much larger code size savings. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * fsync,sync: make them similarDenys Vlasenko2019-04-022-27/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sync: add O_NOCTTY fsync: drop O_NOATIME, add O_NONBLOCK, set exitcode to 1 if fsync() fails, update --help message to be similar to sync. both: reformat code to minimize "diff -u sync.c fsync.c": in particular, they use same open() flags now function old new delta fsync_main 126 130 +4 packed_usage 33316 33317 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 5/0) Total: 5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: improve filesystem detection and displayRon Yorston2019-03-201-0/+3
| | | | | | | | | | | | | | | | | | | | Miscellaneous improvements: - Enable '-a' option to display all filesystems in df(1). - Detect the UDF CDROM filesystem and display it in 'stat -f'. - Let getmntent(3) handle CDROM and floppy devices, ignoring those that have no media. - Set number of inodes and filesystem flags to 0 in statfs(2).
* | Merge branch 'busybox' into mergeRon Yorston2019-03-123-20/+18
|\|
| * top: tweak --helpDenys Vlasenko2019-02-271-12/+6
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * du: don't count duplicate arguments. Closes 5288Ron Yorston2019-02-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since coreutils 8.6 (2010-10-15) du no longer counts duplicate arguments. Revert the relevant part of commit 618a3027ed (du: fix "du /dir /dir" case). function old new delta du_main 302 297 -5 reset_ino_dev_hashtable 78 - -78 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-83) Total: -83 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dd: add 'oflag=append'Rostislav Skudnov2019-02-141-6/+10
| | | | | | | | | | Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: implement readlink(2)Ron Yorston2019-03-062-3/+3
| | | | | | | | | | | | | | | | | | | | Provide an implementation of readlink(2) based on code from Git for Windows. This version only supports symbolic links, not mount points, as the latter seem to work well enough as-is. With this change the ls and stat applets can display the targets of symbolic links. The readlink applet has been enabled in the default configuration.
* | ls: use correct column width for WIN32 inodesRon Yorston2019-03-041-0/+4
| |
* | win32: fix POSIX buildRon Yorston2019-02-171-1/+1
| | | | | | | | | | | | There were a few places where changes intended for the WIN32 build also affected the POSIX build. Fix these so the result of 'make defconfig; make' for busybox-w32 is identical to upstream BusyBox.
* | win32: make stat(2) fetch additional metadataRon Yorston2019-02-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify the WIN32 implementation of stat(2) to fetch inode number, device id and number of hardlinks. This requires opening a handle to the target file so it will be slower. A number of features can be enabled or start to work: - tar can detect if an archive is being stored in itself; - find can support the -inum and -links options; - ls can display inode numbers; - diff can detect attempts to compare a file with itself; - du has better support for hardlinked files; - cp can detect attempts to copy a file over itself.
* | Merge branch 'busybox' into mergeRon Yorston2019-01-1072-90/+93
|\|
| * date: improve help text for -DDenys Vlasenko2019-01-091-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * sleep: support "inf"Denys Vlasenko2019-01-071-0/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ls: make -i compatible with coreutils: don't follow symlink by defaultMartijn Dekker2019-01-041-2/+2
| | | | | | | | | | Signed-off-by: Martijn Dekker <martijn@inlv.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * config: more tweaksDenys Vlasenko2018-12-282-6/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * config: update size informationDenys Vlasenko2018-12-2869-80/+80
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: emulate SIGPIPERon Yorston2018-12-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code to check whether a write error is due to a broken pipe can now either: - return with error EPIPE; - cause the process to exit with code 128+SIGPIPE. The default is the latter but the behaviour can be changed by issuing signal(SIGPIPE, SIG_IGN) and signal(SIGPIPE, SIG_DFL) calls. No actual signal is involved so kill can't send SIGPIPE and handlers other than SIG_IGN and SIG_DFL aren't supported. This does, however, avoid unsightly 'broken pipe' errors from commands like the example in GitHub issue #99: dd if=/dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;
* | Merge branch 'busybox' into mergeRon Yorston2018-12-052-4/+9
|\|