| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
| |
Port the time applet to WIN32. This requires the implemntation of
a replacement for wait3(2).
Only elapsed, user and system times are supported, not the memory
and i/o statistics reported by GNU time.
|
|
|
|
|
|
|
| |
Implement getpeername(2).
Add mingw_spawn_detach() to allow the spawned process to detach from
the console.
|
|
|
|
|
|
|
| |
When the seek=N argument is used mark the file as sparse and set
the range that is sparse.
See https://stackoverflow.com/questions/4011508/how-to-create-a-sparse-file-on-ntfs
|
|
|
|
|
|
|
| |
Define NOT_DEVICE as -1 so the return value of index_in_strings()
when no device name is matched is NOT_DEVICE.
Make the logic in mingw_open() clearer.
|
|
|
|
|
| |
Have bs_to_slash() return a pointer to its argument. This allows
some calls to be chained, saving 32 bytes.
|
|
|
|
|
|
|
| |
Since we don't have a working clock_settime(2) there's no point
in claiming to support the '-s' option.
Saves 96 bytes
|
|
|
|
|
|
| |
- Update configuration files
- Omit unnecessary libraries
- Replace fake stime(2) with fake clock_settime(2)
|
|
|
|
|
|
| |
Modern Linux kernels use struct timespec to represent file times,
thus allowing nanosecond precision. Update the WIN32 emulation of
struct stat and stat(2) to do the same.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Standardise the path names used for the current working directory by:
- resolving with realpath(3);
- making the drive name or host name uppercase.
The first only really works for physical drives; results for mapped
drives are patchy.
The standardisation is applied in two places:
- at the end of updatepwd() in ash;
- when a symbolic link is resolved in mingw_chdir().
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Microsoft Windows permits path names of the form 'c:path', without a
path separator after the colon. The system records a current directory
for each drive and the path is interpreted relative to that.
Since Windows API calls understand 'c:path' path names many commands
in busybox-w32 already work with them. This commit adds the following:
- The 'cd' shell built-in interprets 'c:path' path names correctly.
Previously it treated them as relative to the shell's concept of
the current working directory, not the current directory of the
specified drive.
- The 'pwd' shell built-in takes the '-a' option to list the current
directory for all drives.
- 'c:path' path names are subject to tab-completion.
Paths of the form 'c:path' don't work for mapped network drives or
paths that have been associated with a drive using SUBST.
See GitHub issue #147.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BusyBox contains hardcoded references to absolute paths which
are unique in the *nix world but on Microsoft Windows are
interpreted as being on the current drive. To make these unique
again consider them to be relative to %SYSTEMDRIVE%.
Support this by adding functions to:
- determine the system drive (not using the environment variable);
- change a process's current directory to the root of the system drive;
- make relative paths absolute before changing directory (if needed).
The following applications have been modified:
- ash references /etc/profile from the system drive;
- dpkg places its data store on and installs files to the system drive;
- rpm installs files to the system drive;
- man looks for configuration files and man pages on the system drive.
See GitHub issue #158.
|
|
|
|
|
|
|
| |
Move unc_root_len() from ash to mingw32.c and use it in the new
function root_len(), which can be used in make_directory().
This reduces changes to upstream code and saves a few bytes.
|
|
|
|
|
|
|
|
|
| |
There are now two places where slashes are converted to backslashes
throughout a string so it makes sense to create a function to do
this.
To avoid confusion rename convert_slashes() to bs_to_slash() and
call the new function slash_to_bs().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Formalise the use of 0 as the uid of a process running with elevated
privileges:
- Rewrite getuid(2) to return DEFAULT_UID by default and 0 if the
process has elevated privileges.
- geteuid(2) and the corresponding functions for groups are aliases
for getuid(2).
- Change root's home directory to be whatever GetSystemDirectory()
returns, probably C:/Windows/System32 in most cases.
- Remove the special handling of geteuid(2) in the line editing code.
With these changes the shell started by 'su' is a lot more like a
*nix root shell.
|
| |
|
|
|
|
|
| |
Add is_admin() and use it to alter the command prompt in the line
editor when running with admin privileges.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Provide an implementation of chdir(2) which canonicalizes the
path to resolve symlinks. Otherwise changing to a symlinked
directory confuses 'ls -l' because it thinks '.' is a link
rather than a directory.
OTOH, using 'cd' in the shell to change to a symlinked directory
now results in a mismatch between the shell's idea of where we are
and what's displayed in the prompt. But upstream BusyBox does
that too so it must be OK.
|
|
|
|
|
|
|
|
|
|
| |
Provide an implementation of readlink(2) based on code from Git
for Windows. This version only supports symbolic links, not
mount points, as the latter seem to work well enough as-is.
With this change the ls and stat applets can display the targets
of symbolic links. The readlink applet has been enabled in the
default configuration.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Further extend file identification so stat(2) returns the relative
identifier as a numeric uid for files with owner SIDs that look like
a local or domain user.
See:
https://blogs.technet.microsoft.com/markrussinovich/2009/11/03/the-machine-sid-duplication-myth-and-why-sysprep-matters/
https://cygwin.com/cygwin-ug-net/ntsec.html
|
|
|
|
|
|
|
|
| |
Move the code to hide the console to a separate function in
win32/mingw.c. Use lazy loading to avoid problems on platforms
where the require APIs aren't supported (PR #70).
Enable console hiding in the default 64-bit configuration.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Modify the WIN32 implementation of stat(2) to fetch inode number,
device id and number of hardlinks. This requires opening a handle
to the target file so it will be slower.
A number of features can be enabled or start to work:
- tar can detect if an archive is being stored in itself;
- find can support the -inum and -links options;
- ls can display inode numbers;
- diff can detect attempts to compare a file with itself;
- du has better support for hardlinked files;
- cp can detect attempts to copy a file over itself.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The euro currency symbol was added to some OEM code pages. See:
https://www.aivosto.com/articles/charsets-codepages-dos.html
Add a configuration option (enabled by default) to support this.
When enabled:
- The read_key() function requests wide character key events. This
allows the euro symbol to be entered regardless of the console OEM
code page, though it needs to be available in the ANSI code page.
- Conversions between OEM and ANSI code pages in winansi.c are
modified to work around a bug in the Microsoft routines.
- If the OEM code page is 850 when BusyBox starts it's changed to
858. This is the only currently supported OEM code page.
Also, the shell read builtin is modified to use read_key() whenever
input is being taken from the console.
|
|
|
|
|
| |
Continue to use old version of dc; add definition of LONG_BIT from
xopen_lim.h.
|
|
|
|
|
| |
The Microsoft C runtime may include a defective version of vsnprintf.
Implement a standards-compliant replacement.
|
|
|
|
|
|
|
|
|
| |
umask() in the Microsoft C runtime takes different arguments to
umask(2). Implement a fake umask(2) that remembers the mask and
calls the Microsoft umask() with an appropriate value.
Since the mask won't be inherited by children use an environment
variable to pass any value set by the shell built-in umask.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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;
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Since getpwent isn't implemented for WIN32 there's no point in
enabling FEATURE_USERNAME_COMPLETION.
Use case-insensitive comparisons when matching filenames.
The code to exclude non-executables when tab completing executables
is WIN32-specific and shouldn't omit directories.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 itoa and strrev functions have different prototypes in BusyBox
and WIN32. Move the #defines which handle this to mingw.h, reducing
differences between busybox-w32 and upstream.
|
|
|
|
|
| |
Move the definition of O_NOCTTY to mingw.h so that fsync.c is the
same as upstream.
|
|
|
|
|
|
|
|
| |
- 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).
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
Microsoft Windows has only limited support for signals. busybox-w32
initially papered over this fact by adding definitions for unsupported
signals and signal-handling functions.
Remove this fake code and deal with the consequences by excluding
anything that fails to compile as a result.
|
|
|
|
| |
The only other caller (in spawnveq) has been removed.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|