summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | win32: change stat(2) error code in certain casesRon Yorston2019-03-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | winansi: more robust handling of invalid escape sequencesRon Yorston2019-03-191-34/+46
| | | | | | | | | | | | | | | | 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.
* | ash: rewrite PATH update to save a few bytesRon Yorston2019-03-181-12/+8
| |
* | vi: improve reliability of pasted textRon Yorston2019-03-171-2/+2
| | | | | | | | | | Increase the allowed number of outstanding events in the input queue to two.
* | vi: fix spurious error on opening file with CRLF line endingsRon Yorston2019-03-171-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'busybox' into mergeRon Yorston2019-03-163-6/+15
|\|
| * Fix off by one error in FAT16 <=> FAT32 detectionThomas Frauendorfer2019-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
| * watch: support fractional -n SECDenys Vlasenko2019-03-122-5/+14
| | | | | | | | | | | | | | function old new delta watch_main 212 232 +20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: enforce ';' separator in CDPATH and MANPATH variablesRon Yorston2019-03-161-11/+23
| | | | | | | | | | | | | | | | | | | | 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.
* | ash: set current working directory on startupRon Yorston2019-03-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | 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.
* | win32: add function to convert slashes to backslashesRon Yorston2019-03-159-25/+29
| | | | | | | | | | | | | | | | | | 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().
* | lineedit: add a command to change backslashes to slashesRon Yorston2019-03-152-6/+7
| | | | | | | | | | | | | | | | | | | | | | 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().
* | win32: realpath(3): remove trailing slashRon Yorston2019-03-141-1/+4
| | | | | | | | | | | | | | | | | | 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.
* | su: canonicalise directory before elevating privilegesRon Yorston2019-03-141-5/+11
| | | | | | | | | | | | 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().
* | Update copyright dateRon Yorston2019-03-142-2/+2
| |
* | win32: consolidate file metadata optionsRon Yorston2019-03-124-20/+6
| | | | | | | | Merge FEATURE_IDENTIFY_OWNER into FEATURE_EXTRA_FILE_DATA.
* | win32: fix POSIX build (again)Ron Yorston2019-03-123-3/+9
| | | | | | | | | | Some faulty logic with ENABLE_FEATURE_EXTRA_FILE_DATA broke the POSIX build.
* | Merge branch 'busybox' into mergeRon Yorston2019-03-1212-51/+55
|\|
| * xargs: mention -E STR in --helpDenys Vlasenko2019-03-101-7/+7
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * scripts/echo.c: resolve implicit declaration of function 'dup2'Nicolas Hüppelshäuser2019-03-051-0/+1
| | | | | | | | | | Signed-off-by: Nicolas Hüppelshäuser <nicolas.hueppelshaeuser@emlix.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * top: tweak --helpDenys Vlasenko2019-02-272-15/+8
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * udhcpc: don't exit after backgrounding on -n -bAndrey Mazo2019-02-272-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * udhcpc: tweak --helpDenys Vlasenko2019-02-271-3/+3
| | | | | | | | | | | | | | function old new delta packed_usage 33324 33315 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: eval: avoid leaking memory associated with redirections. Closes 7748Ron Yorston2019-02-251-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * du: don't count duplicate arguments. Closes 5288Ron Yorston2019-02-192-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * ntpd: increase SLEW_THRESHOLD from 0.125 to 0.5Denys Vlasenko2019-02-151-5/+4
| | | | | | | | | | | | Linux kernel supports it since ~2006 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dd: add 'oflag=append'Rostislav Skudnov2019-02-142-6/+11
| | | | | | | | | | Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: improve handling of UNC pathsRon Yorston2019-03-111-8/+35
| | | | | | | | | | | | | | | | | | | | | | 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 '..'.
* | win32: changes to user idsRon Yorston2019-03-105-32/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | winansi: support escape sequence to set window titleRon Yorston2019-03-091-12/+32
| | | | | | | | | | | | | | | | 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).
* | su: change title of console windowRon Yorston2019-03-094-2/+23
| |
* | win32: add a function to detect running with elevated privilegesRon Yorston2019-03-093-0/+22
| | | | | | | | | | Add is_admin() and use it to alter the command prompt in the line editor when running with admin privileges.
* | su: work when binary has a UNC pathRon Yorston2019-03-091-1/+11
| | | | | | | | | | | | ShellExecuteEx() requires backslashes as the file separator if the binary to be executed has a UNC path. Convert separators unconditionally.
* | win32: extend normalisation of paths in realpath(3)Ron Yorston2019-03-081-2/+20
| | | | | | | | | | | | | | | | | | | | | | 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.
* | su, wget: use magic '--busybox' flagRon Yorston2019-03-082-6/+4
| | | | | | | | | | | | 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.
* | ash, su: add -d flag to set directory in ash, use it in suRon Yorston2019-03-082-5/+35
| | | | | | | | | | | | | | | | 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.
* | su: add a basic implementation for WIN32Ron Yorston2019-03-074-2/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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"""'
* | win32: canonicalize path in chdir(2)Ron Yorston2019-03-062-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | win32: implement readlink(2)Ron Yorston2019-03-067-9/+92
| | | | | | | | | | | | | | | | | | | | 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.
* | win32: let realpath(3) succeed on WinXP/ReactOSRon Yorston2019-03-061-8/+14
| | | | | | | | | | | | Allow realpath(3) to return successfully on platforms that don't support GetFinalPathNameByHandleA(). It may still have done some useful work.
* | win32: drop argument from err_win_to_posix()Ron Yorston2019-03-064-10/+10
| |
* | win32: improved results for symlinks from stat(2)Ron Yorston2019-03-051-36/+56
| | | | | | | | | | | | | | | | 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.
* | win32: change handling of trailing slashes in stat(2)Ron Yorston2019-03-041-40/+11
| | | | | | | | | | | | | | | | | | | | 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.
* | win32: simplify utimes(2) implementationRon Yorston2019-03-041-31/+6
| | | | | | | | | | | | | | | | | | | | | | 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.
* | ls: use correct column width for WIN32 inodesRon Yorston2019-03-041-0/+4
| |
* | win32: let stat(2) report numeric uids for local usersRon Yorston2019-03-022-10/+49
| | | | | | | | | | | | | | | | | | | | | | 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
* | ash: add an option to enable case-insensitive filename globbingRon Yorston2019-03-011-4/+26
| | | | | | | | | | The 'nocaseglob' shell option enables case-insensitive filename globbing. By default globbing is case-sensitive.
* | libbb: copy entire match during tab-completionRon Yorston2019-03-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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/
* | win32: make stat(2) try to identify the owner of filesRon Yorston2019-03-014-9/+76
| | | | | | | | | | 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.
* | find: enable -xdev in default configurationRon Yorston2019-02-283-3/+3
| |