fix "y" to work with NUL in the RHS
* sed/execute.c (do_list) [case 'y']: Handle NUL bytes in the RHS of a y/LHS/RHS/ transliteration. * testsuite/y-zero.good: New test-related files. * testsuite/y-zero.inp: * testsuite/y-zero.sed: * testsuite/Makefile.am (SEDTESTS): Add y-zero here. * testsuite/Makefile.tests: And here. * NEWS (Bug fixes): Describe it. The bug was reported by table@inventati.org, with the execute.c change mostly by Paolo Bonzini.
This commit is contained in:
1 parent
e146d2a52d
commit
643f692bc7
8 files changed
+38
-4
No files matched your search
@@ -1,3 +1,17 @@
|
||||
2014-09-04 Jim Meyering <meyering@fb.com>
|
||||
|
||||
fix "y" to work with NUL in the RHS
|
||||
* sed/execute.c (do_list) [case 'y']: Handle NUL bytes
|
||||
in the RHS of a y/LHS/RHS/ transliteration.
|
||||
* testsuite/y-zero.good: New test-related files.
|
||||
* testsuite/y-zero.inp:
|
||||
* testsuite/y-zero.sed:
|
||||
* testsuite/Makefile.am (SEDTESTS): Add y-zero here.
|
||||
* testsuite/Makefile.tests: And here.
|
||||
* NEWS (Bug fixes): Describe it.
|
||||
The bug was reported by table@inventati.org,
|
||||
with the execute.c change mostly by Paolo Bonzini.
|
||||
|
||||
2014-07-24 Jose E. Marchesi <jemarch@gnu.org>
|
||||
|
||||
* gnulib: Update.
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
Sed 4.2.2
|
||||
GNU sed NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
The 'y' (transliterate) operator once again works with a NUL byte
|
||||
on the RHS. E.g., sed 'y/b/\x00/' now works like tr b '\0'. GNU sed
|
||||
has never before recognized \x00 in this context. However, sed-3.02
|
||||
and prior did accept a literal NUL byte in the RHS, which was possible
|
||||
only when reading a script from a file. For example, this:
|
||||
echo abc|sed -f <(printf 'y/b/\x00/\n')|cat -A
|
||||
is what stopped working. [bug introduced some time after sed-3.02 and
|
||||
prior to the first sed-4* test release]
|
||||
|
||||
|
||||
* Noteworthy changes in release 4.2.2 (2012-12-22) [stable]
|
||||
|
||||
* don't misbehave (truncate input) for lines of length 2^31 and longer
|
||||
|
||||
|
||||
+2
-1
@@ -1567,7 +1567,8 @@ execute_program(vec, input)
|
||||
if (strncmp(line.active + idx, trans[2*i], mbclen) == 0)
|
||||
{
|
||||
bool move_remain_buffer = false;
|
||||
int trans_len = strlen(trans[2*i+1]);
|
||||
const char *tr = trans[2*i+1];
|
||||
size_t trans_len = *tr == '\0' ? 1 : strlen (tr);
|
||||
|
||||
if (mbclen < trans_len)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ SEDTESTS += \
|
||||
modulo numsub numsub2 numsub3 numsub4 numsub5 0range bkslashes \
|
||||
head madding mac-mf empty xbxcx xbxcx3 recall recall2 xemacs \
|
||||
fasts uniq manis khadafy linecnt eval distrib 8to7 y-bracket \
|
||||
y-newline allsub cv-vars classes middle bsd stdin flipcase \
|
||||
y-newline y-zero allsub cv-vars classes middle bsd stdin flipcase \
|
||||
insens subwrite writeout readin insert utf8-1 utf8-2 utf8-3 utf8-4 \
|
||||
badenc inplace-hold brackets amp-escape \
|
||||
help version file quiet \
|
||||
@@ -95,6 +95,7 @@ EXTRA_DIST = \
|
||||
xbxcx3.good xbxcx3.inp xbxcx3.sed \
|
||||
xemacs.good xemacs.inp xemacs.sed \
|
||||
y-bracket.good y-bracket.sed y-bracket.inp \
|
||||
y-NUL.good y-NUL.sed y-NUL.inp \
|
||||
y-newline.good y-newline.sed y-newline.inp
|
||||
|
||||
# automake makes `check' depend on $(TESTS). Declare
|
||||
|
||||
@@ -21,7 +21,7 @@ SKIP = :>$@.skip; exit 77
|
||||
enable sep inclib 8bit 8to7 newjis xabcx dollar noeol bkslashes \
|
||||
numsub head madding mac-mf empty xbxcx xbxcx3 recall recall2 xemacs \
|
||||
appquit fasts uniq manis linecnt khadafy allsub flipcase space modulo \
|
||||
y-bracket y-newline insert brackets amp-escape::
|
||||
y-bracket y-newline y-zero insert brackets amp-escape::
|
||||
$(SEDENV) $(SED) -f $(srcdir)/$@.sed \
|
||||
< $(srcdir)/$@.inp | $(TR) -d \\r > $@.out
|
||||
$(CMP) $(srcdir)/$@.good $@.out
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
abc
|
||||
@@ -0,0 +1 @@
|
||||
y/b/\x00/
|
||||
Reference in new issue
Block a user