| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
attach_option 411 406 -5
dname_enc 381 167 -214
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-219) Total: -219 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
sysctl_act_recursive 165 179 +14
sysctl_act_on_setting 467 471 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 18/0) Total: 18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Prior to the patch, both -f and --first-only are in all cases either
no-op or ignored.
Without --tabs, --first-only is the default so specifying it is a no-op.
With --tabs, --all is implied, and --first-only is intended to reset this.
function old new delta
expand_main 690 694 +4
Signed-off-by: Mark Edgar <medgar123@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| | |
Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Incorporated valid_domain_label into good_hostname to simplify the implementation.
function old new delta
static.xmalloc_optname_optval 973 958 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-15) Total: -15 bytes
text data bss dec hex filename
993144 16915 1872 1011931 f70db busybox_old
993129 16915 1872 1011916 f70cc busybox_unstripped
Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
parse_expr 887 896 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The chattr and lsattr utilities allow file attributes to be changed
and displayed. Modify them to support Windows file attributes using
the same names as Cygwin.
Only allow a limited subset of attributes to be changed: just most of
those supported by SetFileAttributes(). Since it isn't possible to set
all attributes the '=' operator isn't allowed.
|
| |
| |
| |
| |
| |
| |
| | |
On Unix 'ls' treats filenames starting with a dot as hidden and
only displays them if the '-a' or '-A' option is given.
Extend similar treatment to files with the Windows hidden flag.
|
| |
| |
| |
| |
| |
| | |
Until now the emulated stat(2) system calls have only returned a
synthesised Unix-style mode value. Also return the raw Windows
file attributes.
|
| |
| |
| |
| |
| |
| | |
The Windows-specific shell options winxp, noconsole and nocaseglob
have had the wrong indices in optlist since the merge with upstream
BusyBox in commit 517cf74f6.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Be more strict about identifying UNC paths in unc_root_len().
In updatepwd() in ash:
- Skip duplicate leading slashes unless the directory is a UNC path.
- Rewrite detection and handling of the five possible types of path.
This improves cases like 'cd ///' and 'cd /xyz' when the current
directory is a UNC path.
See GitHub issue #192.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Microsoft developers have a penchant for adding trailing slashes to
entries in PATH:
C:/Windows/System32/WindowsPowerShell/v1.0/
C:/Windows/System32/OpenSSH/
The 'type' and 'command -v' shell builtins return paths with duplicated
slashes for executables in those directories. See GitHub issue #191.
Bonus fixes:
- handle backslashes as well as slashes in concat_path_file()
- convert backslashes to slashes in the output of 'type', 'command -v'
|
| |
| |
| |
| |
| |
| |
| |
| | |
Alter argv_size()/argv_copy() to omit argv from the forkshell
block if it's NULL.
Improve forkshell debug code to properly account for parts of
funcblock which aren't being used.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make ctrl-c handling more like Unix. Remove the hSIGINT event and the
code in waitpid_child() to catch it. Add a call to raise_interrupt()
in ctrl_handler().
Prior to these changes interrupts in a child shell weren't properly
handled. In release FRP-3466-g53c09d0e1 interrupting a sleep in a
child shell results in both shells competing for input:
~ $ sh
~ $ sleep 10
^C^C
~ $ ~ $ pwd
sh: w: not found
~ $
sh: pd: not found
~ $
With recent changes:
~ $ sh
~ $ sleep 10
^C
~ $ echo $?
130
~ $ exit
^C
~ $ echo $?
130
~ $
The error return from the parent shell is due to the lack of job
control. Upstream BusyBox ash and dash both do the same when job
control is disabled.
|
| | |
|
| |
| |
| |
| |
| | |
It isn't necessary to pass the alias table or line editing history
to a forkshell shell that's handling FS_SHELLEXEC.
|
| |
| |
| |
| |
| |
| |
| |
| | |
When handling FS_OPENHERE the forkshell data block only needs to
contain the forkshell structure and the here document. Omit
everything else.
Update forkshell_print() for this case.
|
| |
| |
| |
| |
| | |
Don't pass global pointers to forkshell_size()/forkshell_copy()
via the forkshell structure, just reference them directly.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Change how busybox.exe expands wildcards on the command line.
When globbing is enabled at compile time provide an implementation
of _setargv(), which is run early during startup of C programs. This:
- enables globbing by setting _dowildcard to -1
- checks for the presence of the environment BB_GLOBBING
- if it exists and is set to 0 disables globbing
- if it doesn't exist sets BB_GLOBBING=0 but continues to apply
Windows' globbing in the current process
The consequences of this are:
- When busybox.exe is initially run from a Command Prompt Windows'
globbing is applied;
- Windows' globbing is turned off for future child processes, thus
allowing the shell re-execute busybox.exe without it interfering
with wildcards;
- this behaviour can be overridden by setting BB_GLOBBING explicitly.
Globbing can still be disabled at compile time if required. In that
case BB_GLOBBING has no effect.
With these changes globbing can be enabled by default and BusyBox
will do the right thing in most circumstances.
(See GitHub issues #172 and #189.)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The function mingw_spawn_forkshell() was introduced to handle
spawning a forkshell process. Since we know that:
- the binary being executed doesn't meet any of the special cases
handled by spawnveq()
- the arguments don't require quoting
we can call spawnve() directly instead of spawnveq().
Also, use xzalloc() to allocate new_argv so we don't need to set
the final NULL pointer explicitly.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In standalone shell mode tryexec() treats all applets as NOEXEC.
Except for the shell: calling ash_main() recursively seems unwise.
This avoids creating a new process for the applet (which is a Good
Thing on Microsoft Windows where creating processes is expensive) but
leaves the resources used by the invoking shell in the current process.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There's no need to create or initialise the global data structures
when a forkshell is being started: they'll soon be replaced by
data from the forkshell data block.
Move the call to forkshell_init() to the top of ash_main() along
with some initialisation that's common to forkshell shells and
ordinary shells. Add the minimum necessary initialisation to
forkshell_init().
|
| |
| |
| |
| | |
Modern versions of MinGW-w64 define more console modes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Users have a reasonable expectation that printf should be able
to construct ANSI escape sequences and have them take effect.
This expectation isn't met because printf tends to output one
character at a time whereas busybox-w32 needs escape sequences
to be output contiguously
Force printf to output contiguous text in two cases:
- literal text in the format string
- string arguments output using the '%b' format specifier
(See GitHub issue #189.)
|
| |
| |
| |
| |
| |
| |
| | |
In the 64-bit build the time applet reported garbage when it was
unable to run the program to be timed.
The error return from mingw_spawn_pid() was incorrect.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The subprocess that handles incoming connections for httpd didn't
work. It has an accepted connection on stdin and calls getpeername()
to obtain its details, but getpeername() didn't initialise networking.
ssl_client only seems to deal with file descriptors. Expose
init_winsock() again and call it from ssl_client.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Only a handful of functions are used from shell32.dll, userenv.dll
and psapi.dll. Mostly these functions are in out of the way places.
By loading the functions only when required we can avoid the startup
cost of linking the three DLLs in the common case that they aren't
needed.
|
| |
| |
| |
| |
| |
| | |
A call to initialise networking is made during start up even if
the applet doesn't need it. Instead, only initialise networking
when a call is made to a function that definitely requires it.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The forkshell child process calls init(), which mostly just initialises
shell variables. Since these variables are overwritten with values from
the parent process there's no point in doing that.
In particular, init() initialises HOSTNAME by calling gethostname()
which involves network access and is slow. Avoid this cost when
we know the shell is a forkshell child.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
spawn_forkshell() uses mingw_spawn_proc() to start the child shell.
mingw_spawn_proc() then calls mingw_spawn_1() which determines
that "sh" is an applet, thus calling mingw_spawn_applet() which
finally calls spawnveq().
Not only is this convoluted it also won't work if PREFER_APPLETS
and SH_STANDALONE aren't enabled.
Simplify matters by adding a new function, mingw_spawn_forkshell(),
which is tailored for just this case.
|
| |
| |
| |
| |
| |
| |
| |
| | |
forkshell_prepare() now returns NULL if it fails to map its view of
the data block. Detect and report this error in spawn_forkshell().
If forkshell_init() fails it now returns to ash_main() where a generic
error is reported.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The name of the output file depended only on the pid of the shell.
Since a single shell can execute many forkshells it's useful to
include a serial number in the filename so it isn't constantly
overwritten.
Also, output the type of forkshell.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When ENABLE_FEATURE_WGET_OPENSSL is enabled, correctly implement TLS
verification by default. And only ignore verification errors, if
--no-check-certificate was passed.
Also note, that previously OPENSSL implementation did not implement
TLS verification, nor printed any warning messages that verification
was not performed.
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1879533
CVE-2018-1000500
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
show_history() checks that its argument in non-null so there's
no need to repeat the test at call sites.
function old new delta
historycmd 25 17 -8
builtin_history 29 21 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-16) Total: -16 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
mim runs scripts from a specification file which can be thought
of as an extremely limited Makefile. Neither make variables nor
dependencies are supported. By default the file 'Mimfile' is read.
An example:
hello:
echo hello $1
clean:
rm -rf *
The command 'mim' or 'mim hello' will echo 'hello'. Unlike 'make'
arguments after the first are available to the script; they don't
specify additional targets.
mim isn't enabled by default. Enabling it increases the size of the
binary by about 500 bytes.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since commit 7eb8eecbb (ash: eval: Add assignment built-in support
again) building BusyBox with the 'command' built-in disabled fails.
parse_command_args() only needs to be called when the 'command'
built-in is run. Which it won't be if it's disabled.
v2: Avoiding infinite loops is good, too. Thanks, Harald van Dijk.
Reported-by: Deweloper <deweloper@wp.pl>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When BusyBox is compiled with NOMMU enabled running httpd with
the '-h' option fails even if the specified directory exists:
$ ls -d www
www
$ busybox httpd -fvvvp 8080 -h www
...
... try to access http://localhost:8080/www
...
httpd: can't change directory to 'www': No such file or directory
The parent process executes xchdir("www"). When a connection is accepted
it's handled by re-executing httpd in inetd mode. The child process
inherits the current directory "www" and tries to change directory again
to "www", which fails.
Omit the call to xchdir() when httpd is re-executed.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
From POSIX.1-2008:
The pattern_list's value shall consist of one or more patterns
separated by <newline> characters;
As such, given patterns need to be split at newline characters. Without
doing so, busybox grep will interpret the newline as part of the pattern
which is not in accordance with POSIX.
See also: https://bugs.busybox.net/show_bug.cgi?id=12721
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Grep currently special-cased empty pattern file to be the same as
pattern file with one empty line (empty pattern). That does mirror how
GNU grep behaves, except when -x is provided. In that case .* pattern
needs to be used instead.
Signed-off-by: Gray Wolf <wolf@wolfsden.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since commit 1ff7002b1 (xargs: fix handling of quoted arguments, closes
11441) the -n option hasn't worked properly:
$ echo 1 2 3 | xargs -n 1 echo
1
2
3
$
Because state is now remembered between calls to process_stdin() it's
necessary to update the state before any premature return.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When using GNU Make >=4.3, the KBUILD_STR() definition interferes badly
with dependency checks during build, and forces a complete rebuild every
time Make runs.
In if_changed_rule, Kconfig checks if the command used to build a file
has changed since last execution. The previous command is stored in the
generated .<file>.o.cmd file. For example applets/.applets.o.cmd defines
a "cmd_applets/applets.o" variable:
cmd_applets/applets.o := gcc ... -D"KBUILD_STR(s)=#s" ...
Here the '#' should be escaped with a backslash, otherwise GNU Make
interprets it as starting a comment, and ignore the rest of the
variable. As a result of this truncation, the previous command doesn't
equal the new command and Make rebuilds each target.
The problem started to appear when GNU Make 4.3 (released January 2020),
introduced a backward-incompatible fix to macros containing a '#'. While
the above use of '#', a simple Make variable, still needs to be escaped,
a '#' within a function invocation doesn't need to be escaped anymore.
As Martin Dorey explained on the GNU Make discussion [1], the above
declaration is generated from make-cmd, defined as:
make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))
Since GNU Make 4.3, the first argument of subst should not have a
backslash. make-cmd now looks for literally \# and doesn't find it, and
as a result doesn't add the backslash when generating .o.cmd files.
[1] http://savannah.gnu.org/bugs/?20513
We could fix it by changing make-cmd to "$(subst #,\#,...)", but to
avoid compatibility headaches, simply get rid of the KBUILD_STR
definition, as done in Linux by b42841b7bb62 ("kbuild: Get rid of
KBUILD_STR"). Quote the string arguments directly rather than asking the
preprocessor to quote them.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
The official Info-Zip unzip creates the dir if it doesn't exist.
Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| | |
|
| | |
|
| |
| |
| |
| | |
MinGW is no longer supported in EPEL.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Since the earliest days of busybox-w32 '#!' has searched PATH for
the interpreter. This doesn't seem to be supported by precedent.
In testing I also found that additional code was needed for the case
where PATH has been altered in the current shell or is modified on
the command line: PATH has to be extracted from envp rather than
getenv("PATH"). Drop this non-standard feature.
*NIX implementations disagree on whether the interpreter can itself
be a script. Follow Linux and allow this with a limit of four levels
of nesting.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit e6680912a (dd: create a sparse file when seek=N is used)
broke the use of 'conv=notrunc seek=N' to modify existing files.
Rename seek_sparse() to make_sparse() and:
- add an argument to specify the start of the sparse region;
- call make_sparse() before ftruncate();
- call make_sparse() only if:
* we can determine the size of the file;
* the file is not open in append mode;
* the file is being extended.
This should fix GitHub issue #186.
|