| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
| |
When a path name is copied to a console application using drag and
drop the path separator is backslash. To handle this situation in
the shell add an editing command (Ctrl-Z) to convert all backslashes
on the current line to slashes.
See GitHub issue #149.
Also remove some unused code from read_key().
|
|
|
|
|
|
|
|
|
| |
If the path is that of a drive mapped to a network share _fullpath()
leaves the trailing slash on the drive name and it remains present
after the call to resolve_symlinks().
Remove a trailing slash from the resolved path unless it's preceded
by a colon.
|
| |
|
|
|
|
| |
Merge FEATURE_IDENTIFY_OWNER into FEATURE_EXTRA_FILE_DATA.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
To set the window title from the command line:
echo -en '\e]0;Hello World\007'
The same sequence can be used in the shell's prompt (PS1).
|
| |
|
|
|
|
|
| |
Add is_admin() and use it to alter the command prompt in the line
editor when running with admin privileges.
|
|
|
|
|
|
|
|
|
|
|
| |
The code to normalise paths in resolve_symlinks(), which is used
by realpath(3), was incomplete and unable to handle UNC paths.
Make an ASCII version of normalize_ntpath() to extend the cases
covered.
This fixes a regression introduced by commit 585d17d26 (win32:
canonicalize path in chdir(2)): it wasn't possible to change
to a directory with a UNC path.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Allow realpath(3) to return successfully on platforms that don't
support GetFinalPathNameByHandleA(). It may still have done some
useful work.
|
| |
|
|
|
|
|
|
|
|
| |
The file size and times reported when Windows follows a symlink
are incorrect. To get the correct values canonicalize the path
and try again.
Also fetch the correct device id and inode for symlinks.
|
|
|
|
|
|
|
|
|
|
| |
The code to implement stat(2) works around the fact that getting
the attributes of a file fails if its name ends with a path
separator. Directory names with a trailing path separator work
fine.
Why bother with this workaround? Linux doesn't. Instead try to
return a meaningful error code.
|
|
|
|
|
|
|
|
|
|
|
| |
SetFileTime only needs FILE_WRITE_ATTRIBUTES access, not full
read/write access. Therefore it isn't necessary to change the
permissions of read-only files.
The flag FILE_FLAG_BACKUP_SEMANTICS is required to access directories
but does no harm if used on a file.
As a result there's no need to get file attributes.
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Extend stat(2) so it tries to determine whether a file belongs to
the current user or not. If not it's said to belong to root.
|
| |
|
|
|
|
|
| |
If stat(2) knows a file exists but can't obtain additional metadata
for it give it root ownership and no permissions for other.
|
| |
|
|
|
|
|
|
|
|
|
| |
The manifest included here wasn't effective in telling Windows
about version compatibility. Use the default manifest provided
by MinGW-w64 instead.
On Fedora this requires installing the mingw32-windows-default-manifest
and/or mingw64-windows-default-manifest packages.
|
|
|
|
|
|
| |
Upstream commit d9aabfe578 (make busybox more portable) moved a
couple of include files into platform-dependent code so we no
longer need dummy versions.
|
|
|
|
|
|
|
|
|
| |
Some files can't be opened to fetch additional metadata. When
that happens allow stat(2) to successfully return what data it
has.
In a few cases where the inode number is used to determine if
files are identical ignore invalid inode numbers.
|
|
|
|
|
|
|
| |
Since st_nlink now depends on st_mode it should be set after
st_mode is initialised.
Rearrange the code to fetch extra metadata.
|
|
|
|
|
|
| |
When additional metadata was being fetched the code for non-disk
files used uninitialised data from the BY_HANDLE_FILE_INFORMATION
structure.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
In parse_interpreter return an error when the file doesn't exist.
The current code tries to run non-existent scripts with a .sh suffix,
thus breaking the test ash-misc/exec.tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
It wasn't possible to enter characters using Alt and the decimal
character code. This was because the character is generated when
the Alt key is released but the WIN32 implementation of read_key()
ignored all key up events.
Modify read_key() to ignore numbers entered on the numeric keypad
with Alt pressed and to detect when Alt is released.
Fixes GitHub issue #136.
|
|
|
|
|
|
|
|
| |
In desktop mode the state column is disabled and doesn't affect
output.
When desktop mode is disabled the state column is displayed in long
output. Put some fake data in the column to improve the display.
|
|
|
|
|
|
|
|
|
|
|
| |
When an interpreted script is being run the comm column in ps
should display the name of the script not the name of the
interpreter.
Use a fake applet pathname to indicate which argument contains
the script.
This also allows pidof to obtain the pid of a script.
|
|
|
|
|
|
|
|
|
| |
Implement read_cmdline() for WIN32 by storing the command line in
the same way as the applet name.
The applet name is actually used for the comm column which is
truncated to COMM_LEN. Using this as the size of the bb_comm
array avoids the need to calculate MAX_APPLET_NAME_LEN.
|
| |
|
| |
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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'.
|