| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
POSIX mentions some restrictions on whether rules may or may not
have prerequisites or commands:
- most special targets shouldn't have commnds;
- inference/.DEFAULT rules shouldn't have prerequisites.
Enforce these restrictions in POSIX mode.
Generally, implementations are happy to accept prerequisites or
commands even if they're subsequently ignored. Allow this as an
extension.
Adds 216-256 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The POSIX standard allows inference rules to be redefined but not
the .DEFAULT rule. There is no explicit exception for .DEFAULT to:
Only one target rule for any given target can contain commands.
Treat redefinition of a .DEFAULT rule as an error in POSIX mode
but allow it as an extension.
Also, the code didn't allow an inference rule with dependencies to
redefine an existing inference rule. This is no longer the case.
Adds 64-96 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit e90345c10 (make: allow empty commands) changed how empty
commands are handled. This broke the POSIX mode test for
inference rules of the form:
rule: ;
Adjust the setting of 'semicolon_cmd' to the new reality.
Adds 16-32 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to POSIX:
Blank lines, empty lines, and lines with <number-sign> ('#')
as the first character on the line are also known as comment
lines.
Most implementations also include lines where the first non-blank
character is '#'. Allow this as an extension.
Adds 0-16 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Running 'make thing.z' with the following makefile:
.SUFFIXES: .x .y .z
.x.y:
cp $< $@
.y.x:
cp $< $@
.y.z:
cp $< $@
resulted in infinite recursion and a segfault. Follow GNU make and
don't allow any implicit rule to appear more than once in a chain.
Adds 16-32 bytes.
|
|
|
|
|
|
|
|
| |
As an extension have pdpmake look for the file 'PDPmakefile' before
'makefile' and 'Makefile'. This is similar to how GNU make first
checks for 'GNUmakefile'.
Adds 32-40 bytes.
|
|
|
|
| |
PPID is no longer fake.
|
|
|
|
|
|
|
|
|
| |
If a process performing an exec is an orphan there's no reason for
it to wait for its child's exit code. Let it exit immediately.
Adds 16 bytes.
(GitHub issue #461)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'kill -9' was found to fail with an 'Invalid argument' error.
This is a regression introduced by commit 569de936a (kill: killing
a zombie process should fail).
Use the correct argument to OpenProcess() for SIGKILL so it can
query the exit code of the target process.
Adds 16 bytes.
(GitHub issue #465)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It proved to be almost impossible to interrupt a loop like:
while true; do sleep 1; done
where 'sleep' was an external program, not an applet. The issue
was introduced by commit 0475b7a64 (win32: convert exit codes).
This passed a POSIX error code to the exit() in wait_for_child()
so a parent was unable to detect when its child was interrupted.
Pass the Windows exit code to exit() instead. Work around the
changes introduced by commit 790e377273 (win32: revert 'don't set
error mode').
Adds 16-32 bytes.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When mingw_chdir() was introduced it canonicalised its argument
(585d17d26). This had the side effect of making its case match
that of the directory as stored on disk. Subsequent changes
retained that behaviour for symlinks but not otherwise (69d328022,
b99032390). This was noted to affect the appearance of the
directory specified by the (undocumented) 'sh -d' option.
Fix the case of non-symlink directories too.
Adds 16-32 bytes.
|
|
|
|
|
|
|
|
| |
The bogus user/group ids we use on Windows are very limited.
Make these limitations explicit in the 'id' applet.
Saves 464 bytes.
|
|
|
|
|
|
|
|
| |
Since we don't use is_in_supplementary_groups() there's no need for
the cached_groupinfo structure to include the members required for
its support or for them to be initialised.
Saves 32 bytes.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
hexdump_main 366 383 +17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
find_executable_in_PATH - 67 +67
if_command_vV_print_and_exit 114 116 +2
.rodata 105712 105710 -2
builtin_type 137 128 -9
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/2 up/down: 69/-11) Total: 58 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
While at it, correct "type" to skip non-executable files in PATH
function old new delta
builtin_source 211 316 +105
builtin_test 10 32 +22
hush_main 1150 1170 +20
builtin_type 122 137 +15
if_command_vV_print_and_exit 120 114 -6
find_in_path 131 - -131
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/1 up/down: 162/-137) Total: 25 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.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
nexpr 702 725 +23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
test_main2 - 407 +407
testcmd 10 23 +13
test_main 418 56 -362
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 420/-362) Total: 58 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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
executable
Upstream commit:
Date: Fri, 5 Apr 2024 17:55:46 +0800
exec: Check executable bit when searching path
Andrej Shadura <andrew.shadura@collabora.co.uk> wrote:
...
> https://bugs.debian.org/874264
> -------- Forwarded Message --------
> Subject: dash: 'command -v' mistakenly returns a shell script whose
> executable is not set
> Date: Mon, 04 Sep 2017 10:45:48 -0400
> From: Norman Ramsey <nr@cs.tufts.edu>
> To: Debian Bug Tracking System <submit@bugs.debian.org>
...
> I tracked a build bug in s-nail to a problem with dash. Symptom:
> building s-nail tries to run /home/nr/bin/clang, a script whose
> executable bit is not set. We tracked the problem to the result of
> running `command -v clang` with /bin/sh:
...
This is inherited from NetBSD. There is even a commented-out
block of code that tried to fix this.
Anyway, we now have faccessat so we can simply use it.
function old new delta
test_exec - 125 +125
find_command 911 918 +7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 132/0) Total: 132 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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
From dash:
From: herbert <herbert@gondor.apana.org.au>
Date: Wed, 2 Mar 2005 22:14:54 +1100
Invert return value of test_eaccess and rename it to test_st_mode.
function old new delta
nexpr 800 766 -34
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
nexpr 813 800 -13
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- The CAN netlink interface has been added in Linux v2.6.31 with only 3 options [1]:
CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */
CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */
CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */
So define the other options.
- IFLA_CAN_TERMINATION has been added in Linux 4.11 [2],
define it for older kernels.
[1] https://github.com/torvalds/linux/blob/v2.6.31/include/linux/can/netlink.h#L80-L82
[2] https://github.com/torvalds/linux/commit/12a6075cabc0d9ffbc0366b44daa22f278606312
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Change the 'flags' argument to shellexec()/tryexec() so it only
indicates that it's permissible to run ash_main() directly. The
flag is only set TRUE in forkshell_shellexec().
- The check for a script with an interpreter which is an applet is
now performed for all calls to tryexec(), not just those that
originate from evalcommand().
Saves 64-80 bytes.
GitHub issue #461.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It was noted this command didn't work properly:
su -t -c 'exec sh -s -c "echo 123"'
The child shell performed the 'echo' but then exited, despite the
'-s' flag. This is a regression introduced by commit 074ebfca21
(ash: code shrink).
This simpler command also failed the same way:
sh -c "exec sh -s"
This regression dates back even further, to commit da7c8cdf63
(ash: run ash_main() directly from a FS_SHELLEXEC shell).
The issue can be avoided if shells invoked by the 'exec' builtin
aren't run by calling ash_main() directly.
Adds 80-96 bytes.
GitHub issue #461.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Reduce the divergence from upstream in the usage messages for
timeout and pipe_progress.
This only affects the source; there are no visible of functional
changes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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)
|
|\| |
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 64f70cc755 (Add --login support) added code in options()
to handle the bash-compatible '--login' option. In doing so it
committed BusyBox ash to silently accepting all other long
options.
Restore compatibility with other ash variants by rejecting unknown
long options.
function old new delta
options 589 624 +35
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When text is inserted by insertLine() the lines following the
insertion are moved down and the insertion point is made the new
current line. To avoid too much scanning of the linked list of
lines setCurNum() may use the position of the old current line to
determine the location of the new current line.
If the insertion point is before the old current line in the file
the latter will have been moved down, so its line pointer needs to
be adjusted.
function old new delta
insertLine 162 180 +18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 18/0) Total: 18 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When `fstat` fails, `st` is left uninitialised. In our case, Ben Kohler
noticed our release media builds were failing in Gentoo on x86 when building
busybox with occasional SIGBUS. This turned out to be EOVERFLOW (from 32-bit
ino_t) which wasn't being reported because nothing was checking the return value
from `fstat`.
Fix that to avoid UB (use of uninit var) and to give a more friendly
error to the user.
This actually turns out to be fixed already in the kernel from back in
2010 [0] and 2016 [1].
[0] https://github.com/torvalds/linux/commit/a3ba81131aca243bfecfa78c42edec0cd69f72d6
[1] https://github.com/torvalds/linux/commit/46fe94ad18aa7ce6b3dad8c035fb538942020f2b
Reported-by: Ben Kohler <bkohler@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
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>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Recent binaries released on frippery.org use the time of the
latest commit as the build time. This is achieved through the
SOURCE_DATE_EPOCH environment variable, which is respected by
the upstream BusyBox build system.
The sample build scripts have been updated to do the same. This
doesn't result in perfectly reproducible builds as the toolchains
used don't all support SOURCE_DATE_EPOCH.
Add some more details to the README file.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A command like 'cut -f1 -s' would print empty lines even though
they don't contain a delimiter.
Add a test to avoid this.
Based on a submission to the upstream mailing list:
http://lists.busybox.net/pipermail/busybox/2024-July/090834.html
Adds 32 bytes in 32-bit build, saves 32 in 64-bit.
(GitHub issue #459)
|
| |
| |
| |
| |
| |
| |
| |
| | |
With CONFIG_DEBUG_PESSIMIZE=y (-O0) the ffs intrinsic is left as a
function call, resulting in a linker error. The prefixed builtin is
generally part of the "GNU C" dialect and is usable in any "GNU C"
implementation, i.e. any compiler that defines __GNUC__. That includes
Clang, GCC, and more.
|