aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-02-16ash: parser: Fix incorrect eating of backslash newlinesDenys Vlasenko
Keeping up with upstream (in our case, 'before patch' code is not buggy). Upstream commit: Date: Fri, 11 May 2018 23:41:25 +0800 parser: Fix incorrect eating of backslash newlines With the introduction of synstack->syntax, a number of references to the syntax variable was missed during the conversion. This causes backslash newlines to be incorrectly removed in single quote context. This patch also combines these calls into a new helper function pgetc_top. Fixes: ab1cecb40478 ("parser: Add syntax stack for recursive...") Reported-by: Leah Neukirchen <leah@vuxu.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-16ash: use pgetc_eatbnl() in more places, take 2Denys Vlasenko
Adding previously skipped "readtoken1(pgetc_eatbnl(), DQSYNTAX..." changes from upstream commit: Date: Thu Mar 8 08:37:11 2018 +0100 Author: Harald van Dijk <harald@gigawatt.nl> parser: use pgetc_eatbnl() in more places dash has a pgetc_eatbnl function in parser.c which skips any backslash-newline combinations. It's not used everywhere it could be. There is also some duplicated backslash-newline handling elsewhere in parser.c. Replace most of the calls to pgetc() with calls to pgetc_eatbnl() and remove the duplicated backslash-newline handling. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-14fdisk: add HFS / HFS+ partition typeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13tftp: on download, open local file only when first bit of data arrivedDenys Vlasenko
No reason to potentially clobber existing file before absolutely necessary. function old new delta tftp_protocol 1947 2020 +73 tftp_main 393 376 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 73/-17) Total: 56 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13tftp: fix thinko in code shrinkDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13tftp: code shrinkDenys Vlasenko
function old new delta tftp_protocol 1949 1947 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-13tftpd: show requested file name in open error messageDenys Vlasenko
function old new delta tftp_protocol 1902 1949 +47 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-02awk: fix more "length" cases, closes 12486Denys Vlasenko
function old new delta next_token 808 831 +23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-01-29ash,hush: allow builtins to be tab-completed, closes 7532Ron Yorston
function old new delta complete_cmd_dir_file 678 830 +152 get_builtin_name - 35 +35 optschanged 125 132 +7 hush_main 1069 1076 +7 save_command_ps_at_cur_history 76 78 +2 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/0 up/down: 203/0) Total: 203 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-01-29xargs: fix handling of quoted arguments, closes 11441Ron Yorston
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>
2020-01-29vi: fixes to string search in colon commands, closes 10321Ron Yorston
Handling of string searches in colon commands (e.g ':/pat1/,/pat2/cmd') differ from standard vi: - As reported in bug 10321 such searches can't be repeated using the 'n' command. This is because the last search pattern isn't updated. - The search also can't be repeated using the command '://' because an empty search pattern doesn't imply the use of the last search pattern. - Such searches should start on the line after the current line, otherwise '://' never moves to the next occurrence of the pattern. This can also affect other cases where line ranges are specified using search patterns. Fix these various issues. function old new delta get_one_address 325 342 +17 Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-01-29ash: improve expandstr()Ron Yorston
The dash maintainer recently posted a fix for issues with expanding PS1. These had already been fixed differently in BusyBox ash. Borrow a couple of improvements: - Use a single call to setjmp() to trap errors in both readtoken1() and expandarg(). - In case of error set the prompt to the literal value of PS1 rather than the half-digested nonsense in stackblock() which might include ugly control characters. function old new delta expandstr 353 300 -53 Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-01-29syslogd: add config option to include milliseconds in timestampsPeter Korsgaard
For some use cases, having logs with more than 1 second accuracy can be helpful. Add an option to include milliseconds when adding a timestamp in HH:MM:SS.mmm format, similar to syslog-ng with fraq_digits(3) or journalctl -o short-precise. For simplicity, abuse the remaining space in the buffer used by ctime to add the millieconds (overwriting year). function old new delta timestamp_and_log 401 448 +47 Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-01-14udhcpd: mangle hostnames starting with dash ("-option")Denys Vlasenko
function old new delta add_lease 316 328 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-12-03whois: limit total length of response to 32+2 kbDenys Vlasenko
function old new delta query 517 554 +37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-12-03init: improve handling of signals racing with each otherDenys Vlasenko
Before this change, a request to reboot could be "overwritten" by e.g. SIGHUP. function old new delta init_main 709 793 +84 packed_usage 33273 33337 +64 run_actions 109 117 +8 stop_handler 87 88 +1 check_delayed_sigs 340 335 -5 run 214 198 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/2 up/down: 157/-21) Total: 136 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-12-02init: if tcgetattr() fails, don't even try to tcsetattr()Denys Vlasenko
function old new delta set_sane_term 111 114 +3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-28hush: fix preprocessor directives indentationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-27grep: add -RTomi Leppanen
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>
2019-11-23bc: fix comparison bug, closes 12336Denys Vlasenko
function old new delta bc_num_cmp 249 259 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-19Remove stime() function callsAlistair Francis
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>
2019-11-17Updated inittab example documentationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-17chgrp: correct the usage for non-desktop chgrp callsLiu, Shuang (ADITG/ESM)
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>
2019-11-09taskset: tighten the check for stride valuesDenys Vlasenko
function old new delta taskset_main 986 987 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-09taskset: implement stride argumentDenys Vlasenko
function old new delta taskset_main 925 986 +61 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-08unxz: show -t in --helpDenys Vlasenko
function old new delta packed_usage 33236 33247 +11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-08taskset: update commentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-01taskset: add support for taking/printing CPU list (-c option)Denys Vlasenko
function old new delta taskset_main 511 855 +344 Based on patch by Fryderyk Wrobel <frd1996@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-01hush: restore redirected stdinDenys Vlasenko
function old new delta restore_redirects 52 95 +43 save_fd_on_redirect 243 253 +10 hfopen 90 99 +9 fgetc_interactive 259 261 +2 builtin_type 117 115 -2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 64/-2) Total: 62 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-30ntpd: decrease MIN_FREQHOLD by 2, increase "penalty" for largish offset x2Denys Vlasenko
> 2018-07-25: > ntpd: increase MIN_FREQHOLD by 3 > This means we'll start correcting frequency ~5 minutes after start, > not ~3.5 ones. > With previous settings I still often see largish ~0.7s initial offsets > only about 1/2 corrected before frequency correction kicks in, > resulting in ~200ppm "correction" which is then slowly undone. Review of real-world results of the above shows that with small initial offsets, freq correction can be allowed to kick in sooner, whereas with large (~0.8s) offsets, we still start freq correction a bit too soon. Let's rebalance this a bit. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-27nslookup: implement support for SRV recordsJo-Philipp Wich
Add support for querying and parsing SRV DNS records. function old new delta send_queries 1711 1865 +154 qtypes 72 80 +8 Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-27nslookup: handle replies without RRsJo-Philipp Wich
Under some circumstances, a DNS reply might contain no resource records, e.g. when a valid domain is queried that does not have records of the requested type. Example with nslookup from BIND dnsutils: $ nslookup -q=SRV example.org Server: 10.11.12.13 Address: 10.11.12.13#53 Non-authoritative answer: *** Can't find example.org: No answer Currently the busybox nslookup applet simply prints nothing after the "Non-authoritative answer:" line in the same situation. This change modifies nslookup to either print "Parse error" or "No answer" diagnostics, depending on the parse_reply() return value. function old new delta send_queries 1676 1711 +35 Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-26gunzip: fix incorrect decoding of "fixed" inflate blocksDenys Vlasenko
function old new delta huft_build 1008 1022 +14 inflate_block 1253 1256 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 17/0) Total: 17 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25hdparm: placate "warning: taking the absolute value of unsigned type"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25vi: placate "warning: shifting a negative signed value is undefined"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25read_key(): placate "warning: shifting a negative signed value is undefined"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25ntpd: abs(tmx.offset) was truncating a "long" typed valueDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25tc: array address is never NULLDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25traceroute: fix gcc-ismDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25suppress a few "unused function" warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25netstat: suppress a warning (conversion from 'int' to 'smallint' changes value)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25Makefile.flags: suppress some clang-9 warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25clang/llvm 9 fix - do not eliminate a store to a fake "const"Denys Vlasenko
This is *much* better (9 kbytes better) than dropping "*const" optimization trick. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25tar: fix fallout of: change -a from meaning "lzma" to mean "autodetect by ↵Denys Vlasenko
extension" Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-24Remove syscall wrappers around clock_gettime, closes 12091Denys Vlasenko
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>
2019-10-22shell: better comments in BASE#nn codeDenys Vlasenko
function old new delta evaluate_string 932 930 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-21shell/ulimit: code shrinkDenys Vlasenko
text data bss dec hex filename 1001949 551 5612 1008112 f61f0 busybox_old 1001906 551 5612 1008069 f61c5 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-20gunzip: code shrink by using int-, not short-sized struct memberDenys Vlasenko
function old new delta inflate_block 1254 1253 -1 inflate_codes 629 621 -8 huft_build 1054 1008 -46 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-55) Total: -55 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-19gzip: code shrinkDenys Vlasenko
huft_build() still has way too many params function old new delta lit - 94 +94 dist - 94 +94 huft_build 1058 1054 -4 inflate_block 1281 1254 -27 cpdext 30 - -30 cplext 31 - -31 cpdist 60 - -60 cplens 62 - -62 ------------------------------------------------------------------------------ (add/remove: 2/4 grow/shrink: 0/2 up/down: 188/-214) Total: -26 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-19gzip: code shrinkDenys Vlasenko
huft_build() has way too many params function old new delta inflate_block 1293 1281 -12 huft_build 1085 1058 -27 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-39) Total: -39 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>