summaryrefslogtreecommitdiff
path: root/testsuite
Commit message (Collapse)AuthorAgeFilesLines
* seq: fix yet another case of negative parameters not workingDenys Vlasenko2023-04-111-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* seq: accept negative parametersDenys Vlasenko2023-04-101-0/+3
| | | | | | | | | | function old new delta seq_main 429 476 +47 packed_usage 34557 34538 -19 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 47/-19) Total: 28 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* find: implement -okDavid Leonard2023-03-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html -ok utility_name [argument ...] ; The -ok primary shall be equivalent to -exec, except that the use of a <plus-sign> to punctuate the end of the primary expression need not be supported, and find shall request affirmation of the invocation of utility_name using the current file as an argument by writing to standard error as described in the STDERR section. If the response on standard input is affirmative, the utility shall be invoked. Otherwise, the command shall not be invoked and the value of the -ok operand shall be false. function old new delta do_exec 438 517 +79 parse_params 1833 1845 +12 static.params 288 292 +4 .rodata 100771 100775 +4 packed_usage 34543 34541 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 99/-2) Total: 97 bytes Signed-off-by: David Leonard <d+busybox@adaptive-enterprises.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* testsuite/sha1sum.tests: fix false positive failureDenys Vlasenko2023-01-021-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* testsuite/tree.tests: fix false positive failureDenys Vlasenko2023-01-021-18/+20
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* testsuite/mount.tests: accomodate umount failure seen on 5.18.0Denys Vlasenko2022-12-131-1/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* xxd: add two more testcasesDenys Vlasenko2022-08-221-2/+16
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* xxd -r: without -p, stop at more than one whitespace, closes 14786Denys Vlasenko2022-08-221-0/+9
| | | | | | | function old new delta xxd_main 888 1076 +188 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sort: fix sort -s -u, closes 14871Denys Vlasenko2022-07-291-0/+10
| | | | | | | function old new delta sort_main 851 856 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sort: fix -k2M (wasn't skipping leading whitespace)Denys Vlasenko2022-07-291-0/+11
| | | | | | | function old new delta compare_keys 848 862 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix use after free (CVE-2022-30065)Natanael Copa2022-07-111-0/+6
| | | | | | | | | | fixes https://bugs.busybox.net/show_bug.cgi?id=14781 function old new delta evaluate 3343 3357 +14 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* shaNNNsum: accept one-space "HASH FILENAME" format for -c, closes 14866Denys Vlasenko2022-07-111-0/+10
| | | | | | | function old new delta md5_sha1_sum_main 496 501 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tree: new appletRoger Knecht2022-06-301-0/+100
| | | | | | | | | | | | | | | | | | | | | | | | Adds the tree program to list directories and files in a tree structure. function old new delta tree_print - 343 +343 scandir64 - 330 +330 scandir - 330 +330 tree_main - 86 +86 .rodata 105150 105228 +78 packed_usage 34511 34557 +46 alphasort64 - 31 +31 alphasort - 31 +31 strcoll - 5 +5 applet_names 2801 2806 +5 applet_main 1616 1620 +4 applet_suid 101 102 +1 applet_install_loc 202 203 +1 ------------------------------------------------------------------------------ (add/remove: 11/0 grow/shrink: 6/0 up/down: 1291/0) Total: 1291 bytes Signed-off-by: Roger Knecht <rknecht@pm.me> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tsort: new appletDavid Leonard2022-05-021-0/+110
| | | | | | | | | | | | | | function old new delta tsort_main - 578 +578 .rodata 104884 104906 +22 applet_names 2759 2765 +6 applet_main 1596 1600 +4 packed_usage 34290 34288 -2 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 3/1 up/down: 610/-2) Total: 608 bytes Signed-off-by: David Leonard <d+busybox@adaptive-enterprises.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix handling of escaped delimiters in s/// replacementDenys Vlasenko2022-01-231-2/+7
| | | | | | | function old new delta parse_regex_delim 111 140 +29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: fix handling of escaped delimiters in s/// search pattern, closes 14541Denys Vlasenko2022-01-231-0/+10
| | | | | | | | | | | | function old new delta copy_parsing_escapes 67 96 +29 parse_regex_delim 109 111 +2 get_address 213 215 +2 add_cmd 1176 1178 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 35/0) Total: 35 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: input numbers are never octal or hex (only program consts can be)Denys Vlasenko2022-01-081-1/+11
| | | | | | | | | | | | function old new delta next_token 825 930 +105 getvar_i 114 129 +15 nextchar 49 53 +4 my_strtod 138 - -138 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 3/0 up/down: 124/-138) Total: -14 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sort: support -hDenys Vlasenko2022-01-051-0/+29
| | | | | | | | | | | | | | function old new delta static.scale_suffix - 62 +62 .rodata 104304 104336 +32 compare_keys 820 848 +28 packed_usage 34159 34184 +25 static.suffix - 9 +9 sort_opt_str 37 38 +1 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 4/0 up/down: 157/0) Total: 157 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sort: fix -s -r interaction: 'stable' order is not affected by -rDenys Vlasenko2022-01-041-0/+13
| | | | | | | function old new delta compare_keys 818 820 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: correctly handle 'w FILE' commands writing to the same fileDenys Vlasenko2022-01-041-0/+9
| | | | | | | function old new delta sed_xfopen_w - 84 +84 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* sed: do not ignore 'g' modifier when match starts with ^Dominique Martinet2021-12-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is perfectly valid to start a regex with ^ and have other patterns with \| that can match more than once, e.g. the following example should print ca, as illustrated with gnu sed: $ echo 'abca' | sed -e 's/^a\|b//g' ca busybox before patch: $ echo 'abca' | busybox sed -e 's/^a\|b//g' bca busybox after patch: $ echo 'abca' | ./busybox sed -e 's/^a\|b//g' ca regcomp handles ^ perfectly well as illustrated with the second 'a' that did not match in the example, we ca leave the non-repeating to it if appropriate. The check had been added before using regcomp and was required at the time (f36635cec6da) but no longer makes sense now. (tested with glibc and musl libc) function old new delta add_cmd 1189 1176 -13 Signed-off-by: Dominique Martinet <asmadeus@codewreck.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* printf: allow 0 as a flag and allow multiple flagsRon Yorston2021-12-171-0/+10
| | | | | | | | | | | | | | | | | | | | | | The '%' character in a format specification may be followed by one or more flags from the list "+- #0". BusyBox printf didn't support the '0' flag or allow multiple flags to be provided. As a result the formats '%0*d' and '%0 d' were considered to be invalid. The lack of support for '0' was pointed out by Andrew Snyder on the musl mailing list: https://www.openwall.com/lists/musl/2021/12/14/2 function old new delta printf_main 860 891 +31 .rodata 99281 99282 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: code shrink in des encryption, in setup_salt()Denys Vlasenko2021-11-281-0/+14
| | | | | | | | | | | function old new delta pw_encrypt 978 971 -7 .rodata 108208 108192 -16 des_crypt 1211 1181 -30 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-53) Total: -53 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: better coreutils compatibility for realpathRon Yorston2021-10-091-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | Add some tests which coreutils realpath pass but BusyBox realpath fails (bar one). Adjust xmalloc_realpath_coreutils() so the tests pass: - Expand symbolic links before testing whether the last path component exists. - When the link target is a relative path canonicalize it by passing it through xmalloc_realpath_coreutils() as already happens for absolute paths. - Ignore trailing slashes when finding the last path component and correctly handle the case where the only slash is at the start of the path. This requires ignoring superfluous leading slashes. - Undo all changes to the path so error messages from the caller show the original filename. function old new delta xmalloc_realpath_coreutils 214 313 +99 Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* xxd: fix -p -r, closes 13881Denys Vlasenko2021-10-081-0/+6
| | | | | | | function old new delta xxd_main 893 890 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* date,touch: allow timezone offsets in datesRon Yorston2021-09-171-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | Allow ISO 8601 style dates to include a timezone offset. Like the '@' format these dates aren't relative to the user's current timezone and shouldn't be subject to DST adjustment. - The implementation uses the strptime() '%z' format specifier. This an extension which may not be available so the use of timezones is a configuration option. - The 'touch' applet has been updated to respect whether DST adjustment is required, matching 'date'. function old new delta parse_datestr 624 730 +106 static.fmt_str 106 136 +30 touch_main 388 392 +4 date_main 818 819 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 141/0) Total: 141 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix printf %%Daniel Thau2021-09-052-0/+11
| | | | | | | | | | | | | | | | | A refactor of the awk printf code in e2e3802987266c98df0efdf40ad5da4b07df0113 appears to have broken the printf interpretation of two percent signs, which normally outputs only one percent sign. The patch below brings busybox awk printf behavior back into alignment with the pre-e2e380 behavior, the busybox printf util, and other common (awk and non-awk) printf implementations. function old new delta awk_printf 626 672 +46 Signed-off-by: Daniel Thau <danthau at bedrocklinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* rev: correct output for long input linesRon Yorston2021-08-221-0/+46
| | | | | | | | | | | | | | | | The input buffer is initialised to a reasonable size and extended if necessary. When this happened the offset into the buffer wasn't reset to zero so subsequent lines were appended to the long line. Fix this and add some tests. function old new delta rev_main 377 368 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-9) Total: -9 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix testsuiteDenys Vlasenko2021-08-161-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* tar: fix testsuiteDenys Vlasenko2021-08-161-7/+10
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dd: fix testsuiteDenys Vlasenko2021-08-151-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cut: fix testsuiteDenys Vlasenko2021-08-151-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cut: add toybox-compatible options -O OUTSEP, -D, -F LISTRob Landley2021-07-201-0/+64
| | | | | | | | | | | | function old new delta cut_main 884 1201 +317 packed_usage 33823 33885 +62 .rodata 104186 104179 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 379/-7) Total: 372 bytes Signed-off-by: Rob Landley <rob@landley.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: disallow break/continue outside of loopsDenys Vlasenko2021-07-141-7/+2
| | | | | | | | | | function old new delta .rodata 104139 104186 +47 chain_group 610 633 +23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 70/0) Total: 70 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix printf "%-10c", 0Denys Vlasenko2021-07-121-0/+8
| | | | | | | function old new delta awk_printf 596 626 +30 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: unbreak "cmd" | getlineDenys Vlasenko2021-07-111-0/+5
| | | | | | | function old new delta evaluate 3337 3343 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: undo TI_PRINT, it introduced a bug (print with any redirect acting as ↵Denys Vlasenko2021-07-111-0/+5
| | | | | | | | | | | printf) function old new delta evaluate 3329 3337 +8 Patch by Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix beavior of "exit" without parameterDenys Vlasenko2021-07-021-0/+5
| | | | | | | | | | | function old new delta evaluate 3336 3339 +3 awk_exit 93 94 +1 awk_main 829 827 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 4/-2) Total: 2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: evaluate all, even superfluous function argsDenys Vlasenko2021-06-301-1/+7
| | | | | | | function old new delta evaluate 3128 3135 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: allow empty fuinctions with no arguments, disallow function redefinitionsDenys Vlasenko2021-06-301-0/+10
| | | | | | | | | | | function old new delta .rodata 103681 103700 +19 parse_program 303 307 +4 evaluate 3145 3141 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 23/-4) Total: 19 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* awk: fix parsing of expressions such as "v (a)"Denys Vlasenko2021-06-291-0/+11
| | | | | | | function old new delta next_token 812 825 +13 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* cp,mv: fix -t DIR optionRon Yorston2021-06-251-0/+16
| | | | | | | | | | | | | | When the '-t DIR' option is used the loop over the remaining arguments should terminate when a NULL pointer is reached. function old new delta mv_main 585 590 +5 cp_main 492 496 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 9/0) Total: 9 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* unlzma: fix a case where we could read before beginning of bufferDenys Vlasenko2021-06-152-4/+13
| | | | | | | | | | | | | | | Testcase: 21 01 01 00 00 00 00 00 e7 01 01 01 ef 00 df b6 00 17 02 10 11 0f ff 00 16 00 00 Unfortunately, the bug is not reliably causing a segfault, the behavior depends on what's in memory before the buffer. function old new delta unpack_lzma_stream 2762 2768 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dd: support iflag=count_bytesRafał Miłecki2021-04-131-0/+1
| | | | | | | | | | | | | | 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>
* start-stop-daemon: explain -x + -a testDenys Vlasenko2021-03-091-0/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* bc/dc: fix length(0) and length(0.000nnn) resultDenys Vlasenko2021-02-262-0/+10
| | | | | | | function old new delta zxc_vm_process 6464 6498 +34 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* nl: ensure '-b n' option displays file contentRon Yorston2021-02-022-0/+63
| | | | | | | | | | | | | | | | | 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>
* awk: allow printf('%c') to output NUL, closes 13486Ron Yorston2021-02-021-0/+5
| | | | | | | | | | | | | | | | | Treat the output of printf as binary rather than a null-terminated string so that NUL characters can be output. This is considered to be a GNU extension, though it's also available in mawk and FreeBSD's awk. function old new delta evaluate 3487 3504 +17 awk_printf 504 519 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* bc,dc: make BC_LINE_LENGTH/DC_LINE_LENGTH more compatible with GNUDenys Vlasenko2020-12-296-89/+87
| | | | | | | function old new delta xc_vm_init 640 682 +42 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2020-12-292-1/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>