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
2021-03-31decompress_gunzip: Fix DoS if gzip is corrupt1_32_stableSamuel Sapalski
On certain corrupt gzip files, huft_build will set the error bit on the result pointer. If afterwards abort_unzip is called huft_free might run into a segmentation fault or an invalid pointer to free(p). In order to mitigate this, we check in huft_free if the error bit is set and clear it before the linked list is freed. Signed-off-by: Samuel Sapalski <samuel.sapalski@nokia.com> Signed-off-by: Peter Kaestle <peter.kaestle@nokia.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-30ash: fix ${unset_var/pattern/repl}Denys Vlasenko
function old new delta subevalvar 1349 1353 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01Bump version to 1.32.11_32_1Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01hush: output bash-compat killing signal namesDenys Vlasenko
This significantly syncronises ash-signals and hush-signals tests. function old new delta process_wait_result 449 450 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01hush: do not print killing signal name in `cmd_whihc_dies_on_signal`Denys Vlasenko
function old new delta process_wait_result 438 449 +11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01shell: remove FAST_FUNC from a static functionDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01shell: add testsuite for "wait $pid" waiting for other tasksDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01ash: jobs: Fix waitcmd busy loopDenys Vlasenko
Upstream commit: Date: Tue, 2 Jun 2020 23:46:48 +1000 jobs: Fix waitcmd busy loop We need to clear gotsigchld in waitproc because it is used as a loop conditional for the waitcmd case. Without it waitcmd may busy loop after a SIGCHLD. This patch also changes gotsigchld into a volatile sig_atomic_t to prevent compilers from optimising its accesses away. Fixes: 6c691b3e5099 ("jobs: Only clear gotsigchld when waiting...") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> This change also incorporates other changes to bring us closer to upstream. function old new delta dowait 553 636 +83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01ash: jobs: Fix infinite loop in waitprocDenys Vlasenko
Upstream commit: Date: Fri, 10 Apr 2020 21:03:09 +1000 jobs: Fix infinite loop in waitproc After we changed the resetting of gotsigchld so that it is only done if jp is NULL, we can now get an infinite loop in waitproc if gotsigchld is set but there is no outstanding child because everything had been waited for previously without gotsigchld being zeroed. This patch fixes it by always zeroing gotsigchld as we did before. The bug that the previous patch was trying to fix is now resolved by switching the blocking mode to DOWAIT_NORMAL after the specified job has been completed so that we really do wait for all outstanding dead children. Reported-by: Harald van Dijk <harald@gigawatt.nl> Fixes: 6c691b3e5099 ("jobs: Only clear gotsigchld when waiting...") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> function old new delta dowait 553 631 +78 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01ash: remove a tentative TODO, it's a wrong ideaDenys Vlasenko
Upstream tried it, and then reverted by: From: Herbert Xu <herbert@gondor.apana.org.au> Date: Tue, 26 May 2020 23:19:05 +1000 parser: Fix double-backslash nl in old-style command sub Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01shell: Fix "read -d ''" behaviorChristian Eggers
With bash's read builtin it is possible to read from a file (e.g. device-tree) until the first '\0' character: IFS= read -r -d '' VARIABLE < file In busybox ash the -d extension is also implemented, but checking the read character for '\0' has to be performed after comparing with the delimiter. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-26Bump version to 1.32.01_32_0Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-25gzip -d with zcat enabled but gunzip disabled was misbehavingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24make_single_applets.sh: switch off nologin deps optionDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24bc: placate a "defined but not used" warningDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24nologin: make it possible to build it as single appletDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24suppress a few compile warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-21examples/udhcp/simple.script: fix IPv6 support when using udhcpcStefan Agner
The udhcpc script calls ip addr flush .. which flushes addresses of any address family, including IPv6. However, busybox udhcpc is IPv4 only and should not influence IPv6 addressing. Hence use ip addr flush with family constraint. The script particularly broke IPv6 SLAAC: Typically when udhcpc calls the script the kernel already assigned the IPv6 link-local address. The flush removes the link-local IPv6 address again and prohibits proper IPv6 operation such as SLAAC since neighbor discovery protocol relies on IPv6 link-local addressing. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> [Taken from https://git.openembedded.org/openembedded-core/commit/meta/recipes-core/busybox/files/simple.script?id=b77541dbb2f442e51842f9d24c8745a6df2d1478] Signed-off-by: Quentin Schulz <quentin.schulz@streamunlimited.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-21udhcpc6: use correct multicast MACUwe Glaeser
function old new delta static.MAC_DHCP6MCAST_ADDR - 6 +6 Signed-off-by: Uwe Glaeser <uwe.glaeser@dormakaba.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-10nmeter: add %T (zero-based timestamp) formatDenys Vlasenko
function old new delta collect_tv - 132 +132 collect_monotonic - 61 +61 nmeter_main 754 778 +24 gmtime - 21 +21 init_monotonic - 18 +18 init_functions 44 48 +4 packed_usage 33432 33420 -12 collect_time 125 19 -106 ------------------------------------------------------------------------------ (add/remove: 5/0 grow/shrink: 2/2 up/down: 260/-118) Total: 142 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-10Makefile.flags: restrict Wno-constant-logical-operand and ↵Biswapriyo Nath
Wno-string-plus-int options for clang these options were added in b4ef2e3467d8e980ccf13c9dd342459c013b455f commit gcc shows unrecognized command-line option warnings Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09deluser: check if specified home is a directory before removing itSören Tempel
On Alpine, some users use /dev/null as a home directory. When removing such a user with `deluser --remove-home` this causes the /dev/null device file to be removed which is undesirable. To prevent this pitfall, check if the home directory specified for the user is an actual directory (or a symlink to a directory). Implementations of similar tools for other operating systems also implement such checks. For instance, the OpenBSD rmuser(1) implementation [0]. [0]: https://github.com/openbsd/src/blob/b69faa6c70c5bfcfdddc6138cd8e0ee18cc15b03/usr.sbin/adduser/rmuser.perl#L143-L151 function old new delta deluser_main 337 380 +43 Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09dhcpc: refactor xmalloc_optname_optval to shrink binary sizeMartin Lewis
function old new delta len_of_option_as_string 14 13 -1 dhcp_option_lengths 14 13 -1 udhcp_str2optset 641 637 -4 static.xmalloc_optname_optval 777 718 -59 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-65) Total: -65 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09httpd: allow '-h' to work when daemonized with NOMMU enabledRon Yorston
Commit d1b75e184 (httpd: permit non-default home directory with NOMMU enabled) only works when used with the '-f' (foreground) option. When '-f' isn't specified and NOMMU is enabled bb_daemonize_or_rexec() is called to daemonize the server. Since the server process has been re-execed the previous patch results in the xchdir() not being called. Fix this by resetting the re_execed variable in this case. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09udhcp: comment out unused domain compression codeDenys Vlasenko
function old new delta attach_option 411 406 -5 dname_enc 381 167 -214 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-219) Total: -219 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09sysctl: do report EACCES errors on writeDenys Vlasenko
function old new delta sysctl_act_recursive 165 179 +14 sysctl_act_on_setting 467 471 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 18/0) Total: 18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09unexpand: correct behavior for --first-only --tabs=4Mark Edgar
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>
2020-06-09xstrndup: Use strndup instead of implementing it.Martin Lewis
Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09dhcpc: code shrink in good_hostnameMartin Lewis
Incorporated valid_domain_label into good_hostname to simplify the implementation. function old new delta static.xmalloc_optname_optval 973 958 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-15) Total: -15 bytes text data bss dec hex filename 993144 16915 1872 1011931 f70db busybox_old 993129 16915 1872 1011916 f70cc busybox_unstripped Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09awk: disallow "str"++, closes bug 12981Denys Vlasenko
function old new delta parse_expr 887 896 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-05-20wget: implement TLS verification with ENABLE_FEATURE_WGET_OPENSSLDimitri John Ledkov
When ENABLE_FEATURE_WGET_OPENSSL is enabled, correctly implement TLS verification by default. And only ignore verification errors, if --no-check-certificate was passed. Also note, that previously OPENSSL implementation did not implement TLS verification, nor printed any warning messages that verification was not performed. Bug-Ubuntu: https://bugs.launchpad.net/bugs/1879533 CVE-2018-1000500 Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-30ash,hush: drop pointer check before calls to show_historyRon Yorston
show_history() checks that its argument in non-null so there's no need to repeat the test at call sites. function old new delta historycmd 25 17 -8 builtin_history 29 21 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-16) Total: -16 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-30mim: run scripts from a specification fileRon Yorston
mim runs scripts from a specification file which can be thought of as an extremely limited Makefile. Neither make variables nor dependencies are supported. By default the file 'Mimfile' is read. An example: hello: echo hello $1 clean: rm -rf * The command 'mim' or 'mim hello' will echo 'hello'. Unlike 'make' arguments after the first are available to the script; they don't specify additional targets. mim isn't enabled by default. Enabling it increases the size of the binary by about 500 bytes. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-30ash: fix build failure when command built-in is disabledRon Yorston
Since commit 7eb8eecbb (ash: eval: Add assignment built-in support again) building BusyBox with the 'command' built-in disabled fails. parse_command_args() only needs to be called when the 'command' built-in is run. Which it won't be if it's disabled. v2: Avoiding infinite loops is good, too. Thanks, Harald van Dijk. Reported-by: Deweloper <deweloper@wp.pl> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-30httpd: permit non-default home directory with NOMMU enabledRon Yorston
When BusyBox is compiled with NOMMU enabled running httpd with the '-h' option fails even if the specified directory exists: $ ls -d www www $ busybox httpd -fvvvp 8080 -h www ... ... try to access http://localhost:8080/www ... httpd: can't change directory to 'www': No such file or directory The parent process executes xchdir("www"). When a connection is accepted it's handled by re-executing httpd in inetd mode. The child process inherits the current directory "www" and tries to change directory again to "www", which fails. Omit the call to xchdir() when httpd is re-executed. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-30grep: add proper support for pattern_listSören Tempel
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>
2020-04-29grep: Fix -f FILE when FILE is empty and -x providedGray Wolf
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>
2020-04-29xargs: restore correct behaviour of -n optionRon Yorston
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>
2020-04-29build system: remove KBUILD_STR()Jean-Philippe Brucker
When using GNU Make >=4.3, the KBUILD_STR() definition interferes badly with dependency checks during build, and forces a complete rebuild every time Make runs. In if_changed_rule, Kconfig checks if the command used to build a file has changed since last execution. The previous command is stored in the generated .<file>.o.cmd file. For example applets/.applets.o.cmd defines a "cmd_applets/applets.o" variable: cmd_applets/applets.o := gcc ... -D"KBUILD_STR(s)=#s" ... Here the '#' should be escaped with a backslash, otherwise GNU Make interprets it as starting a comment, and ignore the rest of the variable. As a result of this truncation, the previous command doesn't equal the new command and Make rebuilds each target. The problem started to appear when GNU Make 4.3 (released January 2020), introduced a backward-incompatible fix to macros containing a '#'. While the above use of '#', a simple Make variable, still needs to be escaped, a '#' within a function invocation doesn't need to be escaped anymore. As Martin Dorey explained on the GNU Make discussion [1], the above declaration is generated from make-cmd, defined as: make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))) Since GNU Make 4.3, the first argument of subst should not have a backslash. make-cmd now looks for literally \# and doesn't find it, and as a result doesn't add the backslash when generating .o.cmd files. [1] http://savannah.gnu.org/bugs/?20513 We could fix it by changing make-cmd to "$(subst #,\#,...)", but to avoid compatibility headaches, simply get rid of the KBUILD_STR definition, as done in Linux by b42841b7bb62 ("kbuild: Get rid of KBUILD_STR"). Quote the string arguments directly rather than asking the preprocessor to quote them. Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-29unzip: -d should create the dirLauri Kasanen
The official Info-Zip unzip creates the dir if it doesn't exist. Signed-off-by: Lauri Kasanen <cand@gmx.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-26shells: fix exitcode_trapN tests to avoid racesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-24ash: expand: Fix multiple issues with EXP_DISCARD in evalvarDenys Vlasenko
Upstream commit: Date: Wed, 12 Sep 2018 14:27:16 +0800 expand: Fix multiple issues with EXP_DISCARD in evalvar The commit 3cd538634f71538370f5af239f342aec48b7470b broke parameter expansion in multiple ways because the EXP_DISCARD flag wasn't set or tested for various cases: $ src/dash -c 'var=; echo ${var:+nonempty}' nonempty $ src/dash -u -c 'unset foo bar; echo ${foo+${bar}}' dash: 1: bar: parameter not set $ src/dash -c 'foo=bar; echo ${foo=BUG}; echo $foo' barBUG bar $ This patch fixes them by introducing a new discard variable that tracks whether the extra word should be discarded or not when it is parsed. Reported-by: Martijn Dekker <martijn@inlv.org> Fixes: 3cd538634f71 ("expand: Do not reprocess data when...") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Reported-by: Martijn Dekker <martijn@inlv.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-24ash: expand: Do not reprocess data when expanding wordsDenys Vlasenko
Upstream patch: Date: Wed, 30 May 2018 02:06:03 +0800 expand: Do not reprocess data when expanding words Currently various paths will reprocess data when performing word expansion. For example, expari will skip backwards looking for the start of the arithmetic expansion, while evalvar will skip unexpanded words manually. This is cumbersome and error-prone. This patch fixes this by making word expansions proceed in a linear fashion. This means changing argstr and the various expansion functions such as expari and subevalvar to return the next character to be expanded. This is inspired by similar code from FreeBSD. However, we take things one step further and completely remove the manual word skipping in evalvar. This is accomplished by introducing a new EXP_DISCARD flag that tells argstr to only parse and not produce any actual expansions. Incidentally, argstr will now always NUL-terminate the expansion unless the EXP_WORD flag is set. This is because all but one caller of argstr wants the result to be NUL-termianted. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Also includes two one-line follow-up fixes: expand: Eat closing brace for length parameter if (subtype == VSLENGTH) { + p++; if (flag & EXP_DISCARD) expand: Fix double-decrement in argstr - newloc = expdest - (char *)stackblock() - end; + newloc = q - (char *)stackblock() - end; and changes in code for bash substring extensions. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-24ash: move TRACE statement in evalcommand()Ron Yorston
Following recent work on evalcommand() a TRACE statement to report the status of a forked command was left in the wrong place. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>