| Commit message (Collapse) | Author | Files | Lines |
|
Pragmas set when pdpmake is run are exported to the environment
variable PDPMAKE_PRAGMAS as a space-separated list of pragma names.
This environment variable is read when pdpmake starts and any
pragmas it contains are applied.
Thus pragmas are passed to recursive invocations of pdpmake.
PDPMAKE_PRAGMAS can also be set by the user.
Adds 240-288 bytes.
|
|
gcc is being rather silly. Usues suboptimal registers,
and does not realize that i and j are never negative,
thus usese even _more_ registers for temporaries
to sign-extend i/j to 64-bit offsets.
function old new delta
sp_256_mont_mul_8 155 132 -23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
gcc does not necessarily clear upper bits in
64-bit regs if you ask it to load a 32-bit constant.
Cast it to unsigned long. Better yet, hand-write loading
of the constant with a smaller instruction.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The coreutils versions of md5sum and the like accept uppercase hex
strings from checksum files specified with the '-c' option.
Use a case-insensitive comparison so BusyBox does the same.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Currently vi assumes that the edit buffer ends in a newline. This may
not be the case. For example:
$ printf test > test
$ vi test
<press 'o'>
We fix this by inserting a newline to the end during initialization.
Signed-off-by: Petja Patjas <pp01415943@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Commit 549deab5a (ash: move parse-time quote flag detection to
run-time) did away with the need to distinguish between backquotes
inside and outside quotes. This left a gap among the control
characters used in argument strings. Removing this gap saves a
few bytes.
function old new delta
.rodata 167346 167338 -8
cmdputs 399 388 -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-19) Total: -19 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Extend the changes introduced by commit b4ef2e3467 (Makefile.flags:
suppress some clang-9 warnings) so they also cover the case where
clang is used as a cross-compiler.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
An alias expansion immediately followed by '<' and a newline is
parsed incorrectly:
~ $ alias x='echo yo'
~ $ x<
yo
~ $
sh: syntax error: unexpected newline
The echo is executed and an error is printed on the next command
submission. In dash the echo isn't executed and the error is
reported immediately:
$ alias x='echo yo'
$ x<
dash: 3: Syntax error: newline unexpected
$
The difference between BusyBox and dash is that BusyBox supports
bash-style process substitution and output redirection. These
require checking for '<(', '>(' and '&>' in readtoken1().
In the case above, when the end of the alias is found, the '<' and
the following newline are both read to check for '<('. Since
there's no match both characters are pushed back.
The next input is obtained by reading the expansion of the alias.
Once this string is exhausted the next call to __pgetc() calls
preadbuffer() which pops the string, reverts to the previous input
and recursively calls __pgetc(). This request is satisified from
the pungetc buffer. But the first __pgetc() doesn't know this:
it sees the character has come from preadbuffer() so it (incorrectly)
updates the pungetc buffer.
Resolve the issue by moving the code to pop the string and fetch
the next character up from preadbuffer() into __pgetc().
function old new delta
pgetc 28 589 +561
__pgetc 607 - -607
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 561/-607) Total: -46 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
It was SEGVing.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
mk_splitter 100 96 -4
as_regex 103 99 -4
parse_expr 991 986 -5
awk_split 544 538 -6
awk_getline 559 552 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-26) Total: -26 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Something is fishy with constrcts like "3==v=3" in gawk,
they should not work, but do. Ignore those for now.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
fmt_num 247 257 +10
evaluate 3385 3379 -6
getvar_s 111 102 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 10/-15) Total: -5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
evaluate 3377 3385 +8
Fixes https://bugs.busybox.net/show_bug.cgi?id=15865
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
parse_chown_usergroup_or_die 115 94 -21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Shell variables imported from the environment are marked with a
special flag and backslashes in their values are (by default)
replaced with forward slashes. Sometimes this may not be what
we want.
Modify the 'export' shell built-in so unexporting a variable of
this type restores its original value from the environment and
removes its special flag. It can then be re-exported.
Adds 32 bytes.
(GitHub issue #428)
|
|
As well as trying to read '/etc/profile' also look for the script
'etc/profile' relative to the location of the running binary.
Adds 64-96 bytes.
|
|
HTTP headers are case insensitive and therefore the check if a default
header has been overwritten needs to be case insensitive.
Without this patch `--header 'user-agent: test'` results in
`User-Agent: Wget` and `user-agent: test` being send.
function old new delta
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes
text data bss dec hex filename
1040876 16443 1840 1059159 102957 busybox_old
1040876 16443 1840 1059159 102957 busybox_unstripped
Signed-off-by: Sertonix <sertonix@posteo.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Now that get_system_drive() no longer returns a NULL pointer on
error chdir_system_drive() needs to check for an empty string
instead.
|
|
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.
|
|
Libtool assumes the host environment is MSYS2 and will be confused by
Windows-style command switches. The "/c" in "cmd /c" looks like a path,
which MSYS2 incorrectly decodes to "c:/". Anticipating this, libtool
encodes these calls as "cmd //c" which does not work outside MSYS2. A
busybox-w32 patch makes it behave like MSYS2 in just this one case.
Adds 88-96 bytes.
(GitHub issue #297 and https://github.com/skeeto/w64devkit/issues/50)
|
|
Some BB_ shell variables get special treatment: they're updated in
the environment immediately on any change. One case was missed:
if such a variable was unset or not exported and was overridden by
a local variable it wasn't unset in the environment when the local
variable went out of scope.
Add the code required to do this.
Adds 48-64 bytes.
(GitHub issue #423)
|
|
The BB_TERMINAL_MODE variable is only documented to work for values
between 0 and 5. Due to an oversight it also accepted the value 6.
Like other unsupported values 6 is now replaced with the default
value configured at build time.
|
|
|
|
Saves 16 bytes.
|
|
Rewrite the test for the value of BB_CRITICAL_ERROR_DIALOGS.
Saves 16-48 bytes.
|
|
The wrapper function 'mingw_open()' should only read the optional
third argument if the 'O_CREAT' flag bit is set.
Adds 16 bytes.
(GitHub issue #425)
|
|
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)
|
|
It was noted that setting HISTFILE=/dev/null in upstream BusyBox
prevented shell history from being saved to a history file. This
failed in busybox-w32 with an error from lseek(2).
The lseek(2) wrapper was rather conservative in the file types it
accepted. Allowing FILE_TYPE_CHAR makes it possible to seek on
/dev/null, thus avoiding the issue with HISTFILE.
In addition, the wrapper for open(2) now converts the Unix-style
mode argument to Windows-style.
(GitHub issue #425)
|
|
Detecting Actually Portable Executable binaries used a longer
signature than seems necessary. Six characters should be enough
for anyone.
When right shifting a byte by 24 bits, cast it to unsigned to avoid
undefined behaviour.
Saves 24-32 bytes.
(GitHub issue #424)
|
|
The default rules were changed in the 2024 standard:
- Fortran is no longer supported
- The CC macro is set to 'c17' instead of 'c99'
In addition to these changes, CC is set to 'cc' as a non-POSIX
extension: on my system, at least, there isn't a 'c17' compiler.
Adds 208-224 bytes.
|
|
Check for the signature of Actually Portable Executable binaries
and treat them as executable.
Adds 40-64 bytes.
(GitHub issue #424)
|
|
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)
|
|
Now that POSIX.1-2024 has been released we can replace all
references to the 202X draft standard with 2024.
Make this change throughout the code and testsuite.
The pragma 'posix_2024' has been added. 'posix_202x' remains as
an alias for the same.
The 2024 standard is enforced by default in POSIX mode.
|
|
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)
|
|
The special target .PRAGMA could be used to set or reset pragmas.
Doing anything other than setting pragmas very early in execution
is likely to be problematic.
Limit the abilities of .PRAGMA:
- Specifying .PRAGMA with no prerequisites now does nothing:
pragmas are not reset.
- The posix_2017 and posix_202x pragmas can only be used to change
the enforced POSIX level from the default. Any further attempt
to change POSIX level results in a warning.
Adds 16-32 bytes.
|
|
Only the forms of macro assignment required by POSIX were allowed
on the command line.
Add support for the non-POSIX := form too.
Adds 16-24 bytes.
|
|
The previous commit failed to change an instance of find_char()
to find_colon().
It isn't necessary to use find_char() to replace find_colon()
in the non-Windows case: strchr(3) is sufficient.
Adds 16-48 bytes.
|
|
Commit f9d10b2b6 (make: fix detection of target rules (take 2))
failed to include the function find_colon() which is used to skip
targets of the form c:/path when checking for a target rule.
Restore the function so Windows paths can be used as targets.
Adds 48 bytes.
|
|
POSIX requires macro assignments to precede targets on the command
line. This requirement has been relaxed as a non-POSIX extension.
Verify the constraint has been applied in POSIX mode. This ensures
that the command:
make --posix target A=1
fails before it tries to update the target.
It also catches the case where POSIX mode had not been set with the
--posix option or PDPMAKE_POSIXLY_CORRECT environment but was then
set by the .POSIX special target in the makefile. In this case the
command line was scanned for macro assignments without enforcing
POSIX mode while targets were processed with POSIX mode enabled.
Adds 96 bytes.
|
|
Only invoke GETOPT_RESET() if getopt(3) has actually been called.
|
|
When using fgets(3) to read a line into a buffer it's necessary
to ensure at least two characters are available in the buffer.
Otherwise the read fails. (At least, it did when pdpmake was
built using MSYS2 on Windows.)
Adds 16 bytes to the 32-bit build.
(GitHub pdpmake issue 44)
|
|
Synchronising with upstream pdpmake showed that a test was missing
from the BusyBox port. POSIX 202X doesn't specify what should
happen if an include statement has no arguments.
When the POSIX 202X standard is being enforced this is reported as
an error.
Adds 32 bytes.
|
|
Commit 90c5352a9 (make: change how macros are read from the
environment) was intended to ignore environment variables with
invalid names. It had the unintended consequence of also ignoring
macros with invalid names defined in makefiles. This was because
such macros can have the same level (3) as those imported from the
environment.
Rather than use the level to detect importing from the environment
add a flag to indicate this circumstance.
|
|
The test 'Complex chain of macro assignments' relies on recursive
macro expansion. This is a POSIX 202X feature, so the test should
be moved to the appropriate section of the test script.
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
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>
|