Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-01-02time: implement %% and \escapes in -f FMTDenys Vlasenko
function old new delta time_main 1217 1316 +99 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-12-31awk: fix handling of empty fieldsDenys Vlasenko
Patch by M Rubon <rubonmtz@gmail.com>: Busybox awk handles references to empty (not provided in the input) fields differently during the first line of input, as compared to subsequent lines. $ (echo a ; echo b) | awk '$2 != 0' #wrong b No field $2 value is provided in the input. When awk references field $2 for the "a" line, it is seen to have a different behaviour than when it is referenced for the "b" line. Problem in BusyBox v1.36.1 embedded in OpenWrt 23.05.0 Same problem also in 21.02 versions of OpenWrt Same problem in BusyBox v1.37.0.git I get the correct expected output from Ubuntu gawk and Debian mawk, and from my fix. will@dev:~$ (echo a ; echo b) | awk '$2 != 0' #correct a b will@dev:~/busybox$ (echo a ; echo b ) | ./busybox awk '$2 != 0' #fixed a b I built and poked into the source code at editors/awk.c The function fsrealloc(int size) is core to allocating, initializing, reallocating, and reinitializing fields, both real input line fields and imaginary fields that the script references but do not exist in the input. When fsrealloc() needs more field space than it has previously allocated, it initializes those new fields differently than how they are later reinitialized for the next input line. This works fine for fields defined in the input, like $1, but does not work the first time when there is no input for that field (e.g. field $99) My one-line fix simply makes the initialization and clrvar() reinitialization use the same value for .type. I am not sure if there are regression tests to run, but I have not done those. I'm not sure if I understand why clrvar() is not setting .type to a default constant value, but in any case I have left that untouched. function old new delta ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-11-07start-stop-daemon: add -d DIR chdir optionejaaskel
Add option to change the running directory before starting the process. This can be done using -d or --chdir options. Add also test cases to start-stop-daemon to test out the directory change option. function old new delta packed_usage 34602 34648 +46 start_stop_daemon_main 1107 1130 +23 start_stop_daemon_longopts 156 164 +8 .rodata 105382 105384 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 79/0) Total: 79 bytes Signed-off-by: ejaaskel <esa.jaaskela@suomi24.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-06-08awk: fix subst code to handle "start of word" pattern correctly (needs ↵Denys Vlasenko
REG_STARTEND) function old new delta awk_sub 637 714 +77 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-06-03awk: fix backslash handling in sub() builtinsDenys Vlasenko
function old new delta awk_sub 559 544 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-30awk: fix precedence of = relative to ==Denys Vlasenko
Discovered while adding code to disallow assignments to non-lvalues function old new delta parse_expr 936 991 +55 .rodata 105243 105247 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 59/0) Total: 59 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-27awk: fix splitting with default FSDenys Vlasenko
function old new delta awk_split 543 544 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26od: -l,I,L indeed depend on sizeof(long), fix thisDenys Vlasenko
function old new delta .rodata 105255 105252 -3 od_main 1917 1901 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-19) Total: -19 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26awk: fix use-after-realloc (CVE-2021-42380), closes 15601Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26libbb/dump: correct handling of 1-byte signed int formatDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26od, hexdump: byte 0x11 is "dc1" not "dcl"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26od: support -DOHXILDenys Vlasenko
function old new delta od_main 1866 1917 +51 .rodata 105306 105321 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 66/0) Total: 66 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26od: fix default format, shrinkDenys Vlasenko
function old new delta od_main 556 568 +12 .rodata 104613 104555 -58 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 12/-58) Total: -46 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-26od: stop printing extra trailing spacesDenys Vlasenko
function old new delta .rodata 104598 104613 +15 display 1475 1485 +10 od_main 549 556 +7 rewrite 971 967 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 32/-4) Total: 28 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-25od: implement -BDenys Vlasenko
function old new delta .rodata 105305 105306 +1 od_main 1880 1866 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 1/-14) Total: -13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-25od: correct -i, enable tests which pass for DESKTOP tooDenys Vlasenko
function old new delta .rodata 105302 105305 +3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-25od: for !DESKTOP, match output more closely to GNU coreutils 9.1, implement -sDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-05-25od: add testsDavid Leonard
* Added tests for od (non-DESKTOP little-endian) * Allow 'optional' to invert meaning of a config option with '!' Signed-off-by: David Leonard <d+busybox@adaptive-enterprises.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-04-11seq: fix yet another case of negative parameters not workingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-04-10seq: accept negative parametersDenys Vlasenko
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>
2023-03-28find: implement -okDavid Leonard
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>
2023-01-02testsuite/sha1sum.tests: fix false positive failureDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-01-02testsuite/tree.tests: fix false positive failureDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-12-13testsuite/mount.tests: accomodate umount failure seen on 5.18.0Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-08-22xxd: add two more testcasesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-08-22xxd -r: without -p, stop at more than one whitespace, closes 14786Denys Vlasenko
function old new delta xxd_main 888 1076 +188 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-07-29sort: fix sort -s -u, closes 14871Denys Vlasenko
function old new delta sort_main 851 856 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-07-29sort: fix -k2M (wasn't skipping leading whitespace)Denys Vlasenko
function old new delta compare_keys 848 862 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-07-11awk: fix use after free (CVE-2022-30065)Natanael Copa
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>
2022-07-11shaNNNsum: accept one-space "HASH FILENAME" format for -c, closes 14866Denys Vlasenko
function old new delta md5_sha1_sum_main 496 501 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-06-30tree: new appletRoger Knecht
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>
2022-05-02tsort: new appletDavid Leonard
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>
2022-01-23sed: fix handling of escaped delimiters in s/// replacementDenys Vlasenko
function old new delta parse_regex_delim 111 140 +29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-23sed: fix handling of escaped delimiters in s/// search pattern, closes 14541Denys Vlasenko
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>
2022-01-09awk: input numbers are never octal or hex (only program consts can be)Denys Vlasenko
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>
2022-01-05sort: support -hDenys Vlasenko
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>
2022-01-05sort: fix -s -r interaction: 'stable' order is not affected by -rDenys Vlasenko
function old new delta compare_keys 818 820 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-04sed: correctly handle 'w FILE' commands writing to the same fileDenys Vlasenko
function old new delta sed_xfopen_w - 84 +84 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-12-25sed: do not ignore 'g' modifier when match starts with ^Dominique Martinet
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>
2021-12-17printf: allow 0 as a flag and allow multiple flagsRon Yorston
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>
2021-11-28libbb: code shrink in des encryption, in setup_salt()Denys Vlasenko
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>
2021-10-09libbb: better coreutils compatibility for realpathRon Yorston
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>
2021-10-09xxd: fix -p -r, closes 13881Denys Vlasenko
function old new delta xxd_main 893 890 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-09-17date,touch: allow timezone offsets in datesRon Yorston
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>
2021-09-05awk: fix printf %%Daniel Thau
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>
2021-08-22rev: correct output for long input linesRon Yorston
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>
2021-08-16awk: fix testsuiteDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-08-16tar: fix testsuiteDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-08-16dd: fix testsuiteDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-08-15cut: fix testsuiteDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>