Compare commits
12
Commits
master
...
1_31_stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd75474639 | ||
|
|
ebc1c38a92 | ||
|
|
be11940911 | ||
|
|
49a8839638 | ||
|
|
3004510fdc | ||
|
|
d6a8784f27 | ||
|
|
a1c7a9e976 | ||
|
|
2f3352682e | ||
|
|
50ba92128b | ||
|
|
4699b93244 | ||
|
|
244c0ebb4f | ||
|
|
c88d3ec458 |
No files matched your search
@@ -1,6 +1,6 @@
|
||||
VERSION = 1
|
||||
PATCHLEVEL = 31
|
||||
SUBLEVEL = 0
|
||||
SUBLEVEL = 1
|
||||
EXTRAVERSION =
|
||||
NAME = Unnamed
|
||||
|
||||
|
||||
@@ -96,6 +96,24 @@ unpack_xz_stream(transformer_state_t *xstate)
|
||||
*/
|
||||
do {
|
||||
if (membuf[iobuf.in_pos] != 0) {
|
||||
/* There is more data, but is it XZ data?
|
||||
* Example: dpkg-deb -f busybox_1.30.1-4_amd64.deb
|
||||
* reads control.tar.xz "control" file
|
||||
* inside the ar archive, but tar.xz
|
||||
* extraction code reaches end of xz data,
|
||||
* reached this code and reads the beginning
|
||||
* of data.tar.xz's ar header, which isn't xz data,
|
||||
* and prints "corrupted data".
|
||||
* The correct solution is to not read
|
||||
* past nested archive (to simulate EOF).
|
||||
* This is a workaround:
|
||||
*/
|
||||
if (membuf[iobuf.in_pos] != 0xfd) {
|
||||
/* It's definitely not a xz signature
|
||||
* (which is 0xfd,"7zXZ",0x00).
|
||||
*/
|
||||
goto end;
|
||||
}
|
||||
xz_dec_reset(state);
|
||||
goto do_run;
|
||||
}
|
||||
@@ -128,7 +146,7 @@ unpack_xz_stream(transformer_state_t *xstate)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
xz_dec_end(state);
|
||||
free(membuf);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#define STREAM_HEADER_SIZE 12
|
||||
|
||||
#define HEADER_MAGIC "\3757zXZ"
|
||||
#define HEADER_MAGIC "\375""7zXZ"
|
||||
#define HEADER_MAGIC_SIZE 6
|
||||
|
||||
#define FOOTER_MAGIC "YZ"
|
||||
|
||||
+8
-5
@@ -18,7 +18,7 @@
|
||||
* was seen to cause largish delays when user tries to ^C a file copy.
|
||||
* Let's use a saner size.
|
||||
* Note: needs to be >= max(CONFIG_FEATURE_COPYBUF_KB),
|
||||
* or else "copy to eof" code will use neddlesly short reads.
|
||||
* or else "copy to eof" code will use needlesly short reads.
|
||||
*/
|
||||
#define SENDFILE_BIGBUF (16*1024*1024)
|
||||
|
||||
@@ -60,10 +60,13 @@ static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size)
|
||||
ssize_t rd;
|
||||
|
||||
if (sendfile_sz) {
|
||||
rd = sendfile(dst_fd, src_fd, NULL,
|
||||
size > sendfile_sz ? sendfile_sz : size);
|
||||
if (rd >= 0)
|
||||
goto read_ok;
|
||||
/* dst_fd == -1 is a fake, else... */
|
||||
if (dst_fd >= 0) {
|
||||
rd = sendfile(dst_fd, src_fd, NULL,
|
||||
size > sendfile_sz ? sendfile_sz : size);
|
||||
if (rd >= 0)
|
||||
goto read_ok;
|
||||
}
|
||||
sendfile_sz = 0; /* do not try sendfile anymore */
|
||||
}
|
||||
#if CONFIG_FEATURE_COPYBUF_KB > 4
|
||||
|
||||
+14
-5
@@ -4973,7 +4973,9 @@ static void dc_parse_string(void)
|
||||
xc_parse_pushInst_and_Index(XC_INST_STR, len);
|
||||
bc_vec_push(&G.prog.strs, &str);
|
||||
|
||||
// Explanation needed here
|
||||
// Add an empty function so that if zdc_program_execStr ever needs to
|
||||
// parse the string into code (from the 'x' command) there's somewhere
|
||||
// to store the bytecode.
|
||||
xc_program_add_fn();
|
||||
p->func = xc_program_func(p->fidx);
|
||||
|
||||
@@ -5454,11 +5456,13 @@ static void xc_program_printString(const char *str)
|
||||
char *n;
|
||||
|
||||
c = *str++;
|
||||
n = strchr(esc, c); // note: c can be NUL
|
||||
if (!n) {
|
||||
n = strchr(esc, c); // note: if c is NUL, n = \0 at end of esc
|
||||
if (!n || !c) {
|
||||
// Just print the backslash and following character
|
||||
bb_putchar('\\');
|
||||
++G.prog.nchars;
|
||||
// But if we're at the end of the string, stop
|
||||
if (!c) break;
|
||||
} else {
|
||||
if (n - esc == 0) // "\n" ?
|
||||
G.prog.nchars = SIZE_MAX;
|
||||
@@ -6398,7 +6402,11 @@ static BC_STATUS zdc_program_asciify(void)
|
||||
str = xzalloc(2);
|
||||
str[0] = c;
|
||||
//str[1] = '\0'; - already is
|
||||
bc_vec_push(&G.prog.strs, &str);
|
||||
idx = bc_vec_push(&G.prog.strs, &str);
|
||||
// Add an empty function so that if zdc_program_execStr ever needs to
|
||||
// parse the string into code (from the 'x' command) there's somewhere
|
||||
// to store the bytecode.
|
||||
xc_program_add_fn();
|
||||
dup:
|
||||
res.t = XC_RESULT_STR;
|
||||
res.d.id.idx = idx;
|
||||
@@ -6521,7 +6529,7 @@ static BC_STATUS zdc_program_execStr(char *code, size_t *bgn, bool cond)
|
||||
if (s || !BC_PROG_STR(n)) goto exit;
|
||||
sidx = n->rdx;
|
||||
} else
|
||||
goto exit;
|
||||
goto exit_nopop;
|
||||
}
|
||||
|
||||
fidx = sidx + BC_PROG_REQ_FUNCS;
|
||||
@@ -6561,6 +6569,7 @@ static BC_STATUS zdc_program_execStr(char *code, size_t *bgn, bool cond)
|
||||
RETURN_STATUS(BC_STATUS_SUCCESS);
|
||||
exit:
|
||||
bc_vec_pop(&G.prog.results);
|
||||
exit_nopop:
|
||||
RETURN_STATUS(s);
|
||||
}
|
||||
#define zdc_program_execStr(...) (zdc_program_execStr(__VA_ARGS__) COMMA_SUCCESS)
|
||||
|
||||
+1
-1
@@ -248,7 +248,7 @@ static void handle_net_input(int len)
|
||||
{
|
||||
byte c;
|
||||
int i;
|
||||
int cstart = cstart; /* for compiler */
|
||||
int cstart = 0;
|
||||
|
||||
i = 0;
|
||||
//bb_error_msg("[%u,'%.*s']", G.telstate, len, G.buf);
|
||||
|
||||
+1
-1
@@ -1109,7 +1109,7 @@ static void download_one_url(const char *url)
|
||||
* We are not sure it exists on remote side */
|
||||
}
|
||||
|
||||
redir_limit = 5;
|
||||
redir_limit = 16;
|
||||
resolve_lsa:
|
||||
lsa = xhost2sockaddr(server.host, server.port);
|
||||
if (!(option_mask32 & WGET_OPT_QUIET)) {
|
||||
|
||||
@@ -11091,6 +11091,8 @@ plus_minus_o(char *name, int val)
|
||||
return 1;
|
||||
}
|
||||
for (i = 0; i < NOPTS; i++) {
|
||||
if (optnames(i)[0] == '\0')
|
||||
continue;
|
||||
if (val) {
|
||||
out1fmt("%-16s%s\n", optnames(i), optlist[i] ? "on" : "off");
|
||||
} else {
|
||||
@@ -13126,6 +13128,8 @@ expandstr(const char *ps, int syntax_type)
|
||||
if (setjmp(jmploc.loc) == 0) {
|
||||
exception_handler = &jmploc;
|
||||
expandarg(&n, NULL, EXP_QUOTED);
|
||||
} else if (exception_type == EXEXIT) {
|
||||
exitshell();
|
||||
}
|
||||
exception_handler = savehandler;
|
||||
RESTORE_INT(saveint);
|
||||
|
||||
+9
-11
@@ -9824,9 +9824,12 @@ static int set_mode(int state, char mode, const char *o_opt)
|
||||
IF_HUSH_MODE_X(G_x_mode = state;)
|
||||
IF_HUSH_MODE_X(if (G.x_mode_fd <= 0) G.x_mode_fd = dup_CLOEXEC(2, 10);)
|
||||
break;
|
||||
case 'e':
|
||||
G.o_opt[OPT_O_ERREXIT] = state;
|
||||
break;
|
||||
case 'o':
|
||||
if (!o_opt) {
|
||||
/* "set -+o" without parameter.
|
||||
/* "set -o" or "set +o" without parameter.
|
||||
* in bash, set -o produces this output:
|
||||
* pipefail off
|
||||
* and set +o:
|
||||
@@ -9847,9 +9850,7 @@ static int set_mode(int state, char mode, const char *o_opt)
|
||||
G.o_opt[idx] = state;
|
||||
break;
|
||||
}
|
||||
case 'e':
|
||||
G.o_opt[OPT_O_ERREXIT] = state;
|
||||
break;
|
||||
/* fall through to error */
|
||||
default:
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -10931,8 +10932,10 @@ static int FAST_FUNC builtin_set(char **argv)
|
||||
if (arg[0] != '+' && arg[0] != '-')
|
||||
break;
|
||||
for (n = 1; arg[n]; ++n) {
|
||||
if (set_mode((arg[0] == '-'), arg[n], argv[1]))
|
||||
goto error;
|
||||
if (set_mode((arg[0] == '-'), arg[n], argv[1])) {
|
||||
bb_error_msg("%s: %s: invalid option", "set", arg);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (arg[n] == 'o' && argv[1])
|
||||
argv++;
|
||||
}
|
||||
@@ -10962,11 +10965,6 @@ static int FAST_FUNC builtin_set(char **argv)
|
||||
G.global_argc = 1 + string_array_len(pp + 1);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
/* Nothing known, so abort */
|
||||
error:
|
||||
bb_error_msg("%s: %s: invalid option", "set", arg);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+27
-2
@@ -538,9 +538,34 @@ static arith_t strto_arith_t(const char *nptr, char **endptr)
|
||||
n = 0;
|
||||
nptr = *endptr + 1;
|
||||
/* bash allows "N#" (empty "nnnn" part) */
|
||||
while (isdigit(*nptr)) {
|
||||
for (;;) {
|
||||
unsigned digit = (unsigned)*nptr - '0';
|
||||
if (digit >= 10) {
|
||||
/* *nptr is not 0..9 */
|
||||
if (*nptr > 'z')
|
||||
break; /* this rejects e.g. $((64#~)) */
|
||||
/* in bases up to 36, case does not matter for a-z */
|
||||
digit = (unsigned)(*nptr | 0x20) - ('a' - 10);
|
||||
if (base > 36 && *nptr <= '_') {
|
||||
/* otherwise, A-Z,@,_ are 36..61,62,63 */
|
||||
if (*nptr == '@')
|
||||
digit = 62;
|
||||
else if (*nptr == '_')
|
||||
digit = 63;
|
||||
else if (digit < 36) /* A-Z */
|
||||
digit += 36 - 10;
|
||||
else
|
||||
break; /* error, such as [ or \ */
|
||||
}
|
||||
//bb_error_msg("ch:'%c'%d digit:%u", *nptr, *nptr, digit);
|
||||
//if (digit < 10) - example where we need this?
|
||||
// break;
|
||||
}
|
||||
if (digit >= base)
|
||||
break;
|
||||
/* bash does not check for overflows */
|
||||
n = n * base + (*nptr++ - '0');
|
||||
n = n * base + digit;
|
||||
nptr++;
|
||||
}
|
||||
*endptr = (char*)nptr;
|
||||
return n;
|
||||
|
||||
@@ -44,6 +44,41 @@ testing "dc complex without spaces (multiple args)" \
|
||||
optional FEATURE_DC_BIG
|
||||
# All tests below depend on FEATURE_DC_BIG
|
||||
|
||||
testing "dc: x should execute strings" \
|
||||
"dc -e'[40 2 +] x f'" \
|
||||
"42\n" \
|
||||
"" ""
|
||||
|
||||
testing "dc: x should not execute or pop non-strings" \
|
||||
"dc -e'42 x f'" \
|
||||
"42\n" \
|
||||
"" ""
|
||||
|
||||
testing "dc: x should work with strings created from a" \
|
||||
"dc -e'42 112 a x'" \
|
||||
"42\n" \
|
||||
"" ""
|
||||
|
||||
testing "dc: p should print invalid escapes" \
|
||||
"dc -e '[\q] p'" \
|
||||
"\\q\n" \
|
||||
"" ""
|
||||
|
||||
testing "dc: p should print trailing backslashes" \
|
||||
"dc -e '[q\] p'" \
|
||||
"q\\\\\n" \
|
||||
"" ""
|
||||
|
||||
testing "dc: p should parse/print single backslashes" \
|
||||
"dc -e '[\] p'" \
|
||||
"\\\\\n" \
|
||||
"" ""
|
||||
|
||||
testing "dc: p should print single backslash strings" \
|
||||
"dc -e '92 a p'" \
|
||||
"\\\\\n" \
|
||||
"" ""
|
||||
|
||||
testing "dc read" \
|
||||
"dc -finput" \
|
||||
"2\n9\n1\n" \
|
||||
|
||||
Reference in new issue
Block a user