sed: do not elide an invalid byte in a substitution RHS

Now, sed copies such bytes into the output.
* sed/execute.c (str_append_modified): Copy each invalid byte
into the result string, as the comment suggests.
* testsuite/invalid-mb-seq-UMR.sh: Adjust this test to conform.
Perl does the same thing.  Also, remove an unnecessary "-e" option.
* NEWS (Bug fixes): Mention it.
Bug introduced prior to the switch to git in 2004,
between the releases of sed-4.0.9 and sed-4.1.
This addresses http://debbugs.gnu.org/22254.
This commit is contained in:
Jim Meyering committed 2015-12-27 22:36:47 -08:00
1 parent 67b3fcc980
commit 9dd563c897
3 files changed
+7 -2

No files matched your search

+4
View File
@@ -45,6 +45,10 @@ GNU sed NEWS -*- outline -*-
sed --follow-symlinks now works again for stdin.
[bug introduced in sed-4.2.2]
sed no longer elides invalid bytes in a substitution RHS.
Now, sed copies such bytes into the output, just as Perl does.
[bug introduced in sed-4.1 -- it was also present prior to 4.0.6]
** Feature removal
The "L" command (format a paragraph like the fmt(1) command would)
+1
View File
@@ -225,6 +225,7 @@ str_append_modified(struct line *to, const char *string, size_t length,
return;
}
str_append (to, string, 1);
memset (&to->mbstate, 0, sizeof (from_stat));
n = 1;
string += n, length -= n;
+2 -2
View File
@@ -24,9 +24,9 @@ require_valgrind_
test "$LOCALE_JA" = none && skip_ found no Japanese EUC locale
echo a > in || framework_failure_
echo bC > exp || framework_failure_
printf 'b\262C\n' > exp || framework_failure_
LC_ALL=$LOCALE_JA valgrind --quiet --error-exitcode=1 \
sed -e 's/a/b\U\xb2c/' in > out 2> err || fail=1
sed 's/a/b\U\xb2c/' in > out 2> err || fail=1
# Work around a bug in CentOS 5.10's valgrind
# FIXME: remove in 2018 or when CentOS 5 is no longer officially supported