1 diff -urpN busybox-1.16.1/editors/sed.c busybox-1.16.1-sed/editors/sed.c
2 --- busybox-1.16.1/editors/sed.c 2010-03-28 13:43:35.000000000 -0400
3 +++ busybox-1.16.1-sed/editors/sed.c 2010-04-20 13:33:26.301975462 -0400
4 @@ -936,7 +936,15 @@ static void process_files(void)
5 /* Skip blocks of commands we didn't match */
6 if (sed_cmd->cmd == '{') {
7 if (sed_cmd->invert ? matched : !matched) {
8 - while (sed_cmd->cmd != '}') {
9 + unsigned nest_cnt = 0;
11 + if (sed_cmd->cmd == '{')
13 + if (sed_cmd->cmd == '}') {
18 sed_cmd = sed_cmd->next;
20 bb_error_msg_and_die("unterminated {");
21 @@ -1031,7 +1039,7 @@ static void process_files(void)
23 /* Only triggers on last line of a matching range. */
24 if (!sed_cmd->in_match)
25 - sed_puts(sed_cmd->string, NO_EOL_CHAR);
26 + sed_puts(sed_cmd->string, '\n');
29 /* Read file, append contents to output */
30 diff -urpN busybox-1.16.1/testsuite/sed.tests busybox-1.16.1-sed/testsuite/sed.tests
31 --- busybox-1.16.1/testsuite/sed.tests 2010-03-19 22:58:07.000000000 -0400
32 +++ busybox-1.16.1-sed/testsuite/sed.tests 2010-04-20 13:33:26.301975462 -0400
33 @@ -248,4 +248,14 @@ testing "sed beginning (^) matches only
42 +testing "sed nested {}s" \
43 + "sed '/asd/ { p; /s/ { s/s/c/ }; p; q }'" \
44 + "qwe\nasd\nacd\nacd\n" "" \