function old new delta
complete_cmd_dir_file 811 826 +15
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
To assist in the deployment of shell scripts it may be convenient
to embed them in the BusyBox binary.
'Embed scripts in the binary' takes any files in the directory
'embed', concatenates them with null separators, compresses them
and embeds them in the binary.
When scripts are embedded in the binary, scripts can be run as
'busybox SCRIPT [ARGS]' or by usual (sym)link mechanism.
embed/nologin is provided as an example.
function old new delta
packed_scripts - 123 +123
unpack_scripts - 87 +87
ash_main 1103 1171 +68
run_applet_and_exit 78 128 +50
get_script_content - 32 +32
script_names - 10 +10
expmeta 663 659 -4
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 2/1 up/down: 370/-4) Total: 366 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
At worst show_status_line() might be called needlessly when the
user presses ^L/^R, but I don't think we'll get many complaints
about that.
function old new delta
do_cmd 4592 4558 -34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-34) Total: -34 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Since we're comparing the return value to a smallish integer anyway, we
might as well use that bb_strtou() returns UINT_MAX for malformed
input. Referencing errno is kinda bloaty on glibc.
While NSIG is not in POSIX, we do already rely on it being defined,
compile-time const and smallish, since arrays in struct globals_misc are
defined in terms of it.
function old new delta
get_signum 312 286 -26
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
When an application documents that it responds such and such to
SIGRTMIN+n, that almost always means with respect to the libc-provided
SIGRTMIN. Hence I disagree with the "more correct" in commit
7b276fc175. In any case, this is rather unfortunate:
36
34
(the first shell is bash). We probably can't change default behaviour
after 7 years, but at least we can provide a config option.
We avoid a little code generation (repeated calls to
__libc_current_sigrtmin) by stashing SIGRTMIN/SIGRTMAX in local
variables, but it does cost ~50 bytes. The next patch serves as penance
for that.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Show estimated available memory if this is provided by the
kernel. See [1] for the full story.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
function old new delta
free_main 537 633 +96
parse_cached_kb 85 - -85
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 96/-85) Total: 11 bytes
Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Script uses "ifconfig" only, not up-to-date so much.
This patch adds "ip" in condition if exists.
Signed-off-by: Jiří Prchal <jiri.prchal@aksignal.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Add support for MD5 message authentication as described in RFC 5905.
This patch also supports SHA1 authentication.
The key file format is the same file format as used by ntpd.
The configuration file format follows standard Unix conventions
(# comments) with lines consist of the following fields separated by whitespace:
<key identifier, [1,65535]> <SHA1|MD5> <an ASCII string of up to 20 characters|an octet string [a-zA-F0-9] of up to 40 characters>.
https://www.ietf.org/rfc/rfc5905.txt
function old new delta
ntp_init 473 987 +514
hash - 125 +125
recv_and_process_peer_pkt 889 961 +72
packed_usage 33066 33130 +64
ntpd_main 1226 1277 +51
find_key_entry - 29 +29
add_peers 195 207 +12
recv_and_process_client_pkt 509 514 +5
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 6/0 up/down: 872/0) Total: 872 bytes
Signed-off-by: Brandon P. Enochs <enochs.brandon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Thanks to Cristian Ionescu-Idbohrn for noticing.
Also fix "%d" ' 42' to skip leading whitespace.
function old new delta
print_direc 435 454 +19
bb_strtoll 99 103 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 23/0) Total: 23 bytes
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Support the "source-directory" stanza from ifupdown[1]. source-directory
will include all files in the named directory. Similar to the Busybox
version of the "source" stanza, this version of source-directory does
not currently support shell wildcards.
We only check that the stanza starts with "source-dir" as ifupdown does[2].
[1] https://manpages.debian.org/stretch/ifupdown/interfaces.5.en.html#INCLUDING_OTHER_FILES
[2] https://salsa.debian.org/debian/ifupdown/blob/0.8.33/config.c#L498
function old new delta
read_interfaces 1150 1241 +91
Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The caps were inconsistent: timeout to renew was capped at 20 seconds,
and any renews with timeout <= 60 seconds were forced to broadcast.
function old new delta
udhcpc_main 2683 2680 -3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Exuberant ctags creates an output file called "tags" by default or
"TAGS" when it's run in emacs mode. Add those two files to .gitignore so
they won't be removed by git clean -df.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
If a line in mdev.conf starts with "-", parsing will continue even if
a match is found in that line.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Commit 2da9724b56 broke 'head -n -1' and was
later reverted with 0d598ab9f0.
This commit adds a test case to avoid future breakage.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Managed to make ntpd on one of my machines to be stuck getting
"root distance too high" all the time, but log is not giving me
more informatin what exactly is happening...
function old new delta
select_and_cluster 1045 1095 +50
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
When deleting a directory, the directory should not be removed if the
file in the subdirectory fails to be deleted.
Background information:
When I tested the kernel using LTP (linux-test-project).I found the
mv command have some issue. The LTP test case use the mv command to
move the directory t1 in the cgroup file system to the /tmp directory.
becase files in the cgroup file system are not allowed to be removed.
so the mv reported "Permission denied", but I used the ls command to
view the results and found that the directory t1 had been removed
from the cgroup file system. For the same test case, I used the mv
tool in the GNU coreutils, and the directory t1 will not be removed.
the following testcase use busybox mv:
/ # mount -t cgroup -o cpu cgroup /cpu
/ # cd /cpu
/cpu # mkdir -p t1
/cpu # ls
cgroup.clone_children cpu.cfs_period_us cpu.stat t1
cgroup.procs cpu.cfs_quota_us notify_on_release tasks
cgroup.sane_behavior cpu.shares release_agent
/cpu # mv t1 /tmp
mv: can't remove 't1/cgroup.procs': Operation not permitted
mv: can't remove 't1/cpu.cfs_period_us': Operation not permitted
mv: can't remove 't1/cpu.stat': Operation not permitted
mv: can't remove 't1/cpu.shares': Operation not permitted
mv: can't remove 't1/cpu.cfs_quota_us': Operation not permitted
mv: can't remove 't1/tasks': Operation not permitted
mv: can't remove 't1/notify_on_release': Operation not permitted
mv: can't remove 't1/cgroup.clone_children': Operation not permitted
/cpu # ls
cgroup.clone_children cpu.cfs_period_us cpu.stat cgroup.procs
cpu.cfs_quota_us notify_on_release tasks cgroup.sane_behavior
cpu.shares release_agent
/cpu #
This patch fixed it, don't call rmdir if remove_file return failure,
and under certain file systems, the mv could work normally.
Signed-off-by: Chen Yu <yu.chen3@zte.com.cn>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
If fgets() returns incomplete string, we replace NUL with
'\n', and then trim() runs on a non-NUL-terminated buffer.
Prevent that.
While at it, bump buffer from 1k to 2k.
function old new delta
query 519 524 +5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
- recurse is not acting as expected (looks like broken old code)
- when not using verbose output, return value for retained files is 1,
which is not expected.
Signed-off-by: sagivd <sagivdev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
function old new delta
archivefile 167 176 +9
Signed-off-by: Andre Goddard Rosa <andre.rosa@lge.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Some syslog producers provide inconsistent timestamps, so provide an option
to ignore the message timestamps and always locally timestamp. In order to
implement this, invert the valid-timestamp check, but only use the timestamp
if this option is not enabled.
This is in line with what what other syslogd implementations do:
From sysklogd syslogd.c:
* Sun Nov 7 12:28:47 CET 2004: Martin Schulze <joey@infodrom.org>
* Discard any timestamp information found in received syslog
* messages. This will affect local messages sent from a
* different timezone.
rsyslog's imuxsock module similary has an (enabled by default)
IgnoreTimestamp option:
https://www.rsyslog.com/doc/v8-stable/configuration/modules/imuxsock.html
function old new delta
packed_usage 32877 32912 +35
timestamp_and_log 363 376 +13
syslogd_main 1638 1641 +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 51/0) Total: 51 bytes
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Upstream commit:
Date: Wed, 28 Mar 2018 18:37:51 +0800
expand: Do not quote backslashes in unquoted parameter expansion
Here is a better example:
a="/*/\nullx" b="/*/\null"; printf "%s\n" $a $b
dash currently prints
/*/\nullx
/*/\null
bash prints
/*/\nullx
/dev/null
You may argue the bash behaviour is inconsistent but it actually
makes sense. What happens is that quote removal only applies to
the original token as seen by the shell. It is never applied to
the result of parameter expansion.
Now you may ask why on earth does the second line say "/dev/null"
instead of "/dev/\null". Well that's because it is not the quote
removal step that removed the backslash, but the pathname expansion.
The fact that the /de\v does not become /dev even though it exists
is just the result of the optimisation to avoid unnecessarily
calling stat(2). I have checked POSIX and I don't see anything
that forbids this behaviour.
So going back to dash yes I think we should adopt the bash behaviour
for pathname expansion and keep the existing case semantics.
This patch does exactly that. Note that this patch does not work
unless you have already applied
https://patchwork.kernel.org/patch/10306507/
because otherwise the optimisation mentioned above does not get
detected correctly and we will end up doing quote removal twice.
This patch also updates expmeta to handle naked backslashes at
the end of the pattern which is now possible.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
function old new delta
expmeta 618 653 +35
memtodest 146 147 +1
Tested to work with both ASH_INTERNAL_GLOB on and off.
hush does not handle this correctly.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>