Subject: Re: GNU grep 3.1 fails test suite when PCRE lacks JIT

From: Thomas Deutschmann <[email-masked]>
Date: Thu, 2 Jan 2020 22:47:25 +0100

Hi,

OK, I managed to reproduce the error using pure Debian:

$ mkdir /tmp/pcre-test
$ cd /tmp/pcre-test

$ wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
$ tar -xaf pcre-8.43.tar.gz

$ cd pcre-8.43/
$ ./configure --prefix=/tmp/pcre-test/build \
--with-match-limit-recursion=8192 \
--enable-pcregrep-libbz2 \
--enable-cpp \
--disable-jit \
--disable-pcregrep-jit \
--disable-pcre16 \
--disable-pcre32 \
--disable-pcretest-libedit \
--enable-pcretest-libreadline \
--disable-static \
--enable-utf \
--enable-unicode-properties \
--enable-pcregrep-libz \
--enable-pcre8 \
--enable-shared

$ make
$ make install

$ cd ..
$ wget https://ftp.gnu.org/gnu/grep/grep-3.3.tar.xz
$ tar -xaf grep-3.3.tar.xz
$ cd grep-3.3/
$ PKG_CONFIG_PATH=/tmp/pcre-test/build/lib/pkgconfig ./configure
$ make

# Now check src/grep
$ lddtree src/grep
grep => src/grep (interpreter => /lib64/ld-linux-x86-64.so.2)
    libpcre.so.1 => not found
[...]

$ export LD_LIBRARY_PATH=/tmp/pcre-test/build/lib

# Check with lddtree again to be sure our local pcre build is being used
$ lddtree src/grep
grep => src/grep (interpreter => /lib64/ld-linux-x86-64.so.2)
    libpcre.so.1 => /tmp/pcre-test/build/lib/libpcre.so.1
[...]

# Test that src/grep works:
$ echo . | src/grep -P .

# Now run test which will fail:
$ make check TESTS=pcre-jitstack

> + gzip -d pcrejit.txt
> + LC_ALL=C
> + grep -P -n '^([/](?!/)|[^/])*~/.*' pcrejit.txt
> grep: internal PCRE error: -21
> + test 2 '!=' 1
> + ulimit -s unlimited
> + ulimit -s unlimited
> + returns_ 1 env LC_ALL=C grep -P -n '^([/](?!/)|[^/])*~/.*' pcrejit.txt
> grep: internal PCRE error: -21
> + fail=1
> + Exit 1

-- 
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5