| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 68ddd4ec3c (win32: emulate SIGPIPE) allowed broken pipes
to be detected so that processes could either return EPIPE or
terminate.
Later, commit 1b2ee3667 (win32: add fake HUP and QUIT signals)
added support for two additional fake signals, thus allowing the
'kill' applet to refer to them by name and the shell to define
(though not execute) traps for them.
Add PIPE to the list of signals known to 'kill' and the shell,
though still without support for calling the trap function.
(GitHub issue #482)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The specification of inference rules in POSIX implies that only
suffixes starting with a period and containing no other periods
are to be considered.
In contrast, both GNU and BSD make allow suffixes to contain an
arbitrary number of periods, or none at all. Allow this as an
extension.
Adds 640-816 bytes.
(pdpmake GitHub issue 70)
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
packed_usage 34901 34934 +33
cut_main 1353 1339 -14
.rodata 105724 105685 -39
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 33/-53) Total: -20 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fix bug introduced in busybox 1.37.0 that broke kernel builds.
Fixes commit e2287f99fe6f (od: for !DESKTOP, match output more closely
to GNU coreutils 9.1, implement -s)
function old new delta
rewrite 967 976 +9
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When getopt32() has complementary options it's possible to specify
the minimum and maximum number of arguments allowed. Checking
these values was inconsistent:
- '?' correctly checked that it was followed by a digit but set
the otherwise unused spec_flgs variable on error.
- '=' failed to check that it was followed by a digit.
function old new delta
vgetopt32 1307 1319 +12
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
The bogus user/group ids we use on Windows are very limited.
Make these limitations explicit in the 'id' applet.
Saves 464 bytes.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This allows to simplify "which" applet code
function old new delta
find_executable 93 111 +18
which_main 191 177 -14
builtin_source 316 294 -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 18/-36) Total: -18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Recent upstream changes to file permission tests added a function
to check and cache values in the supplementary group list.
The implementation of getgroups() in the Windows port adds no
useful information beyond what can be obtained by checking the
current effective gid, which all callers of the new function
already do. The function can be replaced with a simple 'FALSE'.
Saves 232-288 bytes.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Testcase:
setuidgid 1:1 strace ash -c 'test -x TODO; test -x TODO; echo $?'
should show that second "test -x" does not query ids again.
function old new delta
ash_main 1236 1256 +20
get_cached_euid - 19 +19
get_cached_egid - 19 +19
test_main 56 72 +16
test_exec 119 135 +16
is_in_supplementary_groups 52 57 +5
nexpr 718 702 -16
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/1 up/down: 95/-16) Total: 79 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
is_in_supplementary_groups 54 52 -2
nexpr 721 718 -3
test_exec 125 119 -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-11) Total: -11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
is_in_supplementary_groups - 54 +54
nexpr 766 721 -45
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 54/-45) Total: 9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
fixes non i386 and x86 builds
libbb/hash_md5_sha.c: In function 'sha1_end':
libbb/hash_md5_sha.c:1316:35: error: 'sha1_process_block64_shaNI' undeclared
1316 | || ctx->process_block == sha1_process_block64_shaNI
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Try to run a non-existent command with standard error closed:
xyz 2>&-
In recent versions of busybox-w32 this resulted in problems with
moving through history (either using up/down keys or ctrl-r) and
tab completion. In all cases the order of the prompt and the
command were reversed.
Bisection showed the problem was first seen in PRE-5396 which
merged some commits from upstream, including fd47f0567 (lineedit:
print prompt and editing operations to stderr).
This (eventually) called to mind a previous problem with stderr
in xargs which was fixed by commit f192e6539 (xargs: fix 'xargs
-sNUM' tests). In both cases it seemed that mixing calls to
bb_putchar_stderr() and fprintf(stderr, ...) was at fault. The
former uses a file descriptor while the latter uses a stream. It
was almost as if the stream was buffered.
- The problem with xargs affected 32-bit and 64-bit builds with
MSVCRT.
- The problem with '2>&-' only affected 32-bit builds with MSVCRT.
- Neither problem was present with UCRT builds.
As a workaround change bb_putchar_stderr() to use the stderr stream
in builds for MSVCRT.
Saves 16 bytes in the 32-bit build.
(GitHub issue #460)
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit fd47f0567 (lineedit: print prompt and editing operations
to stderr) changed various print statements to output to stderr.
The change in show_history() caused the shell history builtin to
send its output to stderr.
Revert that part of the commit.
function old new delta
show_history 47 42 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5) Total: -5 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
POSIX generally requires normal output to go to stdout and
diagnostic (i.e. error) output to go to stderr.
When usage messages for BusyBox applets are specifically requested
by the user (e.g. 'find --help') they should go to stdout; when
they're emitted due to an error they should go to stderr.
function old new delta
bb_show_usage 148 146 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-2) Total: -2 bytes
Signed-off-by: Avi Halachmi <avihpit@yahoo.com>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There are two calls to dup2() in busybox_main(). These were
introduced to coerce full_write2_str() into writing to stdout.
The relevant commits were: 21278dff7 (busybox: do not print help
to fd 2, print it to fd 1) and 5a7c72015 (busybox --list option.
+140 bytes. Rob wanted it.)
Later, in commit 729ecb87b (bbconfig: make it independent from
printf functions), the function full_write1_str() was added.
Using this in busybox_main() allows us to drop the dup2() calls.
function old new delta
run_applet_and_exit 796 760 -36
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-36) Total: -36 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
save_history 267 266 -1
hush_exit 98 97 -1
exitshell 140 138 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-4) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 1ade2225d2 (winansi: allow alternative screen buffer to be
disabled) added a workaround for the broken alternative screen
buffer in the Wine console.
The problem has been fixed in Wine for well over a year:
https://bugs.winehq.org/show_bug.cgi?id=54287
Remove the workaround.
Saves 80-96 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 4b7b4a960 (ash: optimise running of scripts) avoided creation
of a process when running a script. There's another case where we
can do the same: if the script is being run from a FS_SHELLEXEC
shell.
- Check the necessary conditions for this to happen.
- Allocate two extra slots in the argv array for FS_SHELLEXEC.
- Set the index of the script file in the argv array. Without this
the test 'pidof this' failed because the command name hadn't been
correctly set.
Adds 80-96 bytes.
|
| |
| |
| |
| |
| | |
Add the FAST_FUNC qualifier to several Windows-specific functions.
This has no effect in 64-bit builds but saves 336 bytes for 32-bit.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit fd47f0567 (lineedit: print prompt and editing operations
to stderr) changed various print statements to output to stderr.
The change in show_history() caused the shell history builtin to
send its output to stderr.
Revert that part of the commit.
Saves 16 bytes.
(GitHub issue #433)
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The check for result hash size was buggy for CONFIG_SHA1_HWACCEL=y.
While at it, document CPUID use a bit better.
function old new delta
get_shaNI - 28 +28
sha1_end 66 79 +13
sha256_begin 83 60 -23
sha1_begin 111 88 -23
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/2 up/down: 41/-46) Total: -5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A previous commit (e3bfe3695) revised the use of getsysdir() to
obtain the system directory, and hence the system drive. See the
commit message for the history to that point.
Further improvements are possible:
- Remove getsysdir() and push the calls to GetSystemDirectory()
down into get_system_drive() and get_proc_addr().
- Check the return value of GetSystemDirectory(). It's unlikely
to fail, but better safe than sorry.
- Instead of making all callers of get_system_drive() check for a
NULL return value always return a non-NULL pointer. If the drive
can't be found an empty string is returned instead (which is what
the callers were using anyway).
- The function need_system_drive() was only used in one place (in
httpd). Move the code there and remove the function.
- Use concat_path_file() where possible.
Saves 76-144 bytes.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Although "naive" counting function is not too slow and is smaller,
using it on e.g. each of 1024 words of CPU mask feels wrong.
function old new delta
bb_popcnt_32 - 52 +52
get_prefix 323 321 -2
nproc_main 206 199 -7
d4_run_script 739 731 -8
ipcalc_main 533 507 -26
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/4 up/down: 52/-43) Total: 9 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
get_malloc_cpu_affinity - 76 +76
nproc_main 216 206 -10
process_pid_str 250 206 -44
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/2 up/down: 76/-54) Total: 22 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For shells, this is mandated by standards
function old new delta
input_backward 215 231 +16
read_line_input 3015 3028 +13
draw_custom 66 78 +12
put_cur_glyph_and_inc_cursor 149 159 +10
put_prompt_custom 47 56 +9
show_history 40 46 +6
input_tab 927 933 +6
input_delete 136 142 +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/0 up/down: 78/0) Total: 78 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| | |
Rewrite the test for the value of BB_CRITICAL_ERROR_DIALOGS.
Saves 16-48 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If the environment variable BB_CRITICAL_ERROR_DIALOGS is set to
1 critical error dialogs are enabled. If unset or set to any
other value they aren't. In either case the error messages
introduced by commit 790e37727 (win32: revert 'don't set error
mode') are issued.
The shell exports BB_CRITICAL_ERROR_DIALOGS to the environment
immediately on any change so the setting takes effect at once.
Adds 104-160 bytes.
(GitHub issue #423)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit eb376b5d1 (win32: don't set error mode) removed a call to
SetErrorMode(SEM_FAILCRITICALERRORS).
But the documentation says:
Best practice is that all applications call the process-wide
SetErrorMode function with a parameter of SEM_FAILCRITICALERRORS
at startup. This is to prevent error mode dialogs from hanging
the application.
Doing this prevents the system from displaying useful information,
though. The application should attempt to tell the user what went
wrong.
Reinstate the call to SetErrorMode() and try to provide an error
message, at least for the situation mentioned in issue #423 and
other similar cases.
Adds 360-368 bytes.
(GitHub issue #423)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit a8c63f25b3 (win32: improve filesystem detection and display)
added a call to SetErrorMode(SEM_FAILCRITICALERRORS). This was
on the strength of the documentation for GetVolumeInformation()
which suggests that otherwise a message box will appear to prompt
the user to put media in an empty floppy or CD drive. This would
disrupt the expected behaviour of applets like 'df'.
In practice it seems the call to SetErrorMode() is unnecessary.
It also results in other errors going unreported.
Remove the call to SetErrorMode().
Saves 8-20 bytes.
(GitHub issue #423)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In recent versions of Windows the PATH environment variable has
a trailing semicolon. This is insignificant to Windows because
it's ignored. busybox-w32 conforms to the POSIX interpretation
of PATH which treats an empty path element as denoting the current
directory. As result, on these versions of Windows executables
may by default be run from the current directory, contrary to
usual Unix practice.
Attempt to detect and remove the trailing semicolon on applet
start up. If the user insists, they can add a trailing semicolon
to the shell variable PATH and it will be respected in the
conventional manner.
Adds 88-112 bytes.
(GitHub issue #422)
|
| |
| |
| |
| |
| |
| |
| |
| | |
Allow the default history size (used if HISTFILESIZE isn't set)
to be configured at build time. This may be less than or equal
to the standard history size.
(GitHub issue #411)
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Keep the maximum history size at 1023 but make the default 383.
This gives a modest increase over the previous default of 255
while allowing users to increase or decrease the history size
using the HISTFILESIZE environment variable.
(GitHub issue #411)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
interval, in_interval_table, and in_uint16_table were previously
not compiled when using the new wcwidth (commit c188a345a) because
they're used by the old wcwidth but not by the new one.
But they're also used by the BIDI routines. mingw64u_defconfig doesn't
enable bidi (rightly - it's not working well), but it'd still be nice
to allow enabling bidi while the new wcwidth is in effect.
Enable the tables lookup code if BIDI is enabled.
|
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 878b3cd27fe83f2b0ff476b884c34d165be0072c.
It's no longer required, since the last commit uses a new wcwidth
implementation which covers the cases added by commit 878b3cd2 .
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit adds a new wcwidth implementation at libbb/wcwidth_alt.c,
and uses it instead of the existing implementation when compiling for
windows and CONFIG_LAST_SUPPORTED_WCHAR >= 0x30000 - which is the case
with the unicode configs/mingw64u_defconfig.
The windows-target condition keeps non-windows build unmodified, and
the last supported wchar threshold is a semi-hack to allow switching
between implementations without adding a new config option (the old
code supports codepoints up to 0x2ffff).
The new file wcwidth_alt.c was generated by a new scripts/mkwcwidth,
which prints a wcwidth implementation using latest unicode data from
a local clone of https://github.com/jquast/wcwidth . This repo is the
main python wcwidth implementation, and is maintained and up to date.
Functional differences from the existing implementation:
- Unicode 15.1.0 (latest) with the new version (about 450 ranges of
wide and zero-width codepoints), compared to roughly Unicode 5.0
of the existing code (nearly 20 years old spec, about 150 ranges).
The new spec includes, among others, various wide icons and emojis,
which can now be edited correctly at the shell prompt, have correct
alignment in 'ls', etc.
- The old implementation returns -1 (non-printable) for surrogates,
while the new code returns 1, though this is inconsequential, and
POSIX doesn't care. Also libc implementations vary in this regard.
Technical differences:
- The old version compiles less code/data when the last supported
wchar is smaller, while the new version doesn't. This doesn't
matter because the new version is enabled only for the full range.
- The new version is smaller and relatively straight forward, and
fully automated (generated), so updates to newer spec is trivial.
The old version mixes data, ad-hoc code (tailored to the data),
and preprocessor checks, and is hard to automate updates.
The old version has various forms of 32 and 16 bit data ranges, in
several arrays, while the new version uses single data array with
unified form of 32 bits per range, with two rules:
- A data range can't span Unicode planes (enforced, but unlikely
required, and if yes, code to split ranges would be simple).
- A range can't hold more than 32768 codepoints, so bigger ranges
are split automatically (currently there are 2 such ranges).
Performance wise, the new version should be faster, even with three
times the data ranges. Both versions do effectively at most one binary
search in one Unicode plane data, but the new version finds both
zero-width and wide-width results in this one search, while the old
version only finds zero-width, and to detect wide-width it does an
additional linear series of manual range tests, but since most results
are width 1, this sequence is performed in most (non-ASCII) calls.
In a cursory comparison of the new wcwidth with glibc and musl-libc
(both use O(1) lookup tables), with few bodies of text, we're in the
same ballpark, with typical speed of 60% or better.
Bloat-wise, the new version is about 180 bytes code and 1800 bytes
data. If it had similar number of data ranges as the old code (150),
the new version would be about 200 bytes smaller, but because the
new version has 450 data ranges, it's about 1K bigger.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The last two commits allow EXTRAVERSION to track the current state
of a git repository. The build system was unable to determine
which files were affected by changes to EXTRAVERSION and caused
a full rebuild when it changed.
Alter how the version information is passed to the code so only
a handful of files need to be rebuilt when it changes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In the Microsoft Windows build stat(1) requires find_mount_point()
from libbb. This won't be available unless df(1) is also enabled.
Add a dependency so stat(1) can be built without df(1). This may
result in find_mount_point() being compiled needlessly in some
upstream builds, but we can live with that.
(GitHub issue #385)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Rename some functions to be more meaningful.
- Adjust conditional compilation to clarify which code is required
for 'standalone shell' and 'exec prefers applets' settings.
This shouldn't result in any change to the behaviour or size of
default builds.
|
| |
| |
| |
| |
| |
| | |
In external_exists() in appletlib.c it's necessary to take a copy
of the pointer to the allocated variable path1 so it can be freed:
find_executable() will change its value.
|
| |
| |
| |
| |
| |
| |
| | |
The conditional compilation to control standalone shell mode was
incorrect when building for POSIX. This hadn't been noticed before
as it had only been tested in the default configuration where
standalone shell mode is disabled.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The GCC documentation points out that the stdcall attribute doesn't
apply to functions which take a variable number of arguments. GCC
is silent about this during compilation but clang complains noisily.
Remove FAST_FUNC from all variadic functions. This has no effect
whatsoever on the binary resulting from a default 32-bit build.
Signed-off-by: Ron Yorston <rmy@pobox.com>
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 8ade494aeb (win32: add support for virtual terminal input)
made some changes to how input is handled in the line editing code.
In some circumstances (e.g. 'cat | sh -i') this results in input
being read using fgets(3) rather than from the keyboard. Remove
CRs from input in this case.
Also, use fgets(3) if stdin is not a tty, but not stdout.
|