Subject: bug#29446: GNU grep 3.1 fails test suite when PCRE lacks JIT

From: Thomas Deutschmann <[email-masked]>
Date: Mon, 15 Oct 2018 18:52:20 +0200

Hi,

we have a similar problem on Gentoo Linux [1] where we allow to disable
JIT support in PCRE.

With the patch applied from previous mail [2], we are still seeing
failure of test "pcre-jitstack":

FAIL: pcre-jitstack
===================

++ initial_cwd_=/var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests
+++ testdir_prefix_
+++ printf gt
++ pfx_=gt
+++ mktempd_ /var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests gt-pcre-jitstack.XXXX
+++ case $# in
+++ destdir_=/var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests
+++ template_=gt-pcre-jitstack.XXXX
+++ MAX_TRIES_=4
+++ case $destdir_ in
+++ destdir_slash_=/var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/
+++ case $template_ in
++++ unset TMPDIR
+++ d=/var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/gt-pcre-jitstack.71Wt
+++ case $d in
+++ :
+++ test -d /var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/gt-pcre-jitstack.71Wt
++++ ls -dgo /var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/gt-pcre-jitstack.71Wt
+++ perms='drwx------ 2 4096 Oct 15 18:33 /var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/gt-pcre-jitstack.71Wt'
+++ case $perms in
+++ :
+++ echo /var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/gt-pcre-jitstack.71Wt
+++ return
++ test_dir_=/var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/gt-pcre-jitstack.71Wt
++ cd /var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/gt-pcre-jitstack.71Wt
++ gl_init_sh_nl_='
'
++ IFS=' 	
'
++ for sig_ in 1 2 3 13 15
+++ expr 1 + 128
++ eval 'trap '\''Exit 129'\'' 1'
+++ trap 'Exit 129' 1
++ for sig_ in 1 2 3 13 15
+++ expr 2 + 128
++ eval 'trap '\''Exit 130'\'' 2'
+++ trap 'Exit 130' 2
++ for sig_ in 1 2 3 13 15
+++ expr 3 + 128
++ eval 'trap '\''Exit 131'\'' 3'
+++ trap 'Exit 131' 3
++ for sig_ in 1 2 3 13 15
+++ expr 13 + 128
++ eval 'trap '\''Exit 141'\'' 13'
+++ trap 'Exit 141' 13
++ for sig_ in 1 2 3 13 15
+++ expr 15 + 128
++ eval 'trap '\''Exit 143'\'' 15'
+++ trap 'Exit 143' 15
++ trap remove_tmp_ 0
+ path_prepend_ ../src
+ test 1 '!=' 0
+ path_dir_=../src
+ case $path_dir_ in
+ abs_path_dir_=/var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/../src
+ case $abs_path_dir_ in
+ PATH=/var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/../src:/var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/src:./src:/usr/lib/portage/python3.6/ebuild-helpers/xattr:/usr/lib/portage/python3.6/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/i686-pc-linux-gnu/gcc-bin/7.3.0:/usr/lib/llvm/6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
+ create_exe_shims_ /var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/../src
+ case $EXEEXT in
+ return 0
+ shift
+ test 0 '!=' 0
+ export PATH
+ require_pcre_
+ echo .
+ grep -P .
.
+ compare /dev/null err
+ compare_dev_null_ /dev/null err
+ test 2 = 2
+ test x/dev/null = x/dev/null
+ test -s err
+ return 0
+ return 0
+ for p in 'base64 -d' 'base64 -D' 'openssl base64 -d' "perl -MMIME::Base64 -0777ne 'print decode_base64(\$_)'" FAIL
+ test 'base64 -d' = FAIL
++ echo eA==
+ x=x
+ test Xx = Xx
+ eval 'b64_decode() { base64 -d; }'
+ break
+ foo=foo
+ test Xfoo = Xfoo
+ fail=0
+ b64_decode
+ base64 -d
+ 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
+ set +e
+ exit 1
+ exit 1
+ remove_tmp_
+ __st=1
+ cleanup_
+ :
+ test '' = yes
+ cd /var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests
+ chmod -R u+rwx /var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/gt-pcre-jitstack.71Wt
+ rm -rf /var/tmp/portage/sys-apps/grep-3.1/work/grep-3.1/tests/gt-pcre-jitstack.71Wt
+ exit 1
FAIL pcre-jitstack (exit status: 1)

See also:
=========
[1] https://bugs.gentoo.org/569816

[2] https://www.mail-archive.com/[email-masked]/msg06922.html

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