aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * udhcp: comment out unused domain compression codeDenys Vlasenko2020-06-093-13/+18
| | | | | | | | | | | | | | | | | | | | 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>
| * sysctl: do report EACCES errors on writeDenys Vlasenko2020-06-092-5/+8
| | | | | | | | | | | | | | | | | | | | 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>
| * unexpand: correct behavior for --first-only --tabs=4Mark Edgar2020-06-092-4/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * xstrndup: Use strndup instead of implementing it.Martin Lewis2020-06-091-14/+5
| | | | | | | | | | Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dhcpc: code shrink in good_hostnameMartin Lewis2020-06-091-48/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * awk: disallow "str"++, closes bug 12981Denys Vlasenko2020-06-092-1/+11
| | | | | | | | | | | | | | function old new delta parse_expr 887 896 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: tidy code, no functional changeRon Yorston2020-07-091-3/+2
| |
* | chattr, lsattr: enable in the default configurationRon Yorston2020-07-096-7/+138
| | | | | | | | | | | | | | | | | | | | The chattr and lsattr utilities allow file attributes to be changed and displayed. Modify them to support Windows file attributes using the same names as Cygwin. Only allow a limited subset of attributes to be changed: just most of those supported by SetFileAttributes(). Since it isn't possible to set all attributes the '=' operator isn't allowed.
* | ls: treat hidden files as if their names begin with a dotRon Yorston2020-07-091-0/+12
| | | | | | | | | | | | | | On Unix 'ls' treats filenames starting with a dot as hidden and only displays them if the '-a' or '-A' option is given. Extend similar treatment to files with the Windows hidden flag.
* | win32: return raw file attributes in struct mingw_statRon Yorston2020-07-092-0/+5
| | | | | | | | | | | | Until now the emulated stat(2) system calls have only returned a synthesised Unix-style mode value. Also return the raw Windows file attributes.
* | ash: fix shell optionsRon Yorston2020-07-071-7/+7
| | | | | | | | | | | | The Windows-specific shell options winxp, noconsole and nocaseglob have had the wrong indices in optlist since the merge with upstream BusyBox in commit 517cf74f6.
* | ash: improve handling of UNC pathsRon Yorston2020-06-302-38/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Be more strict about identifying UNC paths in unc_root_len(). In updatepwd() in ash: - Skip duplicate leading slashes unless the directory is a UNC path. - Rewrite detection and handling of the five possible types of path. This improves cases like 'cd ///' and 'cd /xyz' when the current directory is a UNC path. See GitHub issue #192.
* | ash: avoid duplicated slashes in output of type/command builtinsRon Yorston2020-06-292-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Microsoft developers have a penchant for adding trailing slashes to entries in PATH: C:/Windows/System32/WindowsPowerShell/v1.0/ C:/Windows/System32/OpenSSH/ The 'type' and 'command -v' shell builtins return paths with duplicated slashes for executables in those directories. See GitHub issue #191. Bonus fixes: - handle backslashes as well as slashes in concat_path_file() - convert backslashes to slashes in the output of 'type', 'command -v'
* | ash: skip NULL argv during forkshellRon Yorston2020-06-211-67/+44
| | | | | | | | | | | | | | | | Alter argv_size()/argv_copy() to omit argv from the forkshell block if it's NULL. Improve forkshell debug code to properly account for parts of funcblock which aren't being used.
* | ash: changes to ctrl-c handlingRon Yorston2020-06-201-57/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make ctrl-c handling more like Unix. Remove the hSIGINT event and the code in waitpid_child() to catch it. Add a call to raise_interrupt() in ctrl_handler(). Prior to these changes interrupts in a child shell weren't properly handled. In release FRP-3466-g53c09d0e1 interrupting a sleep in a child shell results in both shells competing for input: ~ $ sh ~ $ sleep 10 ^C^C ~ $ ~ $ pwd sh: w: not found ~ $ sh: pd: not found ~ $ With recent changes: ~ $ sh ~ $ sleep 10 ^C ~ $ echo $? 130 ~ $ exit ^C ~ $ echo $? 130 ~ $ The error return from the parent shell is due to the lack of job control. Upstream BusyBox ash and dash both do the same when job control is disabled.
* | ash: run ash_main() directly from a FS_SHELLEXEC shellRon Yorston2020-06-201-3/+6
| |
* | ash: reduce forkshell block size for FS_SHELLEXECRon Yorston2020-06-201-25/+46
| | | | | | | | | | It isn't necessary to pass the alias table or line editing history to a forkshell shell that's handling FS_SHELLEXEC.
* | ash: reduce forkshell block size for FS_OPENHERERon Yorston2020-06-201-33/+50
| | | | | | | | | | | | | | | | When handling FS_OPENHERE the forkshell data block only needs to contain the forkshell structure and the here document. Omit everything else. Update forkshell_print() for this case.
* | ash: forkshell code shrinkRon Yorston2020-06-201-18/+8
| | | | | | | | | | Don't pass global pointers to forkshell_size()/forkshell_copy() via the forkshell structure, just reference them directly.
* | win32: enable globbing by defaultRon Yorston2020-06-145-15/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change how busybox.exe expands wildcards on the command line. When globbing is enabled at compile time provide an implementation of _setargv(), which is run early during startup of C programs. This: - enables globbing by setting _dowildcard to -1 - checks for the presence of the environment BB_GLOBBING - if it exists and is set to 0 disables globbing - if it doesn't exist sets BB_GLOBBING=0 but continues to apply Windows' globbing in the current process The consequences of this are: - When busybox.exe is initially run from a Command Prompt Windows' globbing is applied; - Windows' globbing is turned off for future child processes, thus allowing the shell re-execute busybox.exe without it interfering with wildcards; - this behaviour can be overridden by setting BB_GLOBBING explicitly. Globbing can still be disabled at compile time if required. In that case BB_GLOBBING has no effect. With these changes globbing can be enabled by default and BusyBox will do the right thing in most circumstances. (See GitHub issues #172 and #189.)
* | win32: minor improvements to process spawningRon Yorston2020-06-121-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The function mingw_spawn_forkshell() was introduced to handle spawning a forkshell process. Since we know that: - the binary being executed doesn't meet any of the special cases handled by spawnveq() - the arguments don't require quoting we can call spawnve() directly instead of spawnveq(). Also, use xzalloc() to allocate new_argv so we don't need to set the final NULL pointer explicitly.
* | ash: treat all applets as NOEXECRon Yorston2020-06-092-0/+8
| | | | | | | | | | | | | | | | | | In standalone shell mode tryexec() treats all applets as NOEXEC. Except for the shell: calling ash_main() recursively seems unwise. This avoids creating a new process for the applet (which is a Good Thing on Microsoft Windows where creating processes is expensive) but leaves the resources used by the invoking shell in the current process.
* | ash: minimise work when a forkshell process is startedRon Yorston2020-06-091-19/+27
| | | | | | | | | | | | | | | | | | | | | | There's no need to create or initialise the global data structures when a forkshell is being started: they'll soon be replaced by data from the forkshell data block. Move the call to forkshell_init() to the top of ash_main() along with some initialisation that's common to forkshell shells and ordinary shells. Add the minimum necessary initialisation to forkshell_init().
* | winansi: suppress console flags redefinition warningBiswa962020-06-071-0/+5
| | | | | | | | Modern versions of MinGW-w64 define more console modes.
* | printf: emit more contiguous text to improve escape sequencesRon Yorston2020-06-041-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users have a reasonable expectation that printf should be able to construct ANSI escape sequences and have them take effect. This expectation isn't met because printf tends to output one character at a time whereas busybox-w32 needs escape sequences to be output contiguously Force printf to output contiguous text in two cases: - literal text in the format string - string arguments output using the '%b' format specifier (See GitHub issue #189.)
* | time: detect when spawn failsRon Yorston2020-06-041-1/+1
| | | | | | | | | | | | | | In the 64-bit build the time applet reported garbage when it was unable to run the program to be timed. The error return from mingw_spawn_pid() was incorrect.
* | win32: fix networking problemsRon Yorston2020-06-033-2/+6
| | | | | | | | | | | | | | | | | | The subprocess that handles incoming connections for httpd didn't work. It has an accepted connection on stdin and calls getpeername() to obtain its details, but getpeername() didn't initialise networking. ssl_client only seems to deal with file descriptors. Expose init_winsock() again and call it from ssl_client.
* | win32: use lazy loading for certain DLLsRon Yorston2020-06-025-24/+43
| | | | | | | | | | | | | | | | | | Only a handful of functions are used from shell32.dll, userenv.dll and psapi.dll. Mostly these functions are in out of the way places. By loading the functions only when required we can avoid the startup cost of linking the three DLLs in the common case that they aren't needed.
* | win32: only initialise networking if necessaryRon Yorston2020-06-013-10/+43
| | | | | | | | | | | | A call to initialise networking is made during start up even if the applet doesn't need it. Instead, only initialise networking when a call is made to a function that definitely requires it.
* | ash: don't initialise shell variables in forkshell childRon Yorston2020-06-011-2/+9
| | | | | | | | | | | | | | | | | | | | The forkshell child process calls init(), which mostly just initialises shell variables. Since these variables are overwritten with values from the parent process there's no point in doing that. In particular, init() initialises HOSTNAME by calling gethostname() which involves network access and is slow. Avoid this cost when we know the shell is a forkshell child.
* | ash: simplify spawning during forkshellRon Yorston2020-06-013-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | spawn_forkshell() uses mingw_spawn_proc() to start the child shell. mingw_spawn_proc() then calls mingw_spawn_1() which determines that "sh" is an applet, thus calling mingw_spawn_applet() which finally calls spawnveq(). Not only is this convoluted it also won't work if PREFER_APPLETS and SH_STANDALONE aren't enabled. Simplify matters by adding a new function, mingw_spawn_forkshell(), which is tailored for just this case.
* | ash: minor changes to forkshell error handlingRon Yorston2020-06-011-3/+9
| | | | | | | | | | | | | | | | forkshell_prepare() now returns NULL if it fails to map its view of the data block. Detect and report this error in spawn_forkshell(). If forkshell_init() fails it now returns to ash_main() where a generic error is reported.
* | ash: improve forkshell debuggingRon Yorston2020-06-011-4/+14
| | | | | | | | | | | | | | | | | | The name of the output file depended only on the pid of the shell. Since a single shell can execute many forkshells it's useful to include a serial number in the filename so it isn't constantly overwritten. Also, output the type of forkshell.
* | Merge branch 'busybox' into mergeFRP-3466-g53c09d0e1Ron Yorston2020-05-2920-36/+138
|\|
| * wget: implement TLS verification with ENABLE_FEATURE_WGET_OPENSSLDimitri John Ledkov2020-05-201-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ash,hush: drop pointer check before calls to show_historyRon Yorston2020-04-302-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * mim: run scripts from a specification fileRon Yorston2020-04-302-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ash: fix build failure when command built-in is disabledRon Yorston2020-04-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * httpd: permit non-default home directory with NOMMU enabledRon Yorston2020-04-301-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * grep: add proper support for pattern_listSören Tempel2020-04-302-6/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-292-2/+9
| | | | | | | | | | | | | | | | | | | | 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-292-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * build system: remove KBUILD_STR()Jean-Philippe Brucker2020-04-295-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * unzip: -d should create the dirLauri Kasanen2020-04-291-1/+7
| | | | | | | | | | | | | | 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>
| * shells: fix exitcode_trapN tests to avoid racesDenys Vlasenko2020-02-264-8/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | vi: enable regex search in default buildRon Yorston2020-05-282-4/+4
| |
* | Clarify build requirementsRon Yorston2020-05-271-1/+7
| |
* | Update README.mdRon Yorston2020-05-261-2/+2
| | | | | | | | MinGW is no longer supported in EPEL.
* | win32: changes to '#!' supportRon Yorston2020-05-242-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Since the earliest days of busybox-w32 '#!' has searched PATH for the interpreter. This doesn't seem to be supported by precedent. In testing I also found that additional code was needed for the case where PATH has been altered in the current shell or is modified on the command line: PATH has to be extracted from envp rather than getenv("PATH"). Drop this non-standard feature. *NIX implementations disagree on whether the interpreter can itself be a script. Follow Linux and allow this with a limit of four levels of nesting.
* | dd: fix handling of 'conv=notrunc seek=N'Ron Yorston2020-05-203-7/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e6680912a (dd: create a sparse file when seek=N is used) broke the use of 'conv=notrunc seek=N' to modify existing files. Rename seek_sparse() to make_sparse() and: - add an argument to specify the start of the sparse region; - call make_sparse() before ftruncate(); - call make_sparse() only if: * we can determine the size of the file; * the file is not open in append mode; * the file is being extended. This should fix GitHub issue #186.