Commit Graph

522 Commits

Author SHA1 Message Date
Chen Qi
572dfb8e78 testsuite: check CONFIG_DESKTOP before using 'od -t'
The '-t' option for od is enabled by CONFIG_DESKTOP. So
check this config before using 'od -t' in test cases.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-27 16:57:36 +01:00
Bernhard Reutner-Fischer
3db4e7f84c printf: fix printing +-prefixed numbers
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>
2018-10-19 15:27:42 +02:00
Thomas De Schampheleire
6608879d34 head: convert existing tests to new-style
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-09-22 19:40:35 +02:00
Thomas De Schampheleire
e0f617699f head: add test case for negative -n invocation
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>
2018-09-22 19:40:35 +02:00
Denys Vlasenko
e5d5f5b9a7 hexdump: fix short file of zero butes treated as dup
function                                             old     new   delta
bb_dump_dump                                        1466    1491     +25

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-07-03 16:29:06 +02:00
Denys Vlasenko
335766602b testsuite/mount.tests: fix false positive
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-28 14:10:00 +02:00
Denys Vlasenko
4c58f246d4 testsuite/pidof.tests: fix false positive take 2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27 14:50:00 +02:00
Denys Vlasenko
332a191e7f testsuite/tar.tests: fix false positive
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27 14:35:56 +02:00
Denys Vlasenko
33eae28710 testsuite/pidof.tests: fix false positive
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27 14:26:21 +02:00
Denys Vlasenko
94593799f7 testsuite/bzcat.tests: fix false positive take 2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27 13:15:10 +02:00
Denys Vlasenko
d8799b90f3 testsuite/unexpand/unexpand-works-like-GNU: fix false positive
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27 12:54:57 +02:00
Denys Vlasenko
a429d5d0f3 testsuite/bzcat.tests: fix false positive
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27 10:35:45 +02:00
Denys Vlasenko
5738823dff testsuite/tar.tests: fix false positive
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27 10:01:49 +02:00
Denys Vlasenko
751005020d testsuite/cat.tests: fix false positive
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27 09:57:30 +02:00
Denys Vlasenko
a36986bb80 unlzma: close another SEGV possibility
function                                             old     new   delta
unpack_lzma_stream                                  2669    2686     +17

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-05-25 17:03:46 +02:00
Harald van Dijk
8c24af9dcf tar: fix interaction of delayed symlink and hardlink creation
function                                             old     new   delta
create_or_remember_link                                -     106    +106
create_links_from_list                                 -      93     +93
find_applet_by_name                                  124     128      +4
unzip_main                                          2724    2726      +2
data_extract_all                                     891     873     -18
create_symlinks_from_list                             64       -     -64
create_or_remember_symlink                            94       -     -94
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/1 up/down: 205/-176)           Total: 29 bytes

Signed-off-by: Harald van Dijk <harald@gigawatt.nl>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-05-22 17:34:31 +02:00
Denys Vlasenko
d80eecb868 cat: fix cat -e and cat -v erroneously numbering 1st line
function                                             old     new   delta
cat_main                                             418     421      +3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-29 14:05:43 +02:00
Denys Vlasenko
2454e678cb awk: do not allow $(-1)
function                                             old     new   delta
EMSG_NEGATIVE_FIELD                                    -      25     +25
evaluate                                            3390    3403     +13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 38/0)               Total: 38 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-23 10:53:18 +02:00
Denys Vlasenko
e09c426456 unlzma: fix another SEGV case
function                                             old     new   delta
unpack_lzma_stream                                  1705    1717     +12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-19 19:30:51 +02:00
Ron Yorston
1f27fa9838 testsuite: allow tests to work in paths containing spaces
Tweak some tests so they work when the path to the test directory or
$HOME contains spaces.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-09 20:35:48 +02:00
Denys Vlasenko
a1870f4807 unlzma: fix segfault on bad archive
function                                             old     new   delta
unpack_lzma_stream                                  2647    2653      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-08 20:45:16 +02:00
Denys Vlasenko
38ccd6af8a bzip2: fix two crashes on corrupted archives
As it turns out, longjmp'ing into freed stack is not healthy...

