diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2022-01-23 19:04:27 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-01-23 19:04:27 +0100 |
commit | f12fb1e4092900f26f7f8c71cde44b1cd7d26439 (patch) | |
tree | b5dec7c96074267b6d299928481e649e75c00885 /testsuite | |
parent | e998c7c032458a05a7afcc13ce0dc980b99ecc6c (diff) | |
download | busybox-w32-f12fb1e4092900f26f7f8c71cde44b1cd7d26439.tar.gz busybox-w32-f12fb1e4092900f26f7f8c71cde44b1cd7d26439.tar.bz2 busybox-w32-f12fb1e4092900f26f7f8c71cde44b1cd7d26439.zip |
sed: fix handling of escaped delimiters in s/// replacement
function old new delta
parse_regex_delim 111 140 +29
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/sed.tests | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/testsuite/sed.tests b/testsuite/sed.tests index 440996a21..626542e33 100755 --- a/testsuite/sed.tests +++ b/testsuite/sed.tests | |||
@@ -329,10 +329,15 @@ testing "sed special char as s/// delimiter, in pattern" \ | |||
329 | "sed 's+9\++X+'" \ | 329 | "sed 's+9\++X+'" \ |
330 | "X8=17\n" "" "9+8=17\n" | 330 | "X8=17\n" "" "9+8=17\n" |
331 | 331 | ||
332 | # but in replacement string, "\&" remains "\&", not interpreted as "&" | 332 | # Matching GNU sed 4.8: |
333 | testing "sed special char as s/// delimiter, in replacement" \ | 333 | # in replacement string, "\&" remains "\&", not interpreted as "&" |
334 | testing "sed special char as s/// delimiter, in replacement 1" \ | ||
334 | "sed 's&9&X\&&'" \ | 335 | "sed 's&9&X\&&'" \ |
335 | "X&+8=17\n" "" "9+8=17\n" | 336 | "X&+8=17\n" "" "9+8=17\n" |
337 | # in replacement string, "\1" is interpreted as "1" | ||
338 | testing "sed special char as s/// delimiter, in replacement 2" \ | ||
339 | "sed 's1\(9\)1X\11'" \ | ||
340 | "X1+8=17\n" "" "9+8=17\n" | ||
336 | 341 | ||
337 | testing "sed /\$_in_regex/ should not match newlines, only end-of-line" \ | 342 | testing "sed /\$_in_regex/ should not match newlines, only end-of-line" \ |
338 | "sed ': testcont; /\\\\$/{ =; N; b testcont }'" \ | 343 | "sed ': testcont; /\\\\$/{ =; N; b testcont }'" \ |