| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Export the function xappendword() from make. Use it in drop and
watch.
Saves 8-80 bytes, an unusually large disparity.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The tab-completion code treated all matches as case-insensitive
because that's how Microsoft Windows handles filenames.
This is now inadequate, as shell builtins, functions and aliases
are case sensitive.
Modify the treatment of case-sensitivity in tab completion:
- Track whether each potential match is case-insensitive (filename)
or case-sensitive (shell builtin, function or alias).
- When comparing matches use a case-insensitive comparison if either
value is a filename. Otherwise use a case-sensitive comparison.
Adds 64 bytes.
|
|
|
|
|
|
|
|
|
|
| |
The functions ndelay_on(), ndelay_off() and close_on_exec_on()
don't do anything useful because our fcntl(2) implementation
doesn't support the features they require.
Replace them with stubs.
Saves 176-208 bytes.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
fork_or_rexec 46 56 +10
bootchartd_main 1087 1079 -8
cpio_main 674 661 -13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 10/-21) Total: -11 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The trap builtin now handles INT. As before, other signals (from
a limited list) are accepted but their traps don't have any effect.
There's some variability in how shells handle traps. This patch
upholds that proud tradition.
Various changes are needed to make this work:
- Line editing has a new flag to ignore Ctrl-C.
- If INT is being trapped or ignored don't call raise_interrupt().
- A minimal implementation of dotrap() is provided.
- Call dotrap() when the read builtin or line input detect Ctrl-C.
- Adjust Ctrl-C detection when the INT trap is changed.
- Set may_have_traps when an INT trap is set.
Costs 368-448 bytes.
(GitHub issue #303)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It's fairly common for shell scripts to trap this set of signals:
EXIT HUP INT QUIT TERM (or the numeric equivalent: 0 1 2 3 15)
Add definitions for SIGHUP and SIGQUIT. We don't take any action
if traps are defined for them, but at least scripts won't fail.
(GitHub issue #303)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 93a63809f9 (win32: add support for the euro currency symbol)
caused all invocations of busybox-w32 to change code page 850 to
858. This has been known to cause problems with fonts in PowerShell
(GitHub issue #207).
Delay changing the code page until an i/o operation is imminent.
Instances of PowerShell started by the `drop` applet during ssh login
thus no longer have their code page adjusted.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The 'drop' alias for 'runuser' relaxes a number of constraints
that were introduced for compatibility:
- It works even if the current process doesn't have elevated
privileges.
- It isn't necessary to specify the name of the user.
- Any command can be invoked, not just the BusyBox shell.
- If the command doesn't specify a path 'drop' will first look for
a BusyBox applet then search PATH.
Adds 320-336 when built along with runuser.
(GitHub issue #240)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add a function, file_is_win32_exe(), to detect if a path refers
to an executable. It tries adding extensions if necessary.
Use this in a number of places to replace common code of the form
path = alloc_ext_space(cmd);
if (add_win32_extension(path) || file_is_executable(path))
Saves 32-48 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add a cut down, Windows-specific implementation of `runuser` from
util-linux.
This allows elevated privileges to be dropped when running in an
SSH session. It also works when using `su` or starting busybox-w32
'as administrator'.
There are complications:
- The method used to drop privileges leaves the access token in the
TokenIsElevated state. Detecting this is likely to be fragile.
- The unprivileged shell is started by CreateProcessAsUserA(). In
older versions of Windows this has to be loaded dynamically.
Adds about 900 bytes.
(GitHub issue #240)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Disable ENABLE_PROCESSED_INPUT in raw mode. Otherwise ^C isn't
immediately detected during shell command line editing with
virtual terminal input enabled.
- Switch read_key()/unix_readkey() to windows_read_key()/read_key().
This allows the shell `read` builtin to use windows_read_key().
Without this change `read` fails when virtual terminal input is
enabled.
|
| |
| |
| |
| |
| |
| |
| | |
Until now busybox-w32 has used a native Windows implementation
of read_key(). Build the upstream Unix implementation and use
it instead of the native version when virtual terminal input
mode is enabled.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add the environment variable BB_TERMINAL_MODE as a more general way
of controlling console/terminal mode setting. The default remains
unchanged: use virtual terminal mode for output if possible but
fall back to the console API with emulated ANSI escape sequences.
Currently valid settings are:
0 Force use of console mode
1 Force use of virtual terminal mode for output
5 Prefer virtual terminal mode for output, fall back to console
Other values won't do anything useful until code elsewhere has been
updated.
BB_SKIP_ANSI_EMULATION remains available for backwards compatibility.
If both variables are set BB_TERMINAL_MODE takes precedence.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 7fb95a2a5 (win32: try to get link count for directories)
allowed stat(2) to report accurate values of st_nlink for
directories.
There are only a couple of places in busybox-w32 where these values
are required. Disable counting of subdirectories by default and
only enable it when necessary.
Microsoft kindly provide directories to test edge cases like this:
C:/Windows/WinSxS (contains many subdirectories)
C:/Windows/WinSxS/Manifests (contains many files)
Adds 84-112 bytes.
|
|\| |
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Microsoft Windows' setvbuf() doesn't support line buffering and
doesn't accept 0 as a valid value for the buffer size argument.
Replace the old macro definition with an implementation that
doesn't do anything. It's only used if debug is enabled in ash
so there's no effect on the default build.
|
| |
| |
| |
| |
| |
| |
| | |
Since vfork(2) is never used in busybox-w32 there's no need to
declare it. Doing so provokes clang to issue a warning.
(GitHub issue #239)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 605972390 (win32: handle Unix-style absolute paths for
executables) added special treatment of paths for executables
starting with a slash. Such paths are absolute on Unix but are
relative to the current drive on Windows. On reflection this
commit did more than necessary. Later commits provided special
treatment only for paths starting with locations traditionally
used to contain binaries on Unix. This is probably sufficient.
Problems introduced by commit 605972390 include:
- If the current drive isn't the system drive tab completion of a
command starting with a slash confusingly references the system
drive.
- Building busybox-w32 with w64devkit fails on drives other than
the system drive.
Revert the changes introduced by commit 605972390.
This saves 192 bytes.
(GitHub issue #239)
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
sleepcmd - 10 +10
builtintab 352 360 +8
.rodata 105264 105271 +7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 25/0) Total: 25 bytes
Signed-off-by: Shawn Landden <shawnlandden@tutanota.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ash and hush correctly use the value of HOME for tilde expansion.
However the line editing code in libbb obtains the user's home
directory by calling getpwuid(). Thus tildes in tab completion
and prompts may be interpreted differently than in tilde expansion.
When the line editing code is invoked from a shell make it use the
shell's interpretation of tilde. This is similar to how GNU readline
and bash collaborate.
function old new delta
get_homedir_or_NULL 29 72 +43
optschanged 119 126 +7
hush_main 1204 1211 +7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 57/0) Total: 57 bytes
v2: Always check for HOME before trying the password database: this
is what GNU readline does.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
If a file is a junction or symlink return its tag in the st_tag
member of struct stat.
get_symlink_data() and is_symlink() also return the tag or zero,
as appropriate.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add a Windows-specific applet to create a directory junction.
Usage: jn DIR JUNC
where DIR must be an existing directory on a local drive and JUNC
must not currently exist.
There isn't a simple WIN32 API to create directory junctions.
The implementation of mklink in ReactOS provided useful inspiration.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The default PATH defined as BB_PATH_ROOT_PATH is used:
- to set PATH in the shell if the environment variable doesn't exist;
- as the default in 'which' if there's no PATH env var;
- when the option 'command -p' is given.
Replace the Unix-centric default with something more likely to work
on Microsoft Windows. No guarantees, though.
(GitHub issue #253)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The environment variables BB_OVERRIDE_APPLETS, BB_SKIP_ANSI_EMULATION
and BB_SYSTEMROOT affect of the behaviour of the shell itself.
Setting them as shell variables is insufficient for them to affect
the current shell.
When these three variables are exported from the shell they are
now placed in the environment immediately. Conversely, when
they're unset or unexported they're removed from the environment.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The default busybox-w32 configuration enables the PREFER_APPLETS
and SH_STANDALONE features. Sometimes it may be desirable to
override the default preference for applets, for example, if an
applet needs to be replaced by an external program with additional
features.
Add support for the environment variable BB_OVERRIDE_APPLETS.
Its value may be:
- a single dash ('-'): all applets are overridden;
- a space-separated list of names: only the specified applets
are overridden.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Change how 'which' detects if it was run from a standalone shell:
the shell passes the undocumented '-s' option. This is stricter
and more reliable than the previous method of checking the name
of the binary.
Add a function to determine the binary associated with a given
applet name. This makes it possible for 'which' and 'command -v'
to list the correct binary even for applets other than 'busybox'.
For example, when the binary is called 'sh.exe' 'which sh' will
report its path.
In standalone shell mode 'command -V' and 'type' now report "xxx
is a builtin applet" rather than "xxx is xxx", which is true but
not very illuminating.
(GitHub issue #248)
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Provide a WIN32 implementation of clock_gettime(2), though only
with support for CLOCK_REALTIME. This makes it possible to enable
FEATURE_DATE_NANO which adds support for the %N date format.
MinGW-w64 has clock_gettime(2) but it's in the winpthreads library
and we don't want to bother with that.
|
|\|
| |
| |
| |
| |
| |
| |
| | |
Fix conflicts in reset and ash.
Redefine the new safe_read_key() as a reference to read_key().
Disable SHA256_HWACCEL.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"
function old new delta
.rodata 108586 108460 -126
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-126) Total: -126 bytes
text data bss dec hex filename
970412 4219 1848 976479 ee65f busybox_old
970286 4219 1848 976353 ee5e1 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This was missing in the previous attempt to fix it via [1]
This helps fix segfaults when compiling with clang ( seen on riscv64 )
[ 452.428349] less[270]: unhandled signal 11 code 0x1 at 0x000000000000000c in busybox.nosuid[2ab7491000+ba000]
[ 452.430246] CPU: 3 PID: 270 Comm: less Not tainted 5.15.13-yocto-standard #1
[ 452.431323] Hardware name: riscv-virtio,qemu (DT)
[ 452.431925] epc : 0000002ab74a19ee ra : 0000002ab74a19dc sp : 0000003fec6ec980
[ 452.432725] gp : 0000002ab754dcb0 tp : 0000003f88783800 t0 : 0000003f8878d4a0
[ 452.433744] t1 : 0000002ab749b00c t2 : 0000000000000000 s0 : 0000003fec6ecc38
[ 452.434732] s1 : 000000000000004c a0 : 00000000ffffffff a1 : 0000002ab754dde0
[ 452.435861] a2 : 0000000000000000 a3 : 0000000000000100 a4 : 0000002ab754f3a0
[ 452.436787] a5 : 0000002ab754f3a0 a6 : 0000000000000000 a7 : 0000002ab754f2a0
[ 452.437974] s2 : 0000000000000002 s3 : 0000002ab754b6c8 s4 : 0000002ab749b60e
[ 452.438781] s5 : 0000000000000000 s6 : 0000002ab754b6c8 s7 : 0000003f88943060
[ 452.439723] s8 : 0000003f88944050 s9 : 0000002ad8502e88 s10: 0000002ad8502de8
[ 452.440538] s11: 0000000000000014 t3 : 0000003f887fceb6 t4 : 0000003f8893af0c
[ 452.441438] t5 : 0000000000000000 t6 : 0000003f88923000
[1] https://git.busybox.net/busybox/commit/?id=1f925038a
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
lineedit_read_key 237 231 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
lineedit_read_key 160 237 +77
__pgetc 522 589 +67
fgetc_interactive 244 309 +65
safe_read_key - 39 +39
read_key 588 607 +19
record_pending_signo 23 32 +9
signal_handler 75 81 +6
.rodata 104312 104309 -3
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 6/1 up/down: 282/-3) Total: 279 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
chdir_or_warn - 37 +37
send_cgi_and_exit 720 711 -9
xchdir 27 15 -12
setup_environment 233 217 -16
fork_job 449 433 -16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/4 up/down: 37/-53) Total: -16 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Double negatives are hard to grok.
function old new delta
login_main 986 988 +2
su_main 474 470 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-4) Total: -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|\|
| |
| |
| |
| |
| |
| | |
Fix merge conflicts in coreutils/ls.c and shell/ash.c.
Update config files to turn off SHA1_HWACCEL. It uses non-portable
assembler.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Change to root's HOME. Set some envvars. Steal ctty if necessary and possible.
function old new delta
sulogin_main 240 340 +100
setup_environment 225 233 +8
su_main 479 474 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 108/-5) Total: 103 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|\|
| |
| |
| |
| |
| | |
Fix merge conflict in miscutils/less.c.
Use exit_SUCCESS() where possible.
|
| |
| |
| |
| |
| |
| |
| | |
Also, remove entirely usually-disabled paranoia check (was also using
wrong config option to enable itself).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
exit_SUCCESS - 7 +7
_exit_SUCCESS - 7 +7
run_pipe 1562 1567 +5
pseudo_exec_argv 399 400 +1
finish 86 87 +1
start_stop_daemon_main 1109 1107 -2
shutdown_on_signal 38 36 -2
runsv_main 1662 1660 -2
redirect 1070 1068 -2
read_line 79 77 -2
pause_and_low_level_reboot 54 52 -2
list_i2c_busses_and_exit 483 481 -2
less_exit 12 10 -2
identify 4123 4121 -2
grep_file 1161 1159 -2
getty_main 1519 1517 -2
fsck_minix_main 2681 2679 -2
free_session 132 130 -2
fdisk_main 4739 4737 -2
clean_up_and_exit 53 51 -2
bsd_select 1566 1564 -2
bb_daemonize_or_rexec 198 196 -2
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/17 up/down: 21/-34) Total: -13 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
fflush_stdout_and_exit_SUCCESS - 7 +7
xxd_main 890 888 -2
vlock_main 353 351 -2
uuencode_main 318 316 -2
uniq_main 427 425 -2
uname_main 250 248 -2
sort_main 853 851 -2
shuf_main 500 498 -2
route_main 238 236 -2
readlink_main 113 111 -2
nice_main 156 154 -2
last_main 957 955 -2
ipcs_main 960 958 -2
env_main 209 207 -2
chrt_main 464 462 -2
cal_main 921 919 -2
baseNUM_main 650 648 -2
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/16 up/down: 7/-32) Total: -25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|\|
| |
| |
| | |
Fix merge conflict in coreutils/timeout.c.
|
| |
| |
| |
| | |
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
sp_256_proj_point_dbl_8 421 428 +7
sp_256_point_from_bin2x32 78 84 +6
sp_256_cmp_8 38 42 +4
sp_256_to_bin_8 28 31 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 20/0) Total: 20 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| | |
On 64-bit systems mingw-w64 defines pid_t as a 64-bit integer so
some printf calls caused compiler warnings.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Upstream commit 94eb1c4dc (libbb: better coreutils compatibility
for realpath) made some changes to xmalloc_realpath_coreutils().
This now needs to be updated to handle Windows paths.
- Expose the macro is_unc_path() and part of the recent change to
bb_get_last_path_component_nostrip() as a separate funtion,
get_last_slash();
- Convert a couple of errors relating to network filesystems to
ENOENT;
- Adjust xmalloc_realpath_coreutils() to handle Windows directory
separators, relative paths and UNC paths.
|
|\| |
|