| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
|
|
| |
- Use CRLF line endings in manifest file.
- Add '-b' option to sed command to insert version in manifest file.
|
|
|
|
|
| |
Add a manifest to declare the requested execution level of the
busybox-w32 executable.
|
|
|
|
|
|
| |
When the process architecture of busybox-w32 didn't match that of
the target process the error reported was 'Function not implemented'.
Change this to 'Permission denied'.
|
|
|
|
|
| |
The implementation of realpath(3) is based on code by Stuart Dootson
(studoot on GitHub).
|
|
|
|
|
| |
Now that we're calling memset to clear data for each process it's
no longer necessary to zero the process times by hand.
|
|
|
|
|
|
|
|
|
|
|
|
| |
popen uses an array of pipe_data structures to record information
that's later used by pclose. pclose releases the structure after
use.
The lower-level pipe function mingw_popen_fd was also using this
array of structures but didn't provide any way to release them.
Avoid this leak by letting mingw_popen_fd use a local structure
instead.
|
| |
|
|
|
|
|
| |
The code to manipulate terminal settings serves no purpose in WIN32.
Use conditional compilation to exclude much of it.
|
|
|
|
|
|
| |
Move the wait for timeout into the while loop of read_key. Otherwise
the timeout won't be checked after any event that doesn't result in
a value being returned.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove the code which passed applet names to child processes using
environment variables. This only allowed ps to display names for
its ancestors.
Instead attempt to read applet names from the memory of unrelated
processes.
The Microsoft documentation alone wasn't enough to figure out how
to do this. Additional hints from:
https://stackoverflow.com/questions/4298331/exe-or-dll-image-base-address
https://stackoverflow.com/questions/14467229/get-base-address-of-process
|
|
|
|
|
|
|
|
| |
- move winansi_get_terminal_width_height from winansi.c to ioctl.c,
the only caller;
- check both stdout and stderr for a connection to a console;
- omit unnecessary code in get_terminal_width_height (because the
WIN32 implementation ignores the file descriptor).
|
|
|
|
|
| |
Don't treat input and output file descriptors differently: if we
aren't connected to a console GetConsoleMode will fail for either.
|
|
|
|
|
|
|
|
|
|
|
| |
The exit status from _cwait wasn't being correctly returned. This
resulted, for example, in the exit status of xargs being incorrect.
Running this:
$ ls | xargs ls
in a directory containing filenames with spaces should cause 'ls' to
fail and 'xargs' to return an exit status of 123.
|
|
|
|
|
|
|
|
| |
In the recently-added code to pass applet names to child processes use
local arrays to build the environment variables rather that allocating
them every time.
mingw_spawn can call mingw_spawn_proc instead of mingw_spawn_1.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In standalone shell mode all busybox-w32 applets are displayed as
'busybox.exe' in a process listing.
I haven't found a satisfactory way to query a running instance of
busybox-w32 to determine which applet it's running. Handle a couple
of cases:
- the process running the process scan knows its own PID and knows
which applet it is;
- just before invoking applet_main set an environment variable whose
name contains the PID and whose value is the current applet name.
Children running a process scan will inherit their parent's environment
and can therefore match the parent's PID to its applet name.
|
|
|
|
|
|
|
|
|
| |
The original procps_scan function takes care to clear the status
information before handling each process. Do the same for the
WIN32 version.
This requires moving the snapshot handle to the part of the structure
that isn't cleared on each iteration.
|
|
|
|
|
|
|
|
|
|
| |
If icons are enabled we might as well store some version information.
The string manipulation is based on this:
https://stackoverflow.com/questions/8540485/how-do-i-split-a-string-in-make
Closes issue #108.
|
|
|
|
|
|
|
|
|
| |
The names of the callbacks to kill processes with a given signal were
confusing because they referred to the implementation rather than
the intent.
Create the new function kill_SIGTERM_by_handle which is more efficient
when a handle to the process to be killed is already available.
|
|
|
|
|
| |
Include two styles of icon from the GNOME Adwaita theme. These
are enabled by default and add 30 Kbytes to the size of the binary.
|
| |
|
|
|
|
|
|
| |
Allow either ISAAC or the shell's built-in pseudo-random number
generator to be used for /dev/urandom. The latter is smaller so
it's the default.
|
| |
|
|
|
|
|
|
|
|
| |
Reduce the size of the binary by about 32 bytes:
- use xzalloc to allocate static buffers so we don't have to
initialise them;
- avoid duplicated code in spawnveq.
|
|
|
|
|
|
|
|
|
|
|
| |
Moving detection of file formats from access(2) to stat(2) in
commit 650f67507 was acknowledged to slow down stat. One
problematic case is c:/windows/system32 which contains about
2000 DLLs and was found to slow 'ls' unacceptably.
Treat DLLs as a special case in has_exec_format.
See GitHub issue #101.
|
| |
|
|
|
|
|
|
|
|
|
| |
Reading the attributes of files like c:/pagefile.sys fails with
error code ERROR_SHARING_VIOLATION, which breaks 'ls'.
If this happens try an alternative API call to get the attributes.
See GitHub issue #101.
|
|
|
|
|
|
|
|
|
| |
Make mingw_popen_fd sufficiently general that it can be used to
implement the other two popen routines.
mingw_popen now just creates a command line and passes it to
mingw_popen_fd. The one call to mingw_popen2 has been replaced
by a call to mingw_popen_fd.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow wget to support https URLs. Changes are:
- Add mingw_popen2 which uses a named pipe to allow bidirectional
communication with a child process;
- Modify ssl_client to accept a WIN32 handle instead of a file
descriptor as an argument;
- Allow tls_get_random to open /dev/urandom;
- Using the above changes implement a WIN32 version of spawn_ssl_client
in wget.
This closes GitHub issue #75.
Also, enable authentication in wget.
|
|
|
|
|
| |
Since device files are now handled in mingw_open there's no need
for any special treatment in ash redirection.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Handling of the special devices /dev/zero and /dev/urandom was
inconsistent:
- they could be used as arguments to 'cat' but not 'od';
- they could not be used in shell redirection.
Restrict the use of these devices to two places:
- as input files to 'dd' with the 'if=' argument;
- internally within 'shred'.
See GitHub issue #98.
|
|
|
|
|
|
|
| |
write(2) is commonly used in applets like cat and tr so we should
check for broken pipes there too.
See issue #99.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Microsoft Windows doesn't support SIGPIPE and its support for the
EPIPE error is somewhat inadequate. Most of the time a broken pipe
leads to an EINVAL error which is misleading:
$ yes hello | head -1
hello
yes: Invalid argument
Add a function to test for the underlying Windows error that indicates
a broken pipe and set errno to EPIPE. Call this function in a few
strategic places.
|
|
|
|
|
|
|
| |
Rewrite winansi_puts using winansi_fputs and putchar. There's no
need to use winansi_putchar.
Improve error return values from winansi_fputs and winansi_fwrite.
|
|
|
|
| |
Also tighten up the code slightly.
|
| |
|
| |
|
|
|
|
|
|
| |
BusyBox ensures that strchrnul is always available, either from the
target platform or by including its own version. Therefore it isn't
necessary for fnmatch to use its equivalent.
|
|
|
|
|
|
|
| |
It appears that uninitialised static variables are placed in the
data section rather than bss, increasing the size of the binary.
Rewrite some code to reduce the amount of static data.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Exclude source files in libbb that aren't used by busybox-w32. This
speeds up the build marginally. They can always be reinstated if
necessary.
Provide fake routines for everything in inode_hash.c so that it
can be excluded. inode_hash.c is now unchanged from upstream.
Use last_char_is in has_exe_suffix_or_dot. It doesn't save any
bytes but it makes the code neater.
|
|
|
|
| |
The only other caller (in spawnveq) has been removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consistent processing of file extensions, as described in the previous
commit, has been applied to the 'which' applet and the functions
find_executable and mingw_spawn_interpreter.
In spawnveq check that the file to be executed exists and is executable,
and ensure that it won't have any extensions added by spawnve.
It's intended that all files passed to spawnve should have their names
fully specified. If this isn't the case the tests here will cause errors
which will need to be fixed.
|
|
|
|
|
|
|
| |
A filename ending with a dot is a signal to spawnve not to try
adding extensions but to use the name unmodified.
The add_win32_extension function should follow the same rule.
|
|
|
|
|
| |
The has_win_suffix function didn't check that the extension started
with a '.'. As a result the shell was unable to execute cmd.exe.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the code to detect shell scripts and binary executables from
mingw_access to a separate function, has_exec_format. Call this function
in do_lstat to decide whether to set the executable bits in the file mode.
This will slow down stat but has a couple of advantages:
- shell scripts are highlighted in ls output
- the test applet can use stat(2) to detect executable files
The new function is used to handle another corner case in spawnveq:
binary executables without the usual .exe extension are only run by
spawnve if the file name ends with '.'.
Two minor changes:
- file_is_win32_executable has been renamed add_win32_extension to
clarify what it does
- a call to file_is_executable has been removed from find_command
in ash as it resulted in unhelpful error messages.
|
|
|
|
|
|
|
| |
Set all mode bits rather than just setting user modes and then
extending them to group and other.
Combine common code in mingw_fstat.
|
|
|
|
|
|
|
|
| |
Support batch files with .bat and .cmd extensions, similar to
what's done for .exe and .com.
Check extensions in the same order as Windows' spawn function:
.com, .exe, .bat, .cmd.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently /dev/zero is handled as a special case in dd. Add hacks
to the open and read functions in mingw.c to handle the zero and
urandom devices.
- Opening /dev/zero or /dev/urandom actually opens the special
Windows file 'nul' which behaves like /dev/null. This allows
manipulation of the file descriptor with things like seek and
close
- When /dev/zero or /dev/urandom is opened the resulting file
descriptor is stored and used to override the behaviour of read.
- No attempt is made to track duplicated file descriptors, so using
these devices for redirections in the shell isn't going to work
and won't be permitted. (Could be, but won't.)
- Limited control of the special file descriptors is provided by
allowing the internal variables to be changed.
- The numbers from /dev/urandom aren't very random.
|