aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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
| |
* | win32: make more use of common lazy loading codeRon Yorston2019-02-272-27/+10
| |
* | win32: fake permissions/ownership for inaccessible filesRon Yorston2019-02-251-0/+5
| | | | | | | | | | If stat(2) knows a file exists but can't obtain additional metadata for it give it root ownership and no permissions for other.
* | dpkg: enable in the default configurationRon Yorston2019-02-223-2/+7
| | | | | | | | | | | | | | | | | | | | BusyBox's dpkg is marginally more useful than rpm because it maintains package status. Run the following commands to initialise the filesystem: mkdir -p /var/lib/dpkg/info touch /var/lib/dpkg/status
* | uname: drop support for ia64Ron Yorston2019-02-211-4/+3
| |
* | win32: use manifest provided by MinGW-w64Ron Yorston2019-02-217-44/+1
| | | | | | | | | | | | | | | | | | 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.
* | win32: remove unused include filesRon Yorston2019-02-202-0/+0
| | | | | | | | | | | | Upstream commit d9aabfe578 (make busybox more portable) moved a couple of include files into platform-dependent code so we no longer need dummy versions.
* | win32: stat(2) succeeds if fetching extra metadata failsRon Yorston2019-02-195-17/+19
| | | | | | | | | | | | | | | | | | 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.
* | win32: tidy up stat(2) implementationRon Yorston2019-02-181-21/+22
| | | | | | | | | | | | | | Since st_nlink now depends on st_mode it should be set after st_mode is initialised. Rearrange the code to fetch extra metadata.
* | win32: avoid use of uninitialised metadata in stat(2)Ron Yorston2019-02-181-2/+8
| | | | | | | | | | | | When additional metadata was being fetched the code for non-disk files used uninitialised data from the BY_HANDLE_FILE_INFORMATION structure.
* | win32: fix POSIX buildRon Yorston2019-02-174-5/+28
| | | | | | | | | | | | There were a few places where changes intended for the WIN32 build also affected the POSIX build. Fix these so the result of 'make defconfig; make' for busybox-w32 is identical to upstream BusyBox.
* | ash: updated support for hiding consoleRon Yorston2019-02-174-10/+21
| | | | | | | | | | | | | | | | 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.
* | ash: tidy up handling of -X optionRon Yorston2019-02-171-8/+7
| |
* | win32: make stat(2) fetch additional metadataRon Yorston2019-02-1612-16/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | vi: add a function to count CRs in the text bufferRon Yorston2019-02-141-29/+27
| |
* | win32: add a function to remove CRs from a text bufferRon Yorston2019-02-144-25/+19
| |