function                                             old     new   delta
unpack_usage_messages                                  -      97     +97
unpack_bz2_stream                                    369     409     +40
get_next_block                                      1667    1677     +10
get_bits                                             156     155      -1
start_bunzip                                         212     183     -29
bb_show_usage                                        181     120     -61
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/3 up/down: 147/-91)            Total: 56 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-08 20:05:04 +02:00
Denys Vlasenko
03fd7e06f8 grep: fix echo "aa" | busybox grep -F -w "a" (should not match)
function                                             old     new   delta
grep_file                                           1461    1470      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-03-29 18:03:50 +02:00
Denys Vlasenko
a84db18fc7 tar,unzip: postpone creation of symlinks with "suspicious" targets
This mostly reverts commit bc9bbeb2b8
"libarchive: do not extract unsafe symlinks unless $EXTRACT_UNSAFE_SYMLINKS=1"

Users report that it is somewhat too restrictive. See
https://bugs.busybox.net/show_bug.cgi?id=8411

In particular, this interferes with unpacking of busybox-based
filesystems with links like "sbin/applet" -> "../bin/busybox".

The change is made smaller by deleting ARCHIVE_EXTRACT_QUIET flag -
it is unused since 2010, and removing conditionals on it
allows commonalizing some error message codes.

function                                             old     new   delta
create_or_remember_symlink                             -      94     +94
create_symlinks_from_list                              -      64     +64
tar_main                                            1002    1006      +4
unzip_main                                          2732    2724      -8
data_extract_all                                     984     891     -93
unsafe_symlink_target                                147       -    -147
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/2 up/down: 162/-248)          Total: -86 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-20 16:06:53 +01:00
Ron Yorston
ecaec1dbec testsuite: update busybox and bzcat tests
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>
2018-02-12 15:32:02 +01:00
Denys Vlasenko
6f4a785bd1 awk: fix 'delete array[var--]' decrementing var twice
function                                             old     new   delta
evaluate                                            3395    3390      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-07 01:19:08 +01:00
Denys Vlasenko
9c47c43e07 sed: in '/regexp/cmd1;//cmd2', cmd2 should use the same regexp as cmd1
function                                             old     new   delta
get_address                                          165     211     +46

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-23 17:56:03 +02:00
Denys Vlasenko
bc9bbeb2b8 libarchive: do not extract unsafe symlinks unless $EXTRACT_UNSAFE_SYMLINKS=1
function                                             old     new   delta
unsafe_symlink_target                                  -     147    +147
unzip_main                                          2711    2732     +21
copy_file                                           1657    1678     +21
tar_main                                             999     971     -28
data_extract_all                                    1038     984     -54
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/2 up/down: 189/-82)           Total: 107 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-10 11:52:42 +02:00
Denys Vlasenko
9cf89cdf84 sysctl: fix file parsing, do not require -w for VAR=VAL
function                                             old     new   delta
sysctl_act_on_setting                                  -     451    +451
sysctl_main                                          222     282     +60
packed_usage                                       31744   31793     +49
config_read                                          604     639     +35
sysctl_act_recursive                                 612     163    -449
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 595/-449)          Total: 146 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-05 13:45:22 +02:00
Denys Vlasenko
b920a38dc0 tar: postpone creation of symlinks with "suspicious" targets. Closes 8411
function                                             old     new   delta
data_extract_all                                     968    1038     +70
tar_main                                             952     986     +34
scan_tree                                            258     262      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 108/0)             Total: 108 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-24 17:20:13 +02:00
Ron Yorston
a165603d24 od_bloaty: fix floating point output
Currently od_bloaty does this:

   $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | busybox od -f
   od: invalid character 'F' in type string 'fF'
   $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | busybox od -t fD
   od: invalid character 'D' in type string 'fD'
   $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | busybox od -t f
   0000000
   0000010

The first two occur because the alphabetic length specifier isn't being
properly skipped.  The third is due to the empty length specifier being
treated as alphabetic so we fall off the end of the FDL_sizeof array with
undetermined consequences.  Coreutils defaults to printing a double in
this case.

