| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| | |
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| | |
Compiles to ~25 bytes if enabled.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Incidentally, this fixes LINENO bug here:
echo "1:${LINENO}"
echo "2:`echo; echo`" # was counting lines in the `cmd` output as LINENO++
echo "3:${LINENO}"
function old new delta
parse_and_run_file 53 71 +18
expand_vars_to_list 1187 1164 -23
setup_file_in_str 25 - -25
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 18/-48) Total: -30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
readtoken1 2602 2608 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Microsoft Windows has only limited support for signals. busybox-w32
initially papered over this fact by adding definitions for unsupported
signals and signal-handling functions.
Remove this fake code and deal with the consequences by excluding
anything that fails to compile as a result.
|
| |
| |
| |
| |
| | |
SIGWINCH isn't available on Microsoft Windows. Make the use of
SIGWINCH configurable and disable it by default.
|
| |
| |
| |
| | |
The only other caller (in spawnveq) has been removed.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Consistent processing of file extensions, as described in the previous
commit, has been applied to the 'which' applet and the functions
find_executable and mingw_spawn_interpreter.
In spawnveq check that the file to be executed exists and is executable,
and ensure that it won't have any extensions added by spawnve.
It's intended that all files passed to spawnve should have their names
fully specified. If this isn't the case the tests here will cause errors
which will need to be fixed.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ash separates searching for commands from running them. Searching
is performed in find_command(). The result of the search is stored
in a hash table but not as the full path: the path is reconstructed
in shellexec() by combining the directory and command name.
In Windows the command name is insufficient, as the executable name
may also include an extension. To resolve this we must ensure that
extensions are processed in the same order in find_command, shellexec
and any other places where command names are resolved into file names.
The order used matches that of spawnve: .com, .exe, .bat, .cmd.
Finally the bare filename with no additional extension
The order has been made consistent:
- in find_command for absolute paths and the Windows-specific path
search;
- in tryexec (which is called by shellexec) where an additional test
that the file is executable has been added;
- in the type and hash built-ins where the output has been modified to
include the extension.
Additionally, the code in tryexec to handle ENOEXEC errors from
execve has been excluded. The rationale for the exec functions
in POSIX [1] suggests the requirement to retry is a workaround
for the lack of '#!' support on some platforms.
[1] http://pubs.opengroup.org/onlinepubs/009695399/functions/exec.html
|
| |
| |
| |
| |
| |
| |
| | |
A filename ending with a dot is a signal to spawnve not to try
adding extensions but to use the name unmodified.
The add_win32_extension function should follow the same rule.
|
| |
| |
| |
| |
| | |
The has_win_suffix function didn't check that the extension started
with a '.'. As a result the shell was unable to execute cmd.exe.
|
| |
| |
| |
| |
| | |
Determine the size of the MINGW_VER string at compile time so it's only
stored once.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Move the code to detect shell scripts and binary executables from
mingw_access to a separate function, has_exec_format. Call this function
in do_lstat to decide whether to set the executable bits in the file mode.
This will slow down stat but has a couple of advantages:
- shell scripts are highlighted in ls output
- the test applet can use stat(2) to detect executable files
The new function is used to handle another corner case in spawnveq:
binary executables without the usual .exe extension are only run by
spawnve if the file name ends with '.'.
Two minor changes:
- file_is_win32_executable has been renamed add_win32_extension to
clarify what it does
- a call to file_is_executable has been removed from find_command
in ash as it resulted in unhelpful error messages.
|
| |
| |
| |
| |
| |
| |
| | |
Set all mode bits rather than just setting user modes and then
extending them to group and other.
Combine common code in mingw_fstat.
|
| |
| |
| |
| |
| | |
Since we're unable to track the file using its device/inode there's
no need to obtain the file's status.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Support batch files with .bat and .cmd extensions, similar to
what's done for .exe and .com.
Check extensions in the same order as Windows' spawn function:
.com, .exe, .bat, .cmd.
|
| | |
|
| |
| |
| |
| |
| | |
Remove some duplicated code and raise an error for unsupported
devices.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Use the new low-level support for /dev/zero and /dev/urandom to
allow shred to work in busybox-w32.
The only change required is to close the file before unlinking it,
as Microsoft Windows won't delete an open file.
|
| |
| |
| |
| |
| |
| | |
Replace internal support for /dev/zero with the newly introduced
device handling in open/read. This reduces the differences
between busybox-w32 and upstream.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently /dev/zero is handled as a special case in dd. Add hacks
to the open and read functions in mingw.c to handle the zero and
urandom devices.
- Opening /dev/zero or /dev/urandom actually opens the special
Windows file 'nul' which behaves like /dev/null. This allows
manipulation of the file descriptor with things like seek and
close
- When /dev/zero or /dev/urandom is opened the resulting file
descriptor is stored and used to override the behaviour of read.
- No attempt is made to track duplicated file descriptors, so using
these devices for redirections in the shell isn't going to work
and won't be permitted. (Could be, but won't.)
- Limited control of the special file descriptors is provided by
allowing the internal variables to be changed.
- The numbers from /dev/urandom aren't very random.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
The copy of inet_pton.c imported from gnulib was licensed under
GPL3 which is incompatible with the GPL2-only licence of BusyBox.
Import an MPL2-licensed version of this file from ISC BIND git
master as of this date.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
As noted in cmdlookup the size of a tblentry instance, *t, is
sizeof(struct tblentry) + strlen(t->cmdname)
because the structure includes one byte for the cmdname array.
Apply the same logic in tblentry_size and tblentry_copy.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
popen uses the shell to run the command provided. If BusyBox has
been configured appropriately use the built-in shell for this.
- Currently the only user of popen in busybox-w32 is awk, which
uses it when piping to or from commands.
- If the command is available as an applet the shell will use it.
If a different version of the program is required the command
will need to specify the full path.
- This change means that popen will work even if no shell is
present on the path.
- Since the binary may have been run as sh.exe or awk.exe it's
necessary to use the magic --busybox option.
|
| |
| |
| |
| |
| | |
The wrong sort of boolean operator resulted in waitpid_child always
being nonblocking.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 18afed0f9 replaced %ll* formats with Windows equivalents to
silence compiler warnings. Some format strings in du were missed
because they weren't compiled or weren't string literals.
These fixes make 'du -h' work as expected on Windows XP.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It turns out that with the new toolchain safe API calls work on all
all platforms. Even the original code from commit fa147bd7e works
on Windows XP when built with the new tools.
- Remove the unsafe environment manipulation via the environ array
- Microsoft's putenv takes a copy of its argument so the string
can be freed
- Rewrite some routines and add more error checking
|
| |
| |
| |
| |
| |
| |
| | |
Busybox knows the path to its own executable even if it isn't on
PATH. Treat this as a special case and print the path.
`which busybox` is used in testsuite/busybox.tests
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
get_sanitized_hdr - 156 +156
fgets_trim_sanitize - 128 +128
ftpcmd 129 133 +4
parse_url 461 454 -7
sanitize_string 14 - -14
wget_main 2431 2381 -50
fgets_and_trim 119 - -119
gethdr 163 - -163
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 1/2 up/down: 288/-353) Total: -65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Test scripts that use CONFIG_* variables need to source .config.
Since this wasn't being done for busybox many tests were skipped.
As a result new failures due to changes in help output were missed.
Also remove some unnecessary echos in the bzcat script.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
the patch getopt32: remove opt_complementary 22542eca18e5807b72ddc78999f5101e33f17a53
introduced a regressed in the cp command since it removed all aliases of arguments
if long_opts is not configured.
Patch by Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
catcher 310 309 -1
arping_main 1668 1641 -27
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
function old new delta
bb_getsockname - 18 +18
xrtnl_open 88 83 -5
do_iplink 1216 1209 -7
arping_main 1686 1668 -18
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/3 up/down: 18/-30) Total: -12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This way, we can zero them all in one go.
We do malloc() anyway, thus nothing is lost by mallocing "globals"
function old new delta
arping_main 1683 1686 +3
finish 100 86 -14
catcher 350 310 -40
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 3/-54) Total: -51 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
arping_main 1629 1635 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ARPING 192.168.1.1 from 192.168.1.172 wlan0
Unicast reply from 192.168.1.1 [F4:F2:6D:52:A8:DE] 1.672ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
ARPING 192.168.1.1 from 192.168.1.172 wlan0
Unicast reply from 192.168.1.1 [f4:f2:6d:52:a8:de] 1.152ms
Sent 1 probe(s) (1 broadcast(s))
Received 1 response(s) (0 request(s), 0 broadcast(s))
function old new delta
finish 120 100 -20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Do not clear extra bits on option_mask32, it's not necessary.
Move DAD bit to 2, this makes exit logic simpler.
function old new delta
arping_main 1655 1629 -26
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
packed_usage 32278 32367 +89
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I don't have an example of mishandled script, but the logic looked wrong:
it could sometimes treat newlines as if they are spaces.
function old new delta
parse_stream 2788 2787 -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Script triggering the bug:
t=0
echo "at line ${LINENO}"
while [ ${t} -lt 10 ]; do
echo "at line ${LINENO}" # LINENO was 3 instead of 4 here
t=$((t+1))
done
function old new delta
parse_stream 2754 2788 +34
done_word 711 738 +27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0) Total: 61 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
parse_rtattr() was using tb[] array without initializing it.
Based on patch by Balaji Punnuru <balaji_punnuru@cable.comcast.com>
function old new delta
parse_rtattr 85 107 +22
print_route 1630 1617 -13
print_linkinfo 807 794 -13
iproute_get 835 822 -13
print_rule 680 665 -15
ll_remember_index 263 248 -15
print_addrinfo 1223 1197 -26
ipaddr_list_or_flush 1253 1223 -30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/7 up/down: 22/-125) Total: -103 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
wget_main 2422 2431 +9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This makes size display 5-char wide instead of 6-char, but now it's smarter
(can show sizes in "12.3M" format).
function old new delta
bb_progress_update 654 622 -32
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
| |
| |
| |
| |
| |
| |
| | |
function old new delta
bb_progress_update 756 654 -102
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|