| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 325fee1f9 (win32: change handling of trailing slashes in
stat(2)) caused stat(2) to return EINVAL in some cases when ENOENT
might have been more appropriate.
This caused the command:
rm -f dir/*
to report an error when the directory was empty, contrary to its
expected behaviour of saying nothing.
Fixes GitHub issue #155.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 399b1dd64 (winansi: support escape sequence to set window
title) failed to handle some invalid escape sequences correctly.
Make the code more robust.
Fixes GitHub issue #153.
|
| | |
|
| |
| |
| |
| |
| | |
Increase the allowed number of outstanding events in the input
queue to two.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 91e49fbc7 (vi: add a function to count CRs in the text buffer)
resulted in the spurious error "can't read 'file'" when opening a
file with CRLF line endings.
This was because the count function was called with an incorrect
pointer into the text buffer. The upstream code:
p = text_hole_delete(p + cnt, p + size - 1, NO_UNDO);
unnecessarily updates the pointer p: it's never used again.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
cluster_count is compared against FAT16_MAX, which is defined as 0xfff4
That is the maximum number of cluster a FAT16 can have.
For reference also check the hardware whitepaper from Microsoft
FAT: General Overview of On-Disk Format, version 1.03 page 15
Signed-off-by: Thomas Frauendorfer <tf@miray.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
watch_main 212 232 +20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit a23624237 (win32: special treatment for PATH) required the
PATH variable to use ';' as the separator between components and
enforced this by intercepting attempts to update it.
Do the same for the CDPATH and MANPATH variables.
Also, fix a case in cdcmd() where the wrong separator was used.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When the shell starts behave as though the user had manually changed
to the current working directory of the process, but only if it's an
interactive, non-login shell and the '-d' flag isn't present.
This gives more consistent behaviour when the shell is started in a
drive mapped to a network share or a symlinked directory.
This completes the changes requested in GitHub issue #148.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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().
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
If the current directory is in a drive mapped to a network share
we may not be able to access it once we have elevated privileges.
Avoid this by canonicalising the path before calling ShellExecuteEx().
|
| | |
|
| |
| |
| |
| | |
Merge FEATURE_IDENTIFY_OWNER into FEATURE_EXTRA_FILE_DATA.
|
| |
| |
| |
| |
| | |
Some faulty logic with ENABLE_FEATURE_EXTRA_FILE_DATA broke the
POSIX build.
|
|\| |
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| | |
Signed-off-by: Nicolas Hüppelshäuser <nicolas.hueppelshaeuser@emlix.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently, running "udhcpc -n -b" causes udhcpc to go to background and
then exit after some time unless a lease is obtained.
It's not very useful to do so
as the calling process doesn't know
if the lease was obtained or not anyway.
The code actually tries to favor "-b" over "-n",
but doesn't clear "-n" flag while clearing "-b" after backgrounding.
So, clear "-n" flag after going into background.
This effectively makes "-b" override "-n" completely
and "-n -b" behave the same as "-b".
This allows to override default "-n" option, passed to udhcpc by ifupdown,
without recompiling busybox.
URL: https://bugs.busybox.net/11691
Signed-off-by: Andrey Mazo <ahippo@yandex.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
packed_usage 33324 33315 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The following constructs result in ever-increasing memory usage:
while true; do { true; } </dev/null; done
while true; do ( true; ) </dev/null; done
For comparison, bash displays static memory usage in both cases.
This has been fixed in dash by commit 2bc6caa. The maintainer
writes:
I have simplified evaltree so that it simply sets the stack mark
unconditionally. This allows us to remove the stack marks in the
functions called by evaltree.
Closes BusyBox bug 7748.
function old new delta
evaltree 606 632 +26
evalcommand 1724 1696 -28
evalcase 382 351 -31
evalfor 230 196 -34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 26/-93) Total: -67 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since coreutils 8.6 (2010-10-15) du no longer counts duplicate arguments.
Revert the relevant part of commit 618a3027ed (du: fix "du /dir /dir"
case).
function old new delta
du_main 302 297 -5
reset_ino_dev_hashtable 78 - -78
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-83) Total: -83 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| | |
Linux kernel supports it since ~2006
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| | |
Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Rework the code in updatepwd() which processes UNC paths so that
the root of a share is properly identified. This fixes problems
when:
- the current directory is a share and the user changes to '/';
- the current directory is the root of a share and the user tries
to change to '..'.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
ShellExecuteEx() requires backslashes as the file separator if
the binary to be executed has a UNC path. Convert separators
unconditionally.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
I've been a bit lax about ensuring the --busybox flag is passed
in command lines. It's needed to avoid problems if the binary
is called something like sh.exe.
|
| |
| |
| |
| |
| |
| |
| |
| | |
When busybox-w32 is installed in C:/Windows/System32 su doesn't
run in the same directory as its parent as intended.
Work around this by adding a flag to the shell to set the working
directory.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use the undocumented 'runas' verb in a call to ShellExecuteEx()
to run a shell with elevated privileges.
Because of the way ShellExecuteEx() works this:
- requires that you acknowledge a User Account Control prompt (if
you're an Administrator);
- requires that you enter an Administrator's password (if you aren't
an Administrator);
- creates a separate console window for the privileged shell.
Variables from the parent shell aren't passed to its privileged child,
only variables from the environment.
It's possible to specify a command to run when the shell starts.
This can be used to pass shell variables:
su -c "HELLO='hello world'; GOODBYE=$GOODBYE"
Or do fancy things like:
su -c "ls -l; read -p 'Hit return to exit: '; exit"
It's probably best to put double quotes around the command and use
single quotes inside it. Apparently ShellExecuteEx() requires
double quotes to be entered in triplicate:
su -c 'HELLO="""hello world"""'
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| | |
The 'nocaseglob' shell option enables case-insensitive filename
globbing. By default globbing is case-sensitive.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Because tab-completion is case-insensitive the matching text might
differ from what the user typed. Insert the whole of the matching
text, not just the tail. Thus:
$ cd doc<TAB>
now expands to:
$ cd Documents/
|
| |
| |
| |
| |
| | |
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.
|
| | |
|