← Commit list

0545bfa84

Denys Vlasenko
Denys Vlasenko
2019-05-13
FAILED Duration: 113s

Subject

sed: fix /regex/,+N match triggering only once, closes 11871

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

editors/sed.c+2 -0
@@ -1097,6 +1097,8 @@ static void process_files(void)
int old_matched, matched;
old_matched = sed_cmd->in_match;
+ if (!old_matched)
+ sed_cmd->end_line = sed_cmd->end_line_orig;
/* Determine if this command matches this line: */
testsuite/sed.tests+6 -0
@@ -361,6 +361,12 @@ testing "sed /regex/,+N{...} addresses work" \
"" \
"1\n2\n3\n4\n5\n"
+testing "sed /regex/,+N{...} addresses work 2" \
+ "sed -n '/a/,+1 p'" \
+ "a\n1\na\n2\na\n3\n" \
+ "" \
+ "a\n1\nc\nc\na\n2\na\n3\n"
+
testing "sed /regex/,+N{...} -i works" \
"cat - >input2; sed /^4/,+2{d} -i input input2; echo \$?; cat input input2; rm input2" \
"0\n""1\n2\n3\n7\n8\n""1\n2\n7\n8\n" \