summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * randomconfig fixesDenys Vlasenko2020-06-243-2/+6
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-236-6/+31
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixDenys Vlasenko2020-06-231-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-231-0/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-232-1/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * randomconfig fixesDenys Vlasenko2020-06-232-0/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * examples/udhcp/simple.script: fix IPv6 support when using udhcpcStefan Agner2020-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * udhcpc6: use correct multicast MACUwe Glaeser2020-06-211-1/+5
| | | | | | | | | | | | | | | | 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>
| * nmeter: add %T (zero-based timestamp) formatDenys Vlasenko2020-06-101-14/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Makefile.flags: restrict Wno-constant-logical-operand and ↵Biswapriyo Nath2020-06-101-0/+2
| | | | | | | | | | | | | | | | | | | | 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>
| * deluser: check if specified home is a directory before removing itSören Tempel2020-06-091-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * dhcpc: refactor xmalloc_optname_optval to shrink binary sizeMartin Lewis2020-06-092-27/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * httpd: allow '-h' to work when daemonized with NOMMU enabledRon Yorston2020-06-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * 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>