diff options
author | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2020-10-09 15:25:27 +0000 |
---|---|---|
committer | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2020-10-09 15:25:27 +0000 |
commit | d4d2c2a0d7098f8284c318cc7e0231c9e84c0bd5 (patch) | |
tree | 7789d2ed3c705ffb8a225ec28c6e9e91c384b58d | |
parent | fac6bb8db9d0828e998716a47cd1ad20e18a2e0a (diff) | |
download | pcre2-d4d2c2a0d7098f8284c318cc7e0231c9e84c0bd5.tar.gz |
Fix binary zero issue (Bugzilla #2628) in RunGrepTest.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1278 6239d852-aaf2-0410-a92c-79f79f948069
-rw-r--r-- | ChangeLog | 4 | ||||
-rwxr-xr-x | RunGrepTest | 26 |
2 files changed, 16 insertions, 14 deletions
@@ -86,6 +86,10 @@ everywhere, which was not previously the case. At the same time, the escape sequences $x{...} and $o{...} have been introduced, to allow for characters whose code points are greater than 255 in Unicode mode. +17. Applied the patch from Bugzilla #2628 to RunGrepTest. This does an explicit +test for a version of sed that can handle binary zero, instead of assuming that +any Linux version will work. + Version 10.35 09-May-2020 --------------------------- diff --git a/RunGrepTest b/RunGrepTest index a8b80b8..abf69e7 100755 --- a/RunGrepTest +++ b/RunGrepTest @@ -757,22 +757,20 @@ $valgrind $vjs $pcre2grep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinputgr # It seems impossible to handle NUL characters easily in many operating # systems, including Solaris (aka SunOS), where the version of sed explicitly -# doesn't like them, and also MacOS (Darwin), OpenBSD, FreeBSD, and NetBSD. So -# now we run this test only on OS that are known to work. For the rest, we -# fudge the output so that the comparison works. +# doesn't like them, and also MacOS (Darwin), OpenBSD, FreeBSD, NetBSD, and +# some Linux distributions like Alpine, even when using GNU sed, so test for +# a usable sed and fudge the output so that the comparison works when sed +# doesn't. printf '%c--------------------------- Test N7 ------------------------------\r\n' - >>testtrygrep -uname=`uname` -case $uname in - Linux) - printf 'abc\0def' >testNinputgrep - $valgrind $vjs $pcre2grep -na --newline=nul "^(abc|def)" testNinputgrep | sed 's/\x00/ZERO/g' >>testtrygrep - echo "" >>testtrygrep - ;; - *) - echo '1:abcZERO2:defZERO' >>testtrygrep - ;; -esac +Z=$(printf '\0' | sed 's/\x00/Z/g') +if [ "$Z" = "Z" ]; then + printf 'abc\0def' >testNinputgrep + $valgrind $vjs $pcre2grep -na --newline=nul "^(abc|def)" testNinputgrep | sed 's/\x00/ZERO/g' >>testtrygrep + echo "" >>testtrygrep +else + echo '1:abcZERO2:defZERO' >>testtrygrep +fi $cf $srcdir/testdata/grepoutputN testtrygrep if [ $? != 0 ] ; then exit 1; fi |