With this patch the output is:

   $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | ./busybox od -f
   0000000   0.0000000e+00   0.0000000e+00
   0000010
   $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | ./busybox od -t fD
   0000000   0.000000000000000e+00
   0000010
   $ /bin/echo -en '\x00\x00\x00\x00\x00\x00\x00\x00' | ./busybox od -t f
   0000000   0.000000000000000e+00
   0000010

I guess nobody uses BusyBox od to print floating point numbers.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-19 13:12:02 +02:00
Denys Vlasenko
2e989ef232 msh: delete this applet
It's deprecated since 2009 and interferes with make_single_applets.sh tests.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-03 16:56:37 +02:00
Denys Vlasenko
10ad622dc2 Spelling fixes in comments, documentation, tests and examples
By klemens <ka7@github.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-17 16:13:32 +02:00
Denys Vlasenko
ee7f75d94f factor: new applet
thus far only able to factor up to ULLONG_MAX

function                                             old     new   delta
factor_main                                            -     378    +378
packed_usage                                       31427   31502     +75
applet_names                                        2590    2597      +7
applet_main                                         1500    1504      +4
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/0 up/down: 464/0)             Total: 464 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-09 21:18:43 +02:00
Maxime Coste
d2383f57cd paste: new applet
function                                             old     new   delta
paste_main                                             -     493    +493
packed_usage                                       31019   31070     +51
applet_names                                        2569    2575      +6
applet_main                                         1484    1488      +4
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/0 up/down: 554/0)             Total: 554 bytes

Signed-off-by: Maxime Coste <mawww@kakoune.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-03-23 17:35:52 +01:00
Denys Vlasenko
bca4ea8b68 remove "local" bashism from a few scripts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-24 20:52:42 +01:00
Denys Vlasenko
6c73aaff38 cryptpw: support "rounds=NNNNNNN$" thing in salts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-15 21:48:31 +01:00
Denys Vlasenko
265062d59d shells: make hush test optional, rename ASH_BUILTIN_foo -> ASH_foo
This makes hash and ash more symmetrical wrt config menu and config
options.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10 15:13:30 +01:00
Denys Vlasenko
0ffac1cc22 unzip: do not use CDF.extra_len, read local file header. Closes 9536
While at it, shorten many field and variable names.

function                                             old     new   delta
unzip_main                                          2334    2376     +42

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-08 14:14:19 +01:00
Denys Vlasenko
e3c4db8b39 unzip: properly use CDF to find compressed files. Closes 9536
function                                             old     new   delta
unzip_main                                          2437    2350     -87

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-05 11:43:53 +01:00
Denys Vlasenko
76de3257f7 randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-12 19:17:12 +01:00
Denys Vlasenko
df25df784f randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-12 14:33:53 +01:00
Denys Vlasenko
de912f0153 randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-12 11:08:51 +01:00
Denys Vlasenko
52ae098011 randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-12 09:26:16 +01:00
Denys Vlasenko
ccc9985c45 find: fix handling of trailing slashes in -name PATTERN comparisons
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-25 20:14:33 +01:00
Aaro Koskinen
cb810c48c0 patch: fix matching failure
Fix matching failure when plist is advanced while checking for buffered
lines - the lines in the hunk that are about to be added should be
skipped when checking for matching context.

Also add a valid test case that fails with current busybox and is fixed
by the change.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-24 11:40:36 +01:00
Denys Vlasenko
1924e99ad3 Make grep/egrep/fgrep independently selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14 05:09:48 +01:00
Denys Vlasenko
9655f95d0f tar: handle pax-encoded utf8 filenames and link names. Closes 9406
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-11 17:56:45 +01:00
Aaro Koskinen
46443a383c cpio: add ownership (-R) test cases
Add ownership (-R) test cases.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-04 22:32:46 +01:00
Brian Foley
61d5997b58 awk: fix segfault on for loop syntax error
Parsing "for()" segfaults as awk fails to find loop iteration expressions.

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-24 02:09:56 +02:00