aboutsummaryrefslogtreecommitdiff
path: root/findutils (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'busybox' into mergeRon Yorston2021-01-141-2/+2
|\
| * nsenter: stop option parsing on 1st non-optionDenys Vlasenko2020-12-121-1/+1
| | | | | | | | | | | | "nsenter ls -l" gives: invalid option -- 'l' 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-301-1/+1
| | | | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2020-11-123-26/+36
|\|
| * libbb: shrink recursive_action() by reducing memory pressureDenys Vlasenko2020-10-012-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * tydy up a few uses of recursive_action(), no logic changesDenys Vlasenko2020-10-011-6/+7
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * xargs: fix -I SUBSTR behaviourDenys Vlasenko2020-09-301-5/+16
| | | | | | | | | | | | | | function old new delta process_stdin_with_replace 165 204 +39 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2020-08-231-15/+14
|\|
| * grep: for -L, exitcode 0 means files *without* matches were found, closes 13151Denys Vlasenko2020-08-151-15/+14
| | | | | | | | | | | | | | | | | | This is a recent change in GNU grep as well (after 3.1) function old new delta grep_file 1215 1228 +13 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeFRP-3466-g53c09d0e1Ron Yorston2020-05-291-8/+16
|\|
| * grep: add proper support for pattern_listSören Tempel2020-04-301-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From POSIX.1-2008: The pattern_list's value shall consist of one or more patterns separated by <newline> characters; As such, given patterns need to be split at newline characters. Without doing so, busybox grep will interpret the newline as part of the pattern which is not in accordance with POSIX. See also: https://bugs.busybox.net/show_bug.cgi?id=12721 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * grep: Fix -f FILE when FILE is empty and -x providedGray Wolf2020-04-291-2/+3
| | | | | | | | | | | | | | | | | | | | Grep currently special-cased empty pattern file to be the same as pattern file with one empty line (empty pattern). That does mirror how GNU grep behaves, except when -x is provided. In that case .* pattern needs to be used instead. Signed-off-by: Gray Wolf <wolf@wolfsden.cz> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * xargs: restore correct behaviour of -n optionRon Yorston2020-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 1ff7002b1 (xargs: fix handling of quoted arguments, closes 11441) the -n option hasn't worked properly: $ echo 1 2 3 | xargs -n 1 echo 1 2 3 $ Because state is now remembered between calls to process_stdin() it's necessary to update the state before any premature return. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | xargs: restore correct behaviour of -n optionRon Yorston2020-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 1ff7002b1 (xargs: fix handling of quoted arguments, closes 11441) the -n option hasn't worked properly: $ echo 1 2 3 | xargs -n 1 echo 1 2 3 $ Because state is now remembered between calls to process_stdin() it's necessary to update the state before any premature return.
* | Merge branch 'busybox' into mergeRon Yorston2020-02-151-9/+18
|\|
| * xargs: fix handling of quoted arguments, closes 11441Ron Yorston2020-01-291-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported in bug 11441 when presented with a large number of quoted arguments xargs can return 'argument line too long': seq 10000 29999 | sed -e 's/^/"/' -e 's/$/"/' | busybox xargs echo This happens because the variant of process_stdin() which handles quoted arguments doesn't preserve state between calls. If the allowed number of characters is exceeded part way through a quoted argument the next call to process_stdin() incorrectly treats the terminating quote as a starting quote, thus quoting all of the argument separators. function old new delta process_stdin 274 303 +29 xargs_main 731 745 +14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 43/0) Total: 43 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2020-01-082-3/+51
|\|
| * grep: add -RTomi Leppanen2019-11-271-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds -R option to grep similar to GNU grep. It is the same as -r but also dereferences symbolic links to directories. function old new delta grep_main 834 850 +16 packed_usage 33362 33368 +6 grep_file 1440 1441 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 23/0) Total: 23 bytes Signed-off-by: Tomi Leppanen <tomi.leppanen@jolla.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * find: implement -emptyAaro Koskinen2019-09-121-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta func_empty - 121 +121 packed_usage 33154 33167 +13 parse_params 1490 1500 +10 static.params 228 235 +7 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/0 up/down: 151/0) Total: 151 bytes Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-08-162-4/+4
|\|
| * libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne2019-07-022-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2019-03-121-7/+7
|\|
| * xargs: mention -E STR in --helpDenys Vlasenko2019-03-101-7/+7
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | find: enable -xdev in default configurationRon Yorston2019-02-281-1/+1
| |
* | win32: make stat(2) fetch additional metadataRon Yorston2019-02-161-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-02-121-6/+15
|\|
| * grep: short-circuit -v to bail out on first matchAri Sundholm2019-01-291-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | A small optimization. There is no need to try matching the current input line against any further patterns if a match was already found and -v is specified. function old new delta grep_file 1463 1440 -23 Signed-off-by: Ari Sundholm <ari@tuxera.com> Signed-off-by: Niko Vähäsarja <niko@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * grep: fix -x -v with certain pattern ordersAri Sundholm2019-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We found out that busybox -x -v is a bit broken: ari@ari-thinkpad:~/busybox$ echo ' aa bb cc' | ./busybox grep -x -e 'aa.*' -e '.*bb.*' aa bb cc ari@ari-thinkpad:~/busybox$ echo ' aa bb cc' | ./busybox grep -x -v -e 'aa.*' -e '.*bb.*' ari@ari-thinkpad:~/busybox$ echo ' aa bb cc' | ./busybox grep -x -e '.*aa.*' -e 'bb.*' aa bb cc ari@ari-thinkpad:~/busybox$ echo ' aa bb cc' | ./busybox grep -x -v -e '.*aa.*' -e 'bb.*' aa bb cc Last one is wrong. This patch fixes the issue by making sure that the variable 'found' never makes a transition from 1 to 0, as this would mean that grep previously found a match on this input line. Signed-off-by: Ari Sundholm <ari@tuxera.com> Signed-off-by: Niko Vähäsarja <niko@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-01-103-4/+10
|\|
| * find: handle leading -- argumentDenys Vlasenko2019-01-061-0/+6
| | | | | | | | | | | | | | function old new delta find_main 464 478 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * config: update size informationDenys Vlasenko2018-12-282-4/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | xargs: fix 'xargs -sNUM' testsRon Yorston2019-01-061-0/+4
| | | | | | | | | | The tests for 'xargs -sNUM' fail due to a missing newline unless it's output using fprintf rather than bb_putchar_stderr.
* | Merge branch 'busybox' into mergeRon Yorston2018-11-281-3/+4
|\|
| * xargs: fix exit code if command exits nonzero, closes 11381Denys Vlasenko2018-10-301-3/+4
| | | | | | | | | | | | No code size change on x86. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox'Ron Yorston2018-07-254-9/+62
|\|
| * grep: accept and ignore --color[=anything]Denys Vlasenko2018-07-131-3/+8
| | | | | | | | | | | | | | function old new delta grep_main 827 834 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * find: implement -executableDenys Vlasenko2018-07-061-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta func_executable - 19 +19 parse_params 1505 1519 +14 static.params 216 228 +12 packed_usage 32847 32855 +8 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/0 up/down: 53/0) Total: 53 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tweak help textsDenys Vlasenko2018-07-061-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * find: implement -quitDenys Vlasenko2018-07-061-4/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta packed_usage 32816 32846 +30 find_main 446 464 +18 func_quit - 13 +13 parse_params 1495 1505 +10 static.params 210 216 +6 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/0 up/down: 77/0) Total: 77 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * restore documentation on the build config languageKartik Agaram2018-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | Kconfig-language.txt was deleted in commit 4fa499a17b52b back in 2006. Move to docs/ as suggested by Xabier Oneca: http://lists.busybox.net/pipermail/busybox/2014-May/080914.html Also update references to it everywhere. Signed-off-by: Kartik Agaram <akkartik@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-05-131-1/+1
|\|
| * free: improve --help for type optionDenys Vlasenko2018-04-241-1/+1
| | | | | | | | | | | | Patch by Fred Friedrich. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-04-091-10/+11
|\|
| * xargs: use bb_ask_y_confirmation_FILE() instead of homegrown copyDenys Vlasenko2018-04-071-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta bb_ask_y_confirmation_FILE - 83 +83 inetd_main 2033 2043 +10 udhcp_send_kernel_packet 295 301 +6 rmescapes 306 310 +4 send_tree 353 355 +2 i2cdetect_main 674 672 -2 confirm_or_abort 43 38 -5 get_terminal_width_height 242 234 -8 bb_ask_y_confirmation 76 10 -66 xargs_main 823 755 -68 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/5 up/down: 105/-149) Total: -44 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-04-021-1/+1
|\|
| * grep: fix echo "aa" | busybox grep -F -w "a" (should not match)Denys Vlasenko2018-03-291-1/+1
| | | | | | | | | | | | | | function old new delta grep_file 1461 1470 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-11-031-2/+19
|\|
| * grep: skip grepping symlinks to directoriesJames Clarke2017-10-311-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When grep is passed -r, recursive_action will treat any symlinks to directories not in the root as normal files, since it lstat's them and is therefore told they are not directories. However, file_action_grep will still try to fopen and read from them to see whether they match, which varies in behaviour across platforms. Linux will give EISDIR and thus grep will not find any matching lines, but FreeBSD will give the raw contents of the directory itself, which may match the given pattern. Also, if grep is passed -c, it will even print a count for these symlinks, even on Linux. Since this recursive_action behaviour is required for the correct functioning of other applets, such as tar, grep should handle this special case and skip any such symlinks. function old new delta file_action_grep 80 161 +81 Signed-off-by: James Clarke <jrtc27@jrtc27.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | mingw: special-case xargs -P on WindowsJohannes Schindelin2017-10-011-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patches to let xargs support parallel operations on Linux/Unix was contributed and accepted in upstream BusyBox. To benefit from this on Windows, we have to work quite a bit harder, was it is pretty hard to emulate the waitpid() semantics on Windows when pid is -1, i.e. when waiting for any child to exit. The problem is not so much accumulating the process handles of children we spawned (we could do that in our own spawn() implementation), but the fact that waitpid() returns exactly one pid even when multiple children have exited, retaining the rest of them for subsequent waitpid() calls. And on Linux/Unix, those pids are reserved even if the processes have exited, at least for a while, but not on Windows. And then there is the problem that BusyBox may have spawned *other* processes, too, not just the ones we care about in xargs -P. A much more elegant way is to add Windows-specific code to xargs.c that specifically handles the child processes spawned by xargs. So let's do this. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Ron Yorston <rmy@pobox.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-09-273-36/+144
|\|