| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
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.
|
|\ |
|
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In the function find_export_symbols, since the fopen file does not
exit when it fails, there is a dereference problem in fclose(fp),
which will cause a segmentation fault.
Signed-off-by: Yan Zhu <zhuyan2015@foxmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A 32-bit build of BusyBox using clang segfaulted in the test
"awk assign while assign". Specifically, on line 7 of the test
input where the adjustment of the L.v pointer when the Fields
array was reallocated
L.v += Fields - old_Fields_ptr;
was out by 4 bytes.
Rearrange to code so both gcc and clang generate code that works.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
log5() with crondlog(5, msg, va) seems making logging more consistent.
function old new delta
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes
Signed-off-by: Jones Syue <jonessyue@qnap.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
subevalvar 1576 1588 +12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I developed this application to test the Linux kernel series [1]. As
described in it I could not use the iproute2 package since the
microcontroller is without MMU.
function old new delta
do_set_can - 920 +920
packed_usage 34645 34908 +263
get_float_1000 - 164 +164
.rodata 105427 105539 +112
do_iplink 1313 1381 +68
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/0 up/down: 1527/0) Total: 1527 bytes
cc: Marc Kleine-Budde <mkl@pengutronix.de>
[1] https://marc.info/?l=linux-netdev&m=167999323611710&w=2
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
parse_stream 2271 2292 +21
.rodata 105408 105427 +19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 40/0) Total: 40 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
set_G_ifs - 151 +151
run_list 1024 1031 +7
run_pipe 1567 1445 -122
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 158/-122) Total: 36 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
.rodata 105412 105408 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit d6b764116 (make: fix detection of target rules) checked
for target rules before macro assignments. This failed for some
Makefiles generated by autotools because partially defined macros
were expanded while testing for a target rule.
Revert to checking for macro assignments first, but try to detect
if the proposed left hand side of the assignment might form part
of a target rule with an inline command.
Also handle the case where the ';' separator of the inline command
has been obfuscated by putting it in a macro.
Saves 128-160 bytes.
(GitHub pdpmake issues 31, 44)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
GNU make and bmake have different implementations for := macro
assignment. In POSIX 202X these are supported by the forms ::=
and :::= respectively. Only the former was supported on the
pdpmake command line.
Add the required support in process_macros() and update the usage
message.
Adds 48-64 bytes.
|
| |
| |
| |
| |
| | |
The test 'Return error if command fails' needed an exit code of 2.
POSIX only requires an exit code greater than 0.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The -q option returns an exit status to indicate if targets are
up-to-date (0) or in need of updating (1) but without updating
them. As an exception (imported from GNU make) build commands
with a '+' prefix are executed.
pdpmake didn't implement the exception. Doing so required moving
handling of the -q option down into docmds().
Saves 48 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The -t option (in general) causes targets to be touched instead of
having build commands run to create them. There were two problems.
The flag variable 'ssilent' in docmds was too small (uint8_t) to
contain the value of 'dotouch' (uint32_t). Truncation of the
value resulted in build commands being echoed when they shouldn't
have been.
The POSIX specification is unclear as to how build commands with
a '+' prefix interact with touch. The rationale indicates that
this feature was imported from GNU make, so the behaviour has been
made to match what it does: if a '+' build command is run the
target is not touched.
The code has been rearranged to move the call to touch() up into
docmds().
Adds 48 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The default POSIX level to be enforced in strict mode is now a
configuration option.
Print details of supported POSIX levels in the usage message.
Adds 56-64 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The pragma 'posix_202x' causes the 202X POSIX standard to be
enforced in POSIX mode. Add an equivalent 'posix_2017' for the
2017 standard.
There's now a DEFAULT_POSIX_LEVEL preprocessor symbol to configure
the default standard. This is hardcoded to the 2017 standard but
it can also be set to 202X.
Adds 48 bytes.
|
| |
| |
| |
| |
| |
| | |
A couple of tests require backslashes to be escaped.
The test for CURDIR should use 'pwd -P' to resolve symlinks.
|