| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Use external utilities (not supplied!) to support zstd compression
in tar.
Adds 232-256 bytes.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The "nwritten" argument and failure conditions were added in commit
208649d7b5, as it crashed on windows XP without it, and specifically
because WriteConsoleW on XP expects this to be a non-NULL argument.
However, writeCon_utf8 should not be called on XP - and indeed it's
not since commit 234a3b97d3, because it produces incorrect output
unless the UTF8 manifest is in effect - which never happens on XP.
So it was called due to a bug, and it's not called on XP anymore.
Nevertheless, it's possible that in the future we will support native
Windows Unicode without the manifest - also on XP, and in such case
writeCon_utf8 might get called on XP as well, so keep this argument.
However the nwritten failure condition doesn't belong here.
It's not needed on XP, and MS docs doesn't say that this value should
tested in addition to the return value in order to determine failure,
and theoretically there could be differences unrelated to failure.
So ignore this value when determining failure. Return value is enough.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, at writeCon_utf8, when we detected an invalid byte (for
the current state), then we printed one '?' which also covered any
following invalid bytes, until a valid byte for state 0 was detected.
For instance printf '\377\377\377A' printed '?A' (3 bad bytes, 1 '?').
This was by design to avoid excessive '?' noise.
However, other terminals (xterm), and specifically windows console
(and terminal), print one '?' for any decoding error, and also reset
the decoding state after every error.
I.e. the same input would error 3 times, and display '???A'.
Now we do the same, which also happens to simplify the code.
The reference behavior is windows console/terminal in UTF-8 codepage
(which writeCon_utf8 tries to emulate in other console codepages).
To compare, do 'chcp 65001' to set the console to UTF-8 - which also
bypasses writeCon_utf8, and check how the terminal displays some
sequence. We should be the same, up to CONFIG_SUBST_WCHAR value.
The "state" comment is updated since we no longer maintain bad state.
While at it, refine also few nearby comments.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the busybox-w32 binary didn't have an extension the shell was
unable to spawn itself:
$ ls -l busybox
-rwxrwxr-x 1 rmy rmy 661006 Feb 25 09:37 busybox
$ ./busybox sh
$ ls
sh: unable to spawn shell
This happened because the shell used spawnve() from the C runtime
to execute itself. Microsoft insists on trying to add an extension
to the name of the binary unless it has an explicit '.' as its
last character.
Use the internal spawnveq() instead, as it handles various quirks
like the above.
Adds 16-32 bytes.
(GitHub issue #566)
|
| |
|
|
|
|
|
| |
Allow applets to open the "files" /dev/stdin, /dev/stdout and
/dev/stderr. The 'stat' and 'ls' applets pretend they exist.
Adds 48-56 bytes.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before commit 208649d7, when unicode was enabled (utf8 manifest), the
build refused to run unless the manifest was in effect (the codepage
is UTF8, and argv, win APIs, and internal strings are UTF8 too).
That commit, however, allows such build to also run where the manifest
has no effect (prior to win10 1903), and so some of the unicode code
paths behave incorrectly in such cases when the runtime ACP is ANSI.
This commit fixes the UTF8_OUTPUT code path in such case, to also
check ACP, instead of unconditionally printing to the console as UTF8.
When ACP is not UTF8, it now behaves identically to a non-unicode
build (doing output conversion from ACP to console out-CP if needed).
Example: create a filename which is valid in the ANSI codepage with
chars above 127, and do "echo *" (glob expansion), which now prints the
name correctly, but previously it didn't when the build has unicode
enabled at buildtime but not runtime (see next why not just try "ls").
This covers the existing busybox-w32 unicode code paths, as the others
(UTF8_INPUT and unicode-aware editing) already had runtime ACP test,
so unicode _should_ be disabled correctly if the runtime ACP is ANSI.
However, there are also some new upstream unicode code paths which
can be entered now - when unicode is enabled at build time but
disabled at runtime.
One we know of is printable-chars code, which is used by applets like
"ls", and so currently, when unicode is enabled at build time but
disabled at runtime, "ls" displays valid ANSI chars above 127 as "?".
The next commit will address this.
|
| |
|
|
| |
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)
|