| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit fd47f0567 (lineedit: print prompt and editing operations
to stderr) changed various print statements to output to stderr.
The change in show_history() caused the shell history builtin to
send its output to stderr.
Revert that part of the commit.
function old new delta
show_history 47 42 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5) Total: -5 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
save_history 267 266 -1
hush_exit 98 97 -1
exitshell 140 138 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-4) Total: -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit fd47f0567 (lineedit: print prompt and editing operations
to stderr) changed various print statements to output to stderr.
The change in show_history() caused the shell history builtin to
send its output to stderr.
Revert that part of the commit.
Saves 16 bytes.
(GitHub issue #433)
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For shells, this is mandated by standards
function old new delta
input_backward 215 231 +16
read_line_input 3015 3028 +13
draw_custom 66 78 +12
put_cur_glyph_and_inc_cursor 149 159 +10
put_prompt_custom 47 56 +9
show_history 40 46 +6
input_tab 927 933 +6
input_delete 136 142 +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/0 up/down: 78/0) Total: 78 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Allow the default history size (used if HISTFILESIZE isn't set)
to be configured at build time. This may be less than or equal
to the standard history size.
(GitHub issue #411)
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Keep the maximum history size at 1023 but make the default 383.
This gives a modest increase over the previous default of 255
while allowing users to increase or decrease the history size
using the HISTFILESIZE environment variable.
(GitHub issue #411)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Rename some functions to be more meaningful.
- Adjust conditional compilation to clarify which code is required
for 'standalone shell' and 'exec prefers applets' settings.
This shouldn't result in any change to the behaviour or size of
default builds.
|
| |
| |
| |
| |
| |
| |
| | |
The conditional compilation to control standalone shell mode was
incorrect when building for POSIX. This hadn't been noticed before
as it had only been tested in the default configuration where
standalone shell mode is disabled.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 8ade494aeb (win32: add support for virtual terminal input)
made some changes to how input is handled in the line editing code.
In some circumstances (e.g. 'cat | sh -i') this results in input
being read using fgets(3) rather than from the keyboard. Remove
CRs from input in this case.
Also, use fgets(3) if stdin is not a tty, but not stdout.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When the ability to override an applet if an external binary was
present was added, the commit message for bd7018350 said:
This doesn't affect tab completion in the shell: whether a
completion is an applet or an external command is irrelevant.
This isn't quite true. Suppose 'applet' has been overridden in
such circumstances:
$ export BB_OVERRIDE_APPLETS=";applet"
$ applet
If the user now enters tab twice the output would be:
applet applet.exe
The applet is still treated as a potential match. Recent changes
to the applet override code result in a simple fix: the shell PATH
can be passed to is_applet_preferred() in the line editing code.
Now only 'applet.exe' is treated as a match.
Adds 16-32 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Pass the PATH to be used to look up executables down from the shell
to the applet override code. This replaces the use of a static
variable and a function to fetch its value.
Saves 16-32 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The code to replace the user's home directory with '~' in the
prompt didn't allow for the possibility of the HOME environment
variable having backslashes in the path.
Convert backslashes to forward slashes in HOME. This isn't necessary
if the home directory is obtained from getpwuid(3) as it's already
converted there.
Adds 24-32 bytes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add shell options:
- 'nohiddenglob' excludes files with the hidden attribute from
globbing
- 'nohidsysglob' excludes files with the hidden and system attributes
from globbing
If both options are enabled 'nohiddenglob' takes precedence.
These options also affect tab completion.
Files that are hidden because they start with a period aren't
affected (unless they also have the hidden attribute).
Costs 160-208 bytes.
(GitHub issue #367)
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 8ade494 added VT input support and, among others,
disabled inc_cursor (in favor of the upstream busybox code) when
the terminal has VT input enabled.
However, inc_cursor works correctly regardless of the VT mode,
and that condition was not required.
Revert this condition (but still disable inc_cursor with unicode
because it handles wide-glyphs incorrectly).
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
FEATURE_UTF8_MANIFEST enables Unicode args and filenames on Win 10+.
FEATURE_UTF8_INPUT allows the shell prompt to digest correctly
Unicode strings (as UTF8) which are typed or pasted.
This commit adds support for building with FEATURE_UNICODE_SUPPORT
(mostly by supporting 32 bit wchar_t which busybox expects):
- Unicode-aware line-edit - for the most part cursor movement/del
being (UTF8) codepoint-aware rather than assuming that one-byte
equals one-char-on-screen.
- Codepoint-aware operations in some other utils, like rev or wc -c.
- When UNICODE_COMBINING_WCHARS and UNICODE_WIDE_WCHARS are enabled,
some screen-width-aware operations, like with fold, ls, expand, etc.
The busybox Unicode support is incomplete, and even less so with the
builtin libc replacement functions, like wcwidth, which are active
when UNICODE_USING_LOCALE is unset (mingw lacks those functions).
FEATURE_CHECK_UNICODE_IN_ENV should be set so that Unicode is not
hardcoded but rather depends on the ANSI codepage and some env vars:
LC_ALL=C disables Unicode support, else it's enabled if ACP is UTF8.
There's at least one known issue where the tab-completion-prefix-case
is not updated correctly, e.g. ~/desk<tab> completes to ~/desktop/
instead of ~/Desktop/, because the code which handles it exists
only at the non-unicode code paths, but that's not very critical.
That seems to be the only case where mingw-specific code is disabled
when Unicode is enabled, but there could be other unknown issues.
None of the Unicode options is enabled by default, and the next
commit will make it easier to create a build which supports Unicode.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When icanon is set with -echo (e.g. ssh from an emacs shell) then
S.state will remain null but later it will be deferenced causing ash to
crash. Fix: additional check on state.
Signed-off-by: Akos Somfai <akos.somfai@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 8baa643a3 (lineedit: match local directories when searching
PATH) included subdirectories of the current directory in the search
when tab-completing commands.
Unfortunately a short time later commit 1d180cd74 (lineedit: use
strncmp instead of is_prefixed_with (we know the length)) broke
this feature by returning an incorrect length for the array of paths.
Fix the length and reinstate matching of subdirectories.
Signed-off-by: Ron Yorston <rmy@pobox.com>
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)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 8baa643a3 (lineedit: match local directories when searching
PATH) included subdirectories of the current directory in the search
when tab-completing commands.
Unfortunately a short time later commit 1d180cd74 (lineedit: use
strncmp instead of is_prefixed_with (we know the length)) broke
this feature by returning an incorrect length for the array of paths.
Fix the length and reinstate matching of subdirectories.
Signed-off-by: Ron Yorston <rmy@pobox.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Alter certain applets to support virtual terminal input, if enabled.
In many places this is achieved by building previously excluded
upstream terminal-handling code. The busybox-w32 implementation
of termios(3) functions does nothing if virtual terminal input is
disabled, so it can be invoked regardless.
Some applet-specific terminal-handling code is also required.
This affects less, more, vi and command line editing in the shell.
(The `more` applet isn't enabled in the default configuration.)
This series of patches adds about 1.7KB to the binaries.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
record_pending_signo 32 63 +31
lineedit_read_key 231 224 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 31/-7) Total: 24 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|\| |
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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)
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The line editing code and ash disagree when the current directory
is changed to a symbolic link:
~ $ mkdir real
~ $ ln -s real link
~ $ cd link
~/real $ pwd
/home/rmyf36/link
Note the prompt says we're in ~/real. Bash does:
[rmy@random ~]$ cd link
[rmy@random link]$ pwd
/home/rmyf36/link
Ash uses the name supplied by the user while the line editing code
calls getcwd(3). The discrepancy can be avoided by fetching the
value of PWD from ash.
Hush calls getcwd(3) when the directory is changed
so there's no disagreement with the line editing code.
There is no standard how shells should handle cd'ing into
symlinks.
function old new delta
parse_and_put_prompt 838 869 +31
Signed-off-by: Ron Yorston <rmy@pobox.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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Use case-insensitive matching when determining if the directory
name in the prompt can be shortened using '~'.
This doesn't seem to have been a problem, as directories are often
canonicalized, but it doesn't have any great cost.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\|
| |
| |
| |
| |
| |
| |
| | |
Fix conflicts in reset and ash.
Redefine the new safe_read_key() as a reference to read_key().
Disable SHA256_HWACCEL.
|
| |
| |
| |
| |
| |
| |
| | |
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
get_user_strings - 52 +52
get_homedir_or_NULL - 23 +23
parse_and_put_prompt 823 838 +15
null_str 1 - -1
complete_cmd_dir_file 814 812 -2
deinit_S 51 42 -9
read_line_input 3059 3015 -44
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/3 up/down: 90/-56) Total: 34 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
- This can act as memory barrier in clang to avoid
read before assign of a const ptr
Signed-off-by: LoveSy <shana@zju.edu.cn>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
While at it, change all "__asm__" to "asm"
Co-authored-by: canyie <31466456+canyie@users.noreply.github.com>
Signed-off-by: YU Jincheng <shana@zju.edu.cn>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|\| |
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
.rodata 104185 104180 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
file_is_executable() calls access(2) and stat(2); in this case our
WIN32 implementation also calls stat(2). Avoid this unnecessary
duplication by copying the required test from the WIN32 access(2).
In find_executable() it's possible to avoid calling file_is_executable()
if add_win32_extension() returns TRUE as the latter will already have
verified that the file is executable.
Replace a call to file_is_executable() in the tab completion code
with the equivalent tests, avoiding (up to) two calls to stat(2).
These changes don't affect the size of the binary and should be
faster.
|
|\| |
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Fix tab completion for the path when equal sign (=) is used. For
example: dd if=/dev/ze<tab>
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|