aboutsummaryrefslogtreecommitdiff
path: root/libbb/compare_string_array.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-07-25win32: code shrink kill(2)Ron Yorston3-33/+19
- Drop exit_code argument from kill_SIGTERM_by_handle() - Pass signal number rather than exit code to other functions - Merge kill_SIGKILL() and kill_SIGTEST() Saves 112 bytes.
2020-07-21win32: update link to Microsoft document on command-line argumentsRon Yorston1-1/+1
2020-07-19ts: correct output in 64-bit buildRon Yorston1-0/+8
ts failed to output the correct time when built for 64-bit Windows. In 64-bit builds time_t is a 64-bit quantity whereas the tv_sec member of struct timeval is 32-bit. https://sourceforge.net/p/mingw-w64/bugs/783/ Use a temporary time_t value in 64-bit builds.
2020-07-09win32: alter build flagsFRP-3532-g01a256149Ron Yorston1-1/+1
Add -fno-builtin-strndup to the build flags, otherwise builds with link-time optimisation can't find strndup.
2020-07-09win32: import strndup from gnulibRon Yorston3-0/+42
2020-07-09ash: tidy code, no functional changeRon Yorston1-3/+2
2020-07-09chattr, lsattr: enable in the default configurationRon Yorston6-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.
2020-07-09ls: treat hidden files as if their names begin with a dotRon Yorston1-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.
2020-07-09win32: return raw file attributes in struct mingw_statRon Yorston2-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.
2020-07-07ash: fix shell optionsRon Yorston1-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.
2020-06-30ash: improve handling of UNC pathsRon Yorston2-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.
2020-06-30libbb: code shrink in last_char_is()Denys Vlasenko1-8/+9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29compare_string_array: code shrinkMartin Lewis1-2/+5
Code shrink and prevention of possible out of bounds access. function old new delta nth_string 36 26 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10) Total: -10 bytes text data bss dec hex filename 981342 16915 1872 1000129 f42c1 busybox_old 981332 16915 1872 1000119 f42b7 busybox_unstripped Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29procps: code shrinkMartin Lewis1-2/+10
function old new delta skip_whitespace_if_prefixed_with - 17 +17 procps_read_smaps 911 854 -57 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/1 up/down: 17/-57) Total: -40 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29udhcpc: fix a TODO in fill_envp using option scannerMartin Lewis1-114/+84
fill_envp now iterates over the packet only once instead of a few hundred times using the new option scanner. function old new delta udhcp_scan_options - 189 +189 putenvp - 46 +46 init_scan_state - 22 +22 udhcp_get_option 227 104 -123 udhcp_run_script 835 601 -234 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 0/2 up/down: 257/-357) Total: -100 bytes Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29udhcp: add option scannerMartin Lewis2-42/+62
Added an option scanner to udhcp to enable iteration over packet options. Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29wget: fix openssl options for cert verificationScott Court1-4/+17
function old new delta is_ip_address - 54 +54 spawn_https_helper_openssl 461 486 +25 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 79/0) Total: 79 bytes Signed-off-by: Scott Court <z5t1@z5t1.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29acpid: only display -p if supported in usageNorbert Lange2-2/+4
Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29dhcpd: remove hardcoded pidfile pathNorbert Lange1-1/+7
Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29dpkg: prevent important directories from being removedNorbert Lange1-0/+23
busybox will remove directory symlinks, which is at odds with common layouts that have some of bin/lib/lib32/lib64 symlinked. this adds a exludelist for critcal and often symlinked directories. Fixes: Bug 12551 function old new delta remove_file_array 139 231 +92 Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29nc_bloaty: support udp broadcast portsNorbert Lange1-9/+15
Add a -b option, identical to debians "traditional" netcat. This allows sending (subnet) UDP Broadcasts. function old new delta packed_usage 33420 33441 +21 nc_main 1041 1057 +16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 37/0) Total: 37 bytes Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-29ash: avoid duplicated slashes in output of type/command builtinsRon Yorston2-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'
2020-06-26Start 1.33.0 development cycleDenys Vlasenko1-2/+2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-26Bump version to 1.32.01_32_0Denys Vlasenko1-1/+1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-25gzip -d with zcat enabled but gunzip disabled was misbehavingDenys Vlasenko1-1/+1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24make_single_applets.sh: switch off nologin deps optionDenys Vlasenko1-0/+2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24bc: placate a "defined but not used" warningDenys Vlasenko1-0/+2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24nologin: make it possible to build it as single appletDenys Vlasenko5-64/+110
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24suppress a few compile warningsDenys Vlasenko2-2/+2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24randomconfig fixesDenys Vlasenko3-2/+6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko6-6/+31
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixDenys Vlasenko1-0/+4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko1-0/+1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko2-1/+5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23randomconfig fixesDenys Vlasenko2-0/+4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-21ash: skip NULL argv during forkshellRon Yorston1-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.
2020-06-21examples/udhcp/simple.script: fix IPv6 support when using udhcpcStefan Agner1-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>
2020-06-21udhcpc6: use correct multicast MACUwe Glaeser1-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>
2020-06-20ash: changes to ctrl-c handlingRon Yorston1-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.
2020-06-20ash: run ash_main() directly from a FS_SHELLEXEC shellRon Yorston1-3/+6
2020-06-20ash: reduce forkshell block size for FS_SHELLEXECRon Yorston1-25/+46
It isn't necessary to pass the alias table or line editing history to a forkshell shell that's handling FS_SHELLEXEC.
2020-06-20ash: reduce forkshell block size for FS_OPENHERERon Yorston1-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.
2020-06-20ash: forkshell code shrinkRon Yorston1-18/+8
Don't pass global pointers to forkshell_size()/forkshell_copy() via the forkshell structure, just reference them directly.
2020-06-14win32: enable globbing by defaultRon Yorston5-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.)
2020-06-12win32: minor improvements to process spawningRon Yorston1-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.
2020-06-10nmeter: add %T (zero-based timestamp) formatDenys Vlasenko1-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>
2020-06-10Makefile.flags: restrict Wno-constant-logical-operand and ↵Biswapriyo Nath1-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>
2020-06-09deluser: check if specified home is a directory before removing itSören Tempel1-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>
2020-06-09dhcpc: refactor xmalloc_optname_optval to shrink binary sizeMartin Lewis2-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>
2020-06-09ash: treat all applets as NOEXECRon Yorston2-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.