- add and sync patches with upstream fixes
This commit is contained in:
Stephan Raue 2010-05-19 11:41:02 +02:00
parent 1d733086b6
commit c0cc2ea7d2
7 changed files with 195 additions and 9 deletions

View File

@ -0,0 +1,15 @@
diff -urpN busybox-1.16.1/shell/ash.c busybox-1.16.1-ash/shell/ash.c
--- busybox-1.16.1/shell/ash.c 2010-03-28 19:44:04.000000000 +0200
+++ busybox-1.16.1-ash/shell/ash.c 2010-04-26 14:18:36.000000000 +0200
@@ -5424,7 +5424,11 @@ rmescapes(char *str, int flag)
size_t fulllen = len + strlen(p) + 1;
if (flag & RMESCAPE_GROW) {
+ int strloc = str - (char *)stackblock();
r = makestrspace(fulllen, expdest);
+ /* p and str may be invalidated by makestrspace */
+ str = (char *)stackblock() + strloc;
+ p = str + len;
} else if (flag & RMESCAPE_HEAP) {
r = ckmalloc(fulllen);
} else {

View File

@ -0,0 +1,51 @@
diff -urpN busybox-1.16.1/archival/cpio.c busybox-1.16.1-cpio/archival/cpio.c
--- busybox-1.16.1/archival/cpio.c 2010-03-20 03:58:07.000000000 +0100
+++ busybox-1.16.1-cpio/archival/cpio.c 2010-04-27 08:15:37.000000000 +0200
@@ -424,7 +424,7 @@ int cpio_main(int argc UNUSED_PARAM, cha
if (archive_handle->cpio__blocks != (off_t)-1
&& !(opt & CPIO_OPT_QUIET)
) {
- printf("%"OFF_FMT"u blocks\n", archive_handle->cpio__blocks);
+ fprintf(stderr, "%"OFF_FMT"u blocks\n", archive_handle->cpio__blocks);
}
return EXIT_SUCCESS;
diff -urpN busybox-1.16.1/testsuite/cpio.tests busybox-1.16.1-cpio/testsuite/cpio.tests
--- busybox-1.16.1/testsuite/cpio.tests 2010-03-28 19:59:59.000000000 +0200
+++ busybox-1.16.1-cpio/testsuite/cpio.tests 2010-04-27 08:15:37.000000000 +0200
@@ -32,7 +32,7 @@ rm -rf cpio.testdir cpio.testdir2 2>/dev
# testing "test name" "command" "expected result" "file input" "stdin"
testing "cpio extracts zero-sized hardlinks" \
-"$ECHO -ne '$hexdump' | bzcat | cpio -i; echo \$?;
+"$ECHO -ne '$hexdump' | bzcat | cpio -i 2>&1; echo \$?;
ls -ln cpio.testdir | $FILTER_LS" \
"\
1 blocks
@@ -45,7 +45,7 @@ ls -ln cpio.testdir | $FILTER_LS" \
test x"$SKIP_KNOWN_BUGS" = x"" && {
# Currently fails. Numerous buglets: "1 blocks" versus "1 block",
-# "1 block" must go to stderr, does not list cpio.testdir/x and cpio.testdir/y
+# does not list cpio.testdir/x and cpio.testdir/y
testing "cpio lists hardlinks" \
"$ECHO -ne '$hexdump' | bzcat | cpio -t 2>&1; echo \$?" \
"\
@@ -70,7 +70,7 @@ ln cpio.testdir/nonempty cpio.testdir/no
mkdir cpio.testdir2
testing "cpio extracts zero-sized hardlinks 2" \
-"find cpio.testdir | cpio -H newc --create | (cd cpio.testdir2 && cpio -i); echo \$?;
+"find cpio.testdir | cpio -H newc --create | (cd cpio.testdir2 && cpio -i 2>&1); echo \$?;
ls -ln cpio.testdir2/cpio.testdir | $FILTER_LS" \
"\
2 blocks
@@ -87,7 +87,7 @@ ls -ln cpio.testdir2/cpio.testdir | $FIL
# Was trying to create "/usr/bin", correct is "usr/bin".
rm -rf cpio.testdir
testing "cpio -p with absolute paths" \
-"echo /usr/bin | cpio -dp cpio.testdir; echo \$?;
+"echo /usr/bin | cpio -dp cpio.testdir 2>&1; echo \$?;
ls cpio.testdir" \
"\
1 blocks

View File

@ -0,0 +1,12 @@
diff -urpN busybox-1.16.1/networking/udhcp/leases.c busybox-1.16.1-dhcpd/networking/udhcp/leases.c
--- busybox-1.16.1/networking/udhcp/leases.c 2010-03-28 19:43:36.000000000 +0200
+++ busybox-1.16.1-dhcpd/networking/udhcp/leases.c 2010-05-15 20:47:08.000000000 +0200
@@ -64,6 +64,8 @@ struct dyn_lease* FAST_FUNC add_lease(
oldest->hostname[0] = '\0';
if (hostname) {
char *p;
+
+ hostname_len++; /* include NUL */
if (hostname_len > sizeof(oldest->hostname))
hostname_len = sizeof(oldest->hostname);
p = safe_strncpy(oldest->hostname, hostname, hostname_len);

View File

@ -1,6 +1,6 @@
diff -urpN busybox-1.16.1/include/platform.h busybox-1.16.1-dnsd/include/platform.h
--- busybox-1.16.1/include/platform.h 2010-03-28 10:43:35.000000000 -0700
+++ busybox-1.16.1-dnsd/include/platform.h 2010-04-14 10:06:10.888341149 -0700
--- busybox-1.16.1/include/platform.h 2010-03-28 19:43:35.000000000 +0200
+++ busybox-1.16.1-dnsd/include/platform.h 2010-04-14 19:06:10.000000000 +0200
@@ -291,10 +291,12 @@ typedef unsigned smalluint;
#if 1 /* if needed: !defined(arch1) && !defined(arch2) */
# define ALIGN1 __attribute__((aligned(1)))
@ -15,9 +15,28 @@ diff -urpN busybox-1.16.1/include/platform.h busybox-1.16.1-dnsd/include/platfor
diff -urpN busybox-1.16.1/networking/dnsd.c busybox-1.16.1-dnsd/networking/dnsd.c
--- busybox-1.16.1/networking/dnsd.c 2010-03-28 10:43:36.000000000 -0700
+++ busybox-1.16.1-dnsd/networking/dnsd.c 2010-04-14 10:06:10.922348571 -0700
@@ -459,7 +459,8 @@ int dnsd_main(int argc UNUSED_PARAM, cha
--- busybox-1.16.1/networking/dnsd.c 2010-03-28 19:43:36.000000000 +0200
+++ busybox-1.16.1-dnsd/networking/dnsd.c 2010-04-26 14:20:25.000000000 +0200
@@ -44,10 +44,15 @@ struct dns_head {
uint16_t nauth;
uint16_t nadd;
};
+/* Structure used to access type and class fields.
+ * They are totally unaligned, but gcc 4.3.4 thinks that pointer of type uint16_t*
+ * is 16-bit aligned and replaces 16-bit memcpy (in move_from_unaligned16 macro)
+ * with aligned halfword access on arm920t!
+ * Oh well. Slapping PACKED everywhere seems to help: */
struct dns_prop {
- uint16_t type;
- uint16_t class;
-};
+ uint16_t type PACKED;
+ uint16_t class PACKED;
+} PACKED;
/* element of known name, ip address and reversed ip address */
struct dns_entry {
struct dns_entry *next;
@@ -459,7 +464,8 @@ int dnsd_main(int argc UNUSED_PARAM, cha
unsigned lsa_size;
int udps, opts;
uint16_t port = 53;

View File

@ -1,6 +1,6 @@
diff -urpN busybox-1.16.1/util-linux/hwclock.c busybox-1.16.1-hwclock/util-linux/hwclock.c
--- busybox-1.16.1/util-linux/hwclock.c 2010-03-19 19:58:07.000000000 -0700
+++ busybox-1.16.1-hwclock/util-linux/hwclock.c 2010-04-14 09:29:37.889208237 -0700
--- busybox-1.16.1/util-linux/hwclock.c 2010-03-20 03:58:07.000000000 +0100
+++ busybox-1.16.1-hwclock/util-linux/hwclock.c 2010-04-14 18:29:37.000000000 +0200
@@ -109,10 +109,53 @@ static void to_sys_clock(const char **pp
static void from_sys_clock(const char **pp_rtcname, int utc)

View File

@ -1,6 +1,6 @@
diff -urpN busybox-1.16.1/networking/httpd_indexcgi.c busybox-1.16.1-indexcgi/networking/httpd_indexcgi.c
--- busybox-1.16.1/networking/httpd_indexcgi.c 2010-03-19 19:58:07.000000000 -0700
+++ busybox-1.16.1-indexcgi/networking/httpd_indexcgi.c 2010-04-15 08:39:01.077063367 -0700
--- busybox-1.16.1/networking/httpd_indexcgi.c 2010-03-20 03:58:07.000000000 +0100
+++ busybox-1.16.1-indexcgi/networking/httpd_indexcgi.c 2010-04-15 17:39:01.000000000 +0200
@@ -315,7 +315,7 @@ int main(int argc, char *argv[])
if (S_ISREG(cdir->dl_mode))
fmt_ull(cdir->dl_size);

View File

@ -0,0 +1,89 @@
diff -urpN busybox-1.16.1/editors/sed.c busybox-1.16.1-sed/editors/sed.c
--- busybox-1.16.1/editors/sed.c 2010-03-28 19:43:35.000000000 +0200
+++ busybox-1.16.1-sed/editors/sed.c 2010-05-12 01:46:57.000000000 +0200
@@ -487,7 +487,7 @@ static const char *parse_cmd_args(sed_cm
static void add_cmd(const char *cmdstr)
{
sed_cmd_t *sed_cmd;
- int temp;
+ unsigned len, n;
/* Append this line to any unfinished line from last time. */
if (G.add_cmd_line) {
@@ -496,12 +496,14 @@ static void add_cmd(const char *cmdstr)
cmdstr = G.add_cmd_line = tp;
}
- /* If this line ends with backslash, request next line. */
- temp = strlen(cmdstr);
- if (temp && cmdstr[--temp] == '\\') {
+ /* If this line ends with unescaped backslash, request next line. */
+ n = len = strlen(cmdstr);
+ while (n && cmdstr[n-1] == '\\')
+ n--;
+ if ((len - n) & 1) { /* if odd number of trailing backslashes */
if (!G.add_cmd_line)
G.add_cmd_line = xstrdup(cmdstr);
- G.add_cmd_line[temp] = '\0';
+ G.add_cmd_line[len-1] = '\0';
return;
}
@@ -936,7 +938,15 @@ static void process_files(void)
/* Skip blocks of commands we didn't match */
if (sed_cmd->cmd == '{') {
if (sed_cmd->invert ? matched : !matched) {
- while (sed_cmd->cmd != '}') {
+ unsigned nest_cnt = 0;
+ while (1) {
+ if (sed_cmd->cmd == '{')
+ nest_cnt++;
+ if (sed_cmd->cmd == '}') {
+ nest_cnt--;
+ if (nest_cnt == 0)
+ break;
+ }
sed_cmd = sed_cmd->next;
if (!sed_cmd)
bb_error_msg_and_die("unterminated {");
@@ -1031,7 +1041,7 @@ static void process_files(void)
case 'c':
/* Only triggers on last line of a matching range. */
if (!sed_cmd->in_match)
- sed_puts(sed_cmd->string, NO_EOL_CHAR);
+ sed_puts(sed_cmd->string, '\n');
goto discard_line;
/* Read file, append contents to output */
diff -urpN busybox-1.16.1/testsuite/sed.tests busybox-1.16.1-sed/testsuite/sed.tests
--- busybox-1.16.1/testsuite/sed.tests 2010-03-20 03:58:07.000000000 +0100
+++ busybox-1.16.1-sed/testsuite/sed.tests 2010-05-12 01:46:57.000000000 +0200
@@ -248,4 +248,28 @@ testing "sed beginning (^) matches only
">/usr</>lib<\n" "" \
"/usr/lib\n"
+testing "sed c" \
+ "sed 'crepl'" \
+ "repl\nrepl\n" "" \
+ "first\nsecond\n"
+
+testing "sed nested {}s" \
+ "sed '/asd/ { p; /s/ { s/s/c/ }; p; q }'" \
+ "qwe\nasd\nacd\nacd\n" "" \
+ "qwe\nasd\nzxc\n"
+
+testing "sed a cmd ended by double backslash" \
+ "sed -e '/| one /a \\
+ | three \\\\' -e '/| one-/a \\
+ | three-* \\\\'" \
+' | one \\
+ | three \\
+ | two \\
+' '' \
+' | one \\
+ | two \\
+'
+
+# testing "description" "arguments" "result" "infile" "stdin"
+
exit $FAILCOUNT