Bug#224676: tag 224676 patch
tag 224676 - unreproducible
tag 224676 + patch
thanks
sed is broken:
busybox sed -n '/^a/,/^a/p' >output <<EOF
a
b
a
b
EOF
cmp -s output - <<EOF
a
b
a
EOF
The attached patch fixes it.
--
Matt Kraai kraai@ftbfs.org
diff -ru busybox-cvs-20031212-old/editors/sed.c busybox-cvs-20031212/editors/sed.c
--- busybox-cvs-20031212-old/editors/sed.c 2003-12-22 10:34:06.000000000 -0800
+++ busybox-cvs-20031212/editors/sed.c 2003-12-22 10:52:31.000000000 -0800
@@ -746,7 +746,9 @@
restart:
/* for every line, go through all the commands */
for (sed_cmd = sed_cmd_head.next; sed_cmd; sed_cmd = sed_cmd->next) {
- int matched;
+ int old_matched, matched;
+
+ old_matched = sed_cmd->in_match;
/* Determine if this command matches this line: */
@@ -783,7 +785,7 @@
: sed_cmd->end_line<=linenum
: !sed_cmd->end_match)
/* or does this line matches our last address regex */
- || (sed_cmd->end_match && (regexec(sed_cmd->end_match, pattern_space, 0, NULL, 0) == 0))
+ || (sed_cmd->end_match && old_matched && (regexec(sed_cmd->end_match, pattern_space, 0, NULL, 0) == 0))
);
}
Reply to: