mirror of
https://github.com/sheumann/hush.git
synced 2024-12-26 10:32:02 +00:00
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
08f0b784fd
commit
9297dbc9d2
@ -6,8 +6,6 @@
|
|||||||
*
|
*
|
||||||
* Licensed under GPLv2, see file License in this tarball for details.
|
* Licensed under GPLv2, see file License in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include "busybox.h"
|
#include "busybox.h"
|
||||||
|
|
||||||
#if ENABLE_BUILD_LIBBUSYBOX
|
#if ENABLE_BUILD_LIBBUSYBOX
|
||||||
|
@ -387,7 +387,7 @@ IF_DESKTOP(long long) int FAST_FUNC unpack_unxz(unpack_info_t *info UNUSED_PARAM
|
|||||||
int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int unxz_main(int argc UNUSED_PARAM, char **argv)
|
int unxz_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
int opts = getopt32(argv, "cfvdt");
|
IF_XZ(int opts =) getopt32(argv, "cfvdt");
|
||||||
# if ENABLE_XZ
|
# if ENABLE_XZ
|
||||||
/* xz without -d or -t? */
|
/* xz without -d or -t? */
|
||||||
if (applet_name[2] == '\0' && !(opts & (OPT_DECOMPRESS|OPT_TEST)))
|
if (applet_name[2] == '\0' && !(opts & (OPT_DECOMPRESS|OPT_TEST)))
|
||||||
|
@ -38,6 +38,7 @@ INSERT
|
|||||||
lib-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o
|
lib-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o
|
||||||
lib-$(CONFIG_BUNZIP2) += decompress_bunzip2.o
|
lib-$(CONFIG_BUNZIP2) += decompress_bunzip2.o
|
||||||
lib-$(CONFIG_UNLZMA) += decompress_unlzma.o
|
lib-$(CONFIG_UNLZMA) += decompress_unlzma.o
|
||||||
|
lib-$(CONFIG_UNXZ) += decompress_unxz.o
|
||||||
lib-$(CONFIG_CPIO) += get_header_cpio.o
|
lib-$(CONFIG_CPIO) += get_header_cpio.o
|
||||||
lib-$(CONFIG_DPKG) += $(DPKG_FILES)
|
lib-$(CONFIG_DPKG) += $(DPKG_FILES)
|
||||||
lib-$(CONFIG_DPKG_DEB) += $(DPKG_FILES)
|
lib-$(CONFIG_DPKG_DEB) += $(DPKG_FILES)
|
||||||
|
@ -195,7 +195,11 @@ void lbb_prepare(const char *applet
|
|||||||
#if ENABLE_FEATURE_INDIVIDUAL
|
#if ENABLE_FEATURE_INDIVIDUAL
|
||||||
/* Redundant for busybox (run_applet_and_exit covers that case)
|
/* Redundant for busybox (run_applet_and_exit covers that case)
|
||||||
* but needed for "individual applet" mode */
|
* but needed for "individual applet" mode */
|
||||||
if (argv[1] && !argv[2] && strcmp(argv[1], "--help") == 0) {
|
if (argv[1]
|
||||||
|
&& !argv[2]
|
||||||
|
&& strcmp(argv[1], "--help") == 0
|
||||||
|
&& strncmp(applet, "busybox", 7) != 0
|
||||||
|
) {
|
||||||
/* Special case. POSIX says "test --help"
|
/* Special case. POSIX says "test --help"
|
||||||
* should be no different from e.g. "test --foo". */
|
* should be no different from e.g. "test --foo". */
|
||||||
if (!ENABLE_TEST || strcmp(applet_name, "test") != 0)
|
if (!ENABLE_TEST || strcmp(applet_name, "test") != 0)
|
||||||
|
14
shell/hush.c
14
shell/hush.c
@ -117,6 +117,10 @@
|
|||||||
* and therefore waitpid will return the same result as last time)
|
* and therefore waitpid will return the same result as last time)
|
||||||
*/
|
*/
|
||||||
#define ENABLE_HUSH_FAST 0
|
#define ENABLE_HUSH_FAST 0
|
||||||
|
/* TODO: implement simplified code for users which do not need ${var%...} ops
|
||||||
|
* So far ${var%...} ops are always enabled:
|
||||||
|
*/
|
||||||
|
#define ENABLE_HUSH_DOLLAR_OPS 1
|
||||||
|
|
||||||
|
|
||||||
#if BUILD_AS_NOMMU
|
#if BUILD_AS_NOMMU
|
||||||
@ -2681,7 +2685,7 @@ static NOINLINE int expand_vars_to_list(o_string *output, int n, char *arg, char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (exp_op == ':') {
|
} else if (exp_op == ':') {
|
||||||
#if ENABLE_HUSH_BASH_COMPAT
|
#if ENABLE_HUSH_BASH_COMPAT && ENABLE_SH_MATH_SUPPORT
|
||||||
/* It's ${var:N[:M]} bashism.
|
/* It's ${var:N[:M]} bashism.
|
||||||
* Note that in encoded form it has TWO parts:
|
* Note that in encoded form it has TWO parts:
|
||||||
* var:N<SPECIAL_VAR_SYMBOL>M<SPECIAL_VAR_SYMBOL>
|
* var:N<SPECIAL_VAR_SYMBOL>M<SPECIAL_VAR_SYMBOL>
|
||||||
@ -5820,7 +5824,7 @@ static int parse_group(o_string *dest, struct parse_context *ctx,
|
|||||||
/* command remains "open", available for possible redirects */
|
/* command remains "open", available for possible redirects */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_HUSH_TICK || ENABLE_SH_MATH_SUPPORT
|
#if ENABLE_HUSH_TICK || ENABLE_SH_MATH_SUPPORT || ENABLE_HUSH_DOLLAR_OPS
|
||||||
/* Subroutines for copying $(...) and `...` things */
|
/* Subroutines for copying $(...) and `...` things */
|
||||||
static void add_till_backquote(o_string *dest, struct in_str *input);
|
static void add_till_backquote(o_string *dest, struct in_str *input);
|
||||||
/* '...' */
|
/* '...' */
|
||||||
@ -5976,7 +5980,7 @@ static int add_till_closing_bracket(o_string *dest, struct in_str *input, unsign
|
|||||||
}
|
}
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_HUSH_TICK || ENABLE_SH_MATH_SUPPORT */
|
#endif /* ENABLE_HUSH_TICK || ENABLE_SH_MATH_SUPPORT || ENABLE_HUSH_DOLLAR_OPS */
|
||||||
|
|
||||||
/* Return code: 0 for OK, 1 for syntax error */
|
/* Return code: 0 for OK, 1 for syntax error */
|
||||||
#if BB_MMU
|
#if BB_MMU
|
||||||
@ -6082,7 +6086,11 @@ static int parse_dollar(o_string *as_string,
|
|||||||
again:
|
again:
|
||||||
if (!BB_MMU)
|
if (!BB_MMU)
|
||||||
pos = dest->length;
|
pos = dest->length;
|
||||||
|
#if ENABLE_HUSH_DOLLAR_OPS
|
||||||
last_ch = add_till_closing_bracket(dest, input, end_ch);
|
last_ch = add_till_closing_bracket(dest, input, end_ch);
|
||||||
|
#else
|
||||||
|
#error Simple code to only allow ${var} is not implemented
|
||||||
|
#endif
|
||||||
if (as_string) {
|
if (as_string) {
|
||||||
o_addstr(as_string, dest->data + pos);
|
o_addstr(as_string, dest->data + pos);
|
||||||
o_addchr(as_string, last_ch);
|
o_addchr(as_string, last_ch);
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
# Licensed under GPL v2, see file LICENSE for details.
|
# Licensed under GPL v2, see file LICENSE for details.
|
||||||
|
|
||||||
. ./testing.sh
|
. ./testing.sh
|
||||||
|
|
||||||
test -f "$bindir/.config" && . "$bindir/.config"
|
test -f "$bindir/.config" && . "$bindir/.config"
|
||||||
|
|
||||||
test x"CONFIG_SCRIPT" = x"y" || exit 0
|
test x"CONFIG_SCRIPT" = x"y" || exit 0
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
# Licensed under GPL v2, see file LICENSE for details.
|
# Licensed under GPL v2, see file LICENSE for details.
|
||||||
|
|
||||||
. ./testing.sh
|
. ./testing.sh
|
||||||
|
|
||||||
test -f "$bindir/.config" && . "$bindir/.config"
|
test -f "$bindir/.config" && . "$bindir/.config"
|
||||||
|
|
||||||
# testing "test name" "command" "expected result" "file input" "stdin"
|
# testing "test name" "command" "expected result" "file input" "stdin"
|
||||||
|
@ -99,7 +99,7 @@ SKIP=
|
|||||||
|
|
||||||
# chown on a link was affecting file, dropping its suid/sgid bits
|
# chown on a link was affecting file, dropping its suid/sgid bits
|
||||||
rm -rf cpio.testdir
|
rm -rf cpio.testdir
|
||||||
optional FEATURE_CPIO_O
|
optional FEATURE_CPIO_O FEATURE_STAT_FORMAT
|
||||||
mkdir cpio.testdir
|
mkdir cpio.testdir
|
||||||
touch cpio.testdir/file
|
touch cpio.testdir/file
|
||||||
chmod 6755 cpio.testdir/file # sets suid/sgid bits
|
chmod 6755 cpio.testdir/file # sets suid/sgid bits
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
unset LANG
|
||||||
|
|
||||||
dt=`busybox date -d 1:2 +%T`
|
dt=`busybox date -d 1:2 +%T`
|
||||||
test x"$dt" = x"01:02:00"
|
test x"$dt" = x"01:02:00"
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# Licensed under GPL v2, see file LICENSE for details.
|
# Licensed under GPL v2, see file LICENSE for details.
|
||||||
|
|
||||||
. ./testing.sh
|
. ./testing.sh
|
||||||
|
test -f "$bindir/.config" && . "$bindir/.config"
|
||||||
|
|
||||||
# testing "test name" "options" "expected result" "file input" "stdin"
|
# testing "test name" "options" "expected result" "file input" "stdin"
|
||||||
|
|
||||||
@ -12,13 +13,13 @@ testing "expand" \
|
|||||||
"" \
|
"" \
|
||||||
"\t12345678\t12345678\n"
|
"\t12345678\t12345678\n"
|
||||||
|
|
||||||
optional UNICODE_SUPPORT
|
test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
|
||||||
|
&& test x"$CONFIG_UNICODE_USING_LOCALE" != x"y" \
|
||||||
|
&& test "$CONFIG_LAST_SUPPORTED_WCHAR" -gt "916" \
|
||||||
testing "expand with unicode characher 0x394" \
|
testing "expand with unicode characher 0x394" \
|
||||||
"expand" \
|
"expand" \
|
||||||
"Δ 12345ΔΔΔ 12345678\n" \
|
"Δ 12345ΔΔΔ 12345678\n" \
|
||||||
"" \
|
"" \
|
||||||
"Δ\t12345ΔΔΔ\t12345678\n"
|
"Δ\t12345ΔΔΔ\t12345678\n"
|
||||||
SKIP=
|
|
||||||
|
|
||||||
|
|
||||||
exit $FAILCOUNT
|
exit $FAILCOUNT
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# Licensed under GPL v2, see file LICENSE for details.
|
# Licensed under GPL v2, see file LICENSE for details.
|
||||||
|
|
||||||
. ./testing.sh
|
. ./testing.sh
|
||||||
|
test -f "$bindir/.config" && . "$bindir/.config"
|
||||||
|
|
||||||
# testing "test name" "options" "expected result" "file input" "stdin"
|
# testing "test name" "options" "expected result" "file input" "stdin"
|
||||||
|
|
||||||
@ -28,9 +29,10 @@ be preserved
|
|||||||
is here:>\0< - they must be preserved
|
is here:>\0< - they must be preserved
|
||||||
" \
|
" \
|
||||||
|
|
||||||
optional UNICODE_SUPPORT
|
|
||||||
# The text was taken from English and Ukrainian wikipedia pages
|
# The text was taken from English and Ukrainian wikipedia pages
|
||||||
testing "fold -sw66 with unicode input" "fold -sw66" \
|
test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
|
||||||
|
&& test x"$CONFIG_UNICODE_USING_LOCALE" != x"y" \
|
||||||
|
&& testing "fold -sw66 with unicode input" "fold -sw66" \
|
||||||
"\
|
"\
|
||||||
The Andromeda Galaxy (pronounced /ænˈdrɒmədə/, also known as \n\
|
The Andromeda Galaxy (pronounced /ænˈdrɒmədə/, also known as \n\
|
||||||
Messier 31, M31, or NGC224; often referred to as the Great \n\
|
Messier 31, M31, or NGC224; often referred to as the Great \n\
|
||||||
@ -56,6 +58,5 @@ Way.
|
|||||||
спіральна галактика, що знаходиться на відстані приблизно у 2,5 \
|
спіральна галактика, що знаходиться на відстані приблизно у 2,5 \
|
||||||
мільйони світлових років від нашої планети у сузір'ї Андромеди. \
|
мільйони світлових років від нашої планети у сузір'ї Андромеди. \
|
||||||
На початку ХХІ ст. в центрі галактики виявлено чорну дірку."
|
На початку ХХІ ст. в центрі галактики виявлено чорну дірку."
|
||||||
SKIP=
|
|
||||||
|
|
||||||
exit $FAILCOUNT
|
exit $FAILCOUNT
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
# Licensed under GPL v2, see file LICENSE for details.
|
# Licensed under GPL v2, see file LICENSE for details.
|
||||||
|
|
||||||
. ./testing.sh
|
. ./testing.sh
|
||||||
|
|
||||||
test -f "$bindir/.config" && . "$bindir/.config"
|
test -f "$bindir/.config" && . "$bindir/.config"
|
||||||
|
|
||||||
rm -rf ls.testdir >/dev/null
|
rm -rf ls.testdir 2>/dev/null
|
||||||
mkdir ls.testdir || exit 1
|
mkdir ls.testdir || exit 1
|
||||||
|
|
||||||
# testing "test name" "command" "expected result" "file input" "stdin"
|
# testing "test name" "command" "expected result" "file input" "stdin"
|
||||||
@ -15,9 +14,10 @@ mkdir ls.testdir || exit 1
|
|||||||
# I suspect we might fail to skip exactly correct number of bytes
|
# I suspect we might fail to skip exactly correct number of bytes
|
||||||
# over broked unicode sequences.
|
# over broked unicode sequences.
|
||||||
test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
|
test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
|
||||||
&& test x"$CONFIG_LOCALE_SUPPORT" != x"y" \
|
&& test x"$CONFIG_UNICODE_USING_LOCALE" != x"y" \
|
||||||
&& test x"$CONFIG_SUBST_WCHAR" = x"63" \
|
&& test x"$CONFIG_SUBST_WCHAR" = x"63" \
|
||||||
&& test x"$CONFIG_LAST_SUPPORTED_WCHAR" = x"767" \
|
&& test x"$CONFIG_LAST_SUPPORTED_WCHAR" = x"767" \
|
||||||
|
&& test x"$CONFIG_FEATURE_LS_SORTFILES" = x"y" \
|
||||||
&& testing "ls unicode test with codepoints limited to 767" \
|
&& testing "ls unicode test with codepoints limited to 767" \
|
||||||
"(cd ls.testdir && sh ../ls.mk_uni_tests) && ls -1 ls.testdir" \
|
"(cd ls.testdir && sh ../ls.mk_uni_tests) && ls -1 ls.testdir" \
|
||||||
'0001_1__Some_correct_UTF-8_text___________________________________________|
|
'0001_1__Some_correct_UTF-8_text___________________________________________|
|
||||||
@ -134,7 +134,7 @@ test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
|
|||||||
|
|
||||||
# Currently fails on "0080_4.2.2__U-000007FF_=_e0_9f_bf" line
|
# Currently fails on "0080_4.2.2__U-000007FF_=_e0_9f_bf" line
|
||||||
test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
|
test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
|
||||||
&& test x"$CONFIG_LOCALE_SUPPORT" != x"y" \
|
&& test x"$CONFIG_UNICODE_USING_LOCALE" != x"y" \
|
||||||
&& test x"$CONFIG_SUBST_WCHAR" = x"63" \
|
&& test x"$CONFIG_SUBST_WCHAR" = x"63" \
|
||||||
&& test x"$CONFIG_LAST_SUPPORTED_WCHAR" = x"0" \
|
&& test x"$CONFIG_LAST_SUPPORTED_WCHAR" = x"0" \
|
||||||
&& testing "ls unicode test with unlimited codepoints" \
|
&& testing "ls unicode test with unlimited codepoints" \
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
# Licensed under GPL v2, see file LICENSE for details.
|
# Licensed under GPL v2, see file LICENSE for details.
|
||||||
|
|
||||||
. ./testing.sh
|
. ./testing.sh
|
||||||
|
|
||||||
test -f "$bindir/.config" && . "$bindir/.config"
|
test -f "$bindir/.config" && . "$bindir/.config"
|
||||||
|
|
||||||
test "`id -u`" = 0 || {
|
test "`id -u`" = 0 || {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# Licensed under GPL v2, see file LICENSE for details.
|
# Licensed under GPL v2, see file LICENSE for details.
|
||||||
|
|
||||||
. ./testing.sh
|
. ./testing.sh
|
||||||
|
test -f "$bindir/.config" && . "$bindir/.config"
|
||||||
|
|
||||||
# testing "test name" "options" "expected result" "file input" "stdin"
|
# testing "test name" "options" "expected result" "file input" "stdin"
|
||||||
|
|
||||||
@ -30,9 +31,10 @@ testing "unexpand case 7" "unexpand" \
|
|||||||
testing "unexpand case 8" "unexpand" \
|
testing "unexpand case 8" "unexpand" \
|
||||||
"a b\n" "" "a b\n" \
|
"a b\n" "" "a b\n" \
|
||||||
|
|
||||||
optional UNICODE_SUPPORT
|
test x"$CONFIG_UNICODE_SUPPORT" = x"y" \
|
||||||
|
&& test x"$CONFIG_UNICODE_USING_LOCALE" != x"y" \
|
||||||
|
&& test "$CONFIG_LAST_SUPPORTED_WCHAR" -gt "916" \
|
||||||
testing "unexpand with unicode characher 0x394" "unexpand" \
|
testing "unexpand with unicode characher 0x394" "unexpand" \
|
||||||
"1ΔΔΔ5\t99999\n" "" "1ΔΔΔ5 99999\n"
|
"1ΔΔΔ5\t99999\n" "" "1ΔΔΔ5 99999\n"
|
||||||
SKIP=
|
|
||||||
|
|
||||||
exit $FAILCOUNT
|
exit $FAILCOUNT
|
||||||
|
Loading…
Reference in New Issue
Block a user