| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add an option to allow hard links to be removed.
busybox --uninstall file
removes all hard links to the given file (including the file itself.)
Since Microsoft Windows refuses to delete a running executable a
BusyBox binary is unable to remove links to itself.
busybox --uninstall -n file
displays the names of all hard links to the given file.
Although this feature is couched in terms of uninstalling BusyBox
it's actually quite general: it can be used to delete or display
hard links to any file.
|
|
|
|
|
|
| |
Only the generic function pointer and initialisation flag need to be
in static storage. The DLL and function names and the specialised
function pointer can be local.
|
|
|
|
|
|
|
|
| |
Add the %T format specifier (same as %H:%M:%S) to our emulation
of strftime.
Rewrite so that common code to replace a format specifier with a
string is shared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The PATH shell variable is a special case. It can be exported to
the environment where it might be interpreted by native applications
which assume the separator is ';'. Hence:
- require that the separator used in PATH is ';'
- enforce this by intercepting calls to setvareq() that set PATH
and adjusting its value if necessary.
As a result of this the code to parse PATH can be simplified by
replacing the hardcoded Unix ':' path separator by the platform-
dependent macro PATH_SEP.
The MANPATH variable is also required to use ';' as its separator
but since it's less likely to be used this isn't enforced.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code to check whether a write error is due to a broken pipe
can now either:
- return with error EPIPE;
- cause the process to exit with code 128+SIGPIPE.
The default is the latter but the behaviour can be changed by issuing
signal(SIGPIPE, SIG_IGN) and signal(SIGPIPE, SIG_DFL) calls.
No actual signal is involved so kill can't send SIGPIPE and handlers
other than SIG_IGN and SIG_DFL aren't supported.
This does, however, avoid unsightly 'broken pipe' errors from commands
like the example in GitHub issue #99:
dd if=/dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;
|
|
|
|
|
|
|
|
|
|
|
|
| |
Files with the extension '.sh' are considered to be executable.
Those that start with a '#!' line will be run using the specified
interpreter. If no '#!' is present the script will be run by the
shell.
When searching for an executable the '.sh' extension will be
tested in the same way as the standard extensions understood
by spawnve(). '.sh' takes precedence over the standard
extensions.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Microsoft Windows' spawnve returns ERROR_BAD_EXE_FORMAT when passed
an empty batch file.
Work around this by skipping spawnve and returning success.
|
|
|
|
|
|
|
| |
It turns out '.bat' is a valid batch file name. Reduce the
permitted length for filenames to allow for this.
Also, actually *use* the file basename in the test this time.
|
|
|
|
|
|
|
| |
When looking for the special WIN32 file extensions only consider the
file's basename, not the full path. Otherwise a file called '.bat',
for example, is considered executable by 'ls -a' and the shell tries
to run './.bat'.
|
|
|
|
|
|
|
|
|
| |
It appears that when a batch file is executed the first argument
must contain backslashes if it's a relative path. Absolute paths
work either way. In both cases the extension is optional.
This allows for a considerable simplification of the special case
in spawnveq.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously there was one function to handle adding extensions to
executable filenames, add_win32_extension(). Refactor this into
three functions:
add_win32_extension() appends the suffix to the argument string
in-place. The argument must be long enough to cope with this,
as is the case in ash where path_advance() adds 4 bytes to each
filename for just this reason.
alloc_win32_extension() is equivalent to the old add_win32_extension().
It allocates a string to hold the new filename then calls the new
add_win32_extension() function. The caller is responsible for
managing the returned string.
auto_win32_extension() calls alloc_win32_extension() and saves the
resulting string using auto_string(). It's used where the new
filename is consumed immediately or the actual value isn't needed.
Rewrite code to use the most appropriate function. Also reorder
some code in find_executable() and find_command().
|
|
|
|
|
|
|
|
|
| |
The WIN32 implementation of access(2) didn't return:
- the correct value when a directory was tested for X_OK;
- the correct error code when the target existed but execute
permission wasn't available.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ash tests exitcode_EACCES and exitcode_ENOENT both failed.
In commit 92dbd3c09 a test was added to tryexec to check that
the file being run existed and was executable. The error codes
returned by this test were incorrect.
The slightly later commit f5783ef14 added a similar test in
spawnveq which got the error codes right.
Remove the test from tryexec and some superfluous error messages
from spawnveq.
|
|
|
|
|
|
| |
Recalculate the system boot time on every pass through the process
scanning loop. It's less efficient than storing the value in a
static variable but not noticeably so and it saves a few bytes.
|
| |
|
|
|
|
|
|
|
|
| |
Fix the build system so the KBUILD_OUTPUT environment variable can be
used as intended: to specify that object files are placed in a separate
directory from the source.
Also ensure that busybox-w32.manifest is deleted by 'make mrproper'.
|
|
|
|
| |
Saves 16 bytes.
|
|
|
|
|
| |
Since more than just icon resources are now provided give various
files more appropriate names.
|
| |
|
|
|
|
|
|
| |
- 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.
|