| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
Return "armv7" in this case.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that a binary with a UTF-8 manifest can run on Windows XP
it's possible to configure a build which supports Unicode on
Windows 10+ but which still runs on legacy systems.
- Add the config file mingw32w_defconfig. This is a 32-bit build
with the UTF-8 manifest which also runs on legacy systems.
- A new config option, FEATURE_FAIL_IF_UTF8_MANIFEST_UNSUPPORTED,
allows the check for legacy systems to be skipped.
- An incompatibility with Windows XP in writeCon_utf8() has been
fixed.
See this GitHub issue for details:
https://github.com/skeeto/w64devkit/issues/315
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
It seems that the UTF-8 manifest can be adjusted to avoid binaries
failing to run on Windows XP.
Make the necessary adjustment. This doesn't affect the legacy
builds, only those with Unicode enabled. Nor does it change the
code which prevents Unicode builds from running on platforms
that don't support the manifest.
See this GitHub issue for details:
https://github.com/skeeto/w64devkit/issues/315
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The implementation of localtime(3) in the Microsoft Windows
runtime only accepts arguments between the Unix epoch (1970)
and either 2038 or 3000 for 32-bit or 64-bit systems respectively.
For values outside those limits it returns a NULL pointer.
Unfortunately, upstream BusyBox hardly ever bothers to check the
return value. Thus, when a call to stat(2) returned an all-zero
FILETIME for a file, the 'stat' applet failed. An all-zero FILETIME
represents a date in 1600, which is clearly before the Unix epoch.
Add a wrapper to localtime(3) which detects an out-of-range value
and returns a valid 'struct tm' for the Unix epoch. This is easier
than adding checks on the return value of every call to localtime(3).
Adds 32-48 bytes.
(GitHub issue #548)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was found that 'mkdir -p --verbose C:/' incorrectly reported
that 'C:/' was created.
Commit 0e0b5e9ff8 (mingw.c: ignore EACCES from mkdir if directory
exists) fixed a failure to create directories but caused the
`mkdir` applet to issue the wrong diagnostic.
The underlying problem is in the Windows runtime implementation
of _mkdir(): it can return the wrong errno in some cases, EACCES
instead of EEXIST.
Having the mkdir(2) wrapper return the correct errno should fix
both the directory creation and verbose diagnostic problems.
The website referenced in the previous commit is no longer
available. archive.org has a copy:
https://web.archive.org/web/20150224075238/http://www.apijunkie.com/APIJunkie/blog/post/2009/12/22/_mkdir-C-runtime-library-function-might-return-unexpected-error-values.aspx
(GitHub issue #546)
|
| |
|
|
|
|
|
|
|
| |
Treat /dev/tty as an alias for Windows' 'con' device. The code
is similar to that used for /dev/null.
Adds 24-48 bytes.
(GitHub issue #538)
|
| |
|
|
|
| |
aterm.png: 2477 -> 2303 (-174 bytes)
sterm.png: 1022 -> 774 (-248 bytes)
|
| |
|
|
|
|
|
|
|
|
|
| |
Convert the icons to PNG format (by simply exporting them from
GIMP and selecting the 'Compressed (PNG)' chackbox). Allow these
to be selected instead of ICO format at build time.
Use the PNG icons by default in the Unicode and aarch64 builds.
Saves 26KB in those cases.
(GitHub PR #540)
|
| |
|
|
|
|
|
|
|
|
| |
It also makes the version number within the manifest use the version
macros, replacing the hard-coded "6.0.0.0".
Unicode: 32668 -> 32188 (-480 bytes)
non-Unicode: 32412 -> 31956 (-456 bytes)
with icons included.
|
| |
|
|
|
|
|
|
|
| |
Setting the console dimensions doesn't work reliably. Drop
support for the 'rows' and 'columns' settings.
Saves 752-768 bytes.
(GitHub issue #58)
|
| |
|
|
|
|
|
|
|
| |
Use the Gnulib implementation of flock(2) to allow the flock
applet to be enabled.
Costs 900-984 bytes.
(GitHub issue #528)
|
| |
|
|
|
|
|
|
|
| |
Use the (somewhat ancient) Microsoft RtlGenRandom() function to
provide random data for /dev/urandom.
Saves 176-240 bytes.
(GitHub issue #519)
|
| |
|
|
|
|
|
|
|
| |
Recent versions of busybox-w32 rely on features which are only
available in contemporary versions of mingw-w64 and gcc.
Allow building on somewhat older toolchains.
(GitHub issue #527)
|
| |
|
|
|
|
|
|
|
|
| |
We already fixed up errno when a directory was opened by open().
Do the same for fopen(). This allows grep to give a more useful
error message when it's asked to open a directory.
Adds 64 bytes.
(GitHub issue #521)
|
| |
|
|
|
|
| |
Apply upstream commit 9b67dde8c.
Adds 8 bytes in the 32-bit build.
|
| |
|
|
|
|
|
|
|
|
|
| |
Changes to the ls applet upstream assumed that the return value of
isatty() followed the C standard and would be 0 or 1. The wrapper
for Windows' _isatty() didn't allow for it returning a non-zero
value for a tty, not 1. This confused ls.
Fix the wrapper.
(GitHub issue #513)
|
| | |
|
| |
|
|
|
|
|
|
| |
The ioctl() to get the size of the terminal windows used functions
which weren't available on Windows XP. Load these dynamically to
avoid failure.
Adds 160 bytes.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement a minimal stty applet for Windows.
- Display and set terminal rows and columns
- Enable/disable raw/cooked mode
- Enable/disable echo mode
- Implement 'stty sane' to reset raw/cooked/echo
Adds 2120-2304 bytes.
(GitHub issue #58)
|
| |
|
|
|
|
|
| |
There were two copies of the static function die_if_error().
Replace these with a single external function.
Saves 16 bytes.
|
| |
|
|
|
|
|
|
| |
Apply gnulib commit 034af0e401 (select, pselect: Fix test failure
on native Windows).
* lib/select.c (rpl_select): Fail if nfds is out-of-range.
* lib/pselect.c (pselect): Likewise.
|
| |
|
|
| |
Changes are mostly cosmetic.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Apply musl commit 7e13e5ae (inet_pton: fix uninitialized memory
use for IPv4-mapped IPv6 addresses).
When a dot is encountered, the loop counter is incremented before
exiting the loop, but the corresponding ip array element is left
uninitialized, so the subsequent memmove (if "::" was seen) and the
loop copying ip to the output buffer will operate on an uninitialized
uint16_t.
The uninitialized data never directly influences the control flow and
is overwritten on successful return by the second half of the parsed
IPv4 address. But it's better to fix this to avoid unexpected
transformations by a sufficiently smart compiler and reports from
UB-detection tools.
Adds 16 bytes.
|
| |
|
|
|
|
|
|
|
|
|
| |
Apply musl commit 79bdacff (glob: fix wrong return code when
aborting before any matches).
when the result count was zero, glob was ignoring a possible
GLOB_ABORTED error code and returning GLOB_NOMATCH. whether this
happened could be nondeterministic and dependent on the order of
dirent enumeration, in cases where multiple matches were present and
only some produced errors.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The emulation of readdir(2) didn't include the '.' and '..'
directories in the root of a logical drive. This resulted in
the 'ls' applet (and others) not matching the expected Unix
behaviour.
Alter the emulation of readdir(2) to include fake '.' and '..'
directories if necessary.
Adds 88-112 bytes.
(GitHub issue #487)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some installer programs have an entry in their manifest to indicate
that they need elevated privileges. The shell in busybox-w32 was
unable to run such programs.
When a program fails to run with ERROR_ELEVATION_REQUIRED, try
again using ShellExecuteEx() with the 'runas' verb to give it
elevated privileges.
Adds 272-288 bytes.
(GitHub issue #481)
|
| |
|
|
|
| |
Compiling with FEATURE_SH_NOFORK disabled resulted in an error and
a warning. Fixing these doesn't change the default build.
|
| |
|
|
|
|
|
|
| |
Alter quote_arg() to perform a single pass over the string in the
case where no change is required. Based on a proposal by @avih in
GitHub PR #317.
Saves 16 bytes.
|
| |
|
|
|
|
|
|
|
|
|
| |
The previous commit removed trailing dots and spaces from the last
component of a pathname when changing directory. If the result has
a trailing slash remove that too. But not if it's a drive root,
to avoid 'cd C:/' showing a current directory of 'C:'.
Adds 48 bytes.
(GitHub issue #478)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Windows API strips trailing dots and spaces from the last
component of a path. cmd.exe handles this quirk when changing
directory by adjusting its idea of the current directory to match
reality. The shell in busybox-w32 didn't do this, leading to some
confusion.
Fix the shell's cd builtin so it works more like cmd.exe.
Adds 64-80 bytes.
(GitHub issue #478)
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A CGI script was found to hang when a large amount of data was
posted:
#!/bin/sh
echo "Content-type: text/plain;"
echo
if [ "$REQUEST_METHOD" = "POST" ]; then
dd of=my.dat bs=1 count=${CONTENT_LENGTH}
echo -n "success."
else
echo -n "error!"
fi
This appears to be due to problems determining whether a pipe is
writable on Windows. The Git for Windows project has a workaround
in their copy of GNUlib's poll(2) implementation. The details are
in the commit message:
https://github.com/git-for-windows/git/commit/94f4d01932279c419844aa708bec31a26056bc6b
Apply the same workaround here.
Saves 220-272 bytes.
(GitHub issue #468)
|
| |
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The BusyBox shell detects certain cases where forking a command is
unnecessary (last command in a script or subshell, for example) and
calls execve(2) instead. This doesn't help in the Windows port
because execve(2) is implemented by creating a process.
There is one case where it is possible to apply this optimisation:
if the command is a script and the script interpreter is an applet.
- Have evalcommand() pass a flag to indicate this situation to
shellexec(). Also, allocate two spare elements before the start
of the argv array.
- If the flag is TRUE shellexec() passes the shell's PATH variable
down to tryexec() so it can perform a test for applet override.
- If tryexec() finds that all the necessary conditions apply it
can run a script by directly invoking the interpreter's main().
Adds 192-224 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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The '%s' format of our strftime(3) wrapper (display number of
seconds since the Unix epoch) returned incorrect results on 64-bit
systems for times more than 2^31 seconds after the epoch.
Use the correct format.
Adds 16 bytes.
(GitHub issue #446)
|
| |
|
|
|
|
|
|
|
|
|
| |
If we can't open a file to preserve its access time (perhaps
because it doesn't belong to us) just try again without bothering
about the access time. I thought I'd already done that, but
that must have been in an alternative reality.
Adds 16 bytes.
(GitHub issue #443)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
When privilege has been dropped by the 'drop' applet, the 'su'
applet is unable to raise it again because ShellExecuteEx()
thinks it unnecessary.
Detect this situation, report an error and return exit code 2.
Costs 72-112 bytes.
(GitHub issue #437)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit f444dc586 (win32: only search PATH for compressor) made
mingw_fork_compressor() perform a PATH lookup for the xz and lzma
compression programs. This avoided relying on CreateProcess() to
perform the search.
Other callers of the pipe creation code should also avoid reliance
on CreateProcess's executable search:
- Move the applet test and PATH lookup into mingw_popen_internal().
The first argument to CreateProcess() will always be a path to
an executable.
- mingw_fork_compressor() uses the new "w+" mode to indicate that
xz and lzma compressors should be found on PATH.
- mingw_popen() no longer needs to check for an applet itself, as
that's now handled in mingw_popen_internal().
- spawn_ssl_client() in 'wget' can rely on the popen code to look
up the 'ssl_client' applet.
- Remove unnecessary argument checks in mingw_popen_internal().
Adds 0-24 bytes.
|
| |
|
|
|
|
|
|
|
|
|
| |
- Replace the half-baked code to quote the command passed to
popen(3) with a call to quote_arg().
- Where the command to be run is a non-overridden applet in the
current binary pass the path to the binary to CreateProcess()
instead of adding '--busybox' to the command.
Saves 128-136 bytes.
|
| |
|
|
|
|
|
| |
Rewrite mingw_spawn_interpreter() to remove a duplicated recursive
call.
Saves 32-48 bytes.
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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.
|