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

From: Thomas Deutschmann <[email-masked]>
Date: Thu, 2 Jan 2020 19:02:20 +0100

Hi Paul,

On 2019-12-31 21:41, Paul Eggert wrote:
> Re this old bug report <https://bugs.gnu.org/29446>:
> 
> I attempted to reproduce this bug on Ubuntu 18.04.3 LTS x86-64, by building pcre
> 8.43 by hand with "./configure --disable-jit --prefix=/tmp/prefix" and then
> compiling and building GNU grep master with the pcre that had JIT disabled. No
> luck; I couldn't reproduce the bug. If you have any advice as to how to
> reproduce the bug on Ubuntu or Fedora x86-64 (the systems I have easy access to)
> please let me know.

Is it suitable for you to run Gentoo in a chrooted environment?

Please see the following howto which I just verified on latest Debian
version:

> # Setup Gentoo chroot using stage3
> cd /tmp
> mkdir /tmp/gentoo
> wget http://distfiles.gentoo.org/releases/amd64/autobuilds/20200101T214502Z/stage3-amd64-20200101T214502Z.tar.xz
> tar -xaf stage3-amd64-*.tar.xz -C /tmp/gentoo
> mount -t proc /proc gentoo/proc
> mount --rbind /sys gentoo/sys
> mount --make-rslave gentoo/sys
> mount --rbind /dev gentoo/dev
> mount --make-rslave gentoo/dev
> 
> # Chroot into Gentoo
> env -i HOME=/root TERM=$TERM $(which chroot) /tmp/gentoo /bin/bash --login
> 
> # In Gentoo chroot...
> export PS1="(chroot) $PS1"
> 
> # Make sure name resolution works...
> echo 'nameserver 8.8.8.8' > /etc/resolv.conf
> 
> # Get latest daily portage snapshot
> emerge-webrsync
> 
> # Tell portage we want FEATURES=test for sys-apps/grep
> mkdir /etc/portage/env
> echo 'FEATURES="test"' > /etc/portage/env/run-tests.conf
> echo 'sys-apps/grep run-tests.conf' >> /etc/portage/package.env
> 
> # Build dev-libs/libpcre without jit to trigger the error
> echo 'dev-libs/libpcre -jit' >> /etc/portage/package.use/gnu_bug29446
> emerge -1 dev-libs/libpcre
> 
> # Chdir to grep ebuild
> cd $(portageq get_repo_path / gentoo)/sys-apps/grep
> 
> # Normally you would use `emerge ...` to install package and all deps, but because we don't want to merge package on disk and are only interested in running tests manually, we will use `ebuild` command
> ebuild grep-3.3-r1.ebuild clean test
> 
> # You should now see test 'pcre-jitstack' failing.
> # Feel free to inspect source and run test again:
> su portage --shell /bin/bash
> 
> # As portage use, chdir into work dir
> cd ~/sys-apps/grep-3.3-r1/work/grep-3.3
> 
> make check TESTS=pcre-jitstack

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