On Tue, Oct 27, 2015 at 8:49 AM, Bruce Dubbs <bruce.du...@gmail.com> wrote: > Paul Eggert wrote: >> >> Bruce Dubbs wrote: >>>> >>>> ( ulimit -s 50; LC_ALL=C src/grep -P -n '^([/](?!/)|[^/])*~/.*' >>>> pcrejit.txt ) >>>> >>>> but changing to a ulimit of 40 KB, it consistently segfaults. >>>> That also jibes with what valgrind --tool=massif --stacks=yes reports. >>> >>> >>> $ valgrind --tool=massif --stacks=yes ./grep -P -n >>> '^([/](?!/)|[^/])*~/.*' >>> pcrejit.txt >> >> >> Maybe the LC_ALL=C in Jim's test explains the differing behaviors? > > > I don't think so. I do not have any LC/LANG/LANGUAGE variables defined. > One thing that may be different is that I used > --enable-unicode-properties when building pcre. > > http://www.linuxfromscratch.org/blfs/view/svn/general/pcre.html
Thanks again for helping with this. I have adjusted the test to retry with unlimited stack size, if possible. Patch attached. I expect to push that and release grep-2.22 within the next few hours, so if anyone can try that, I'd appreciate it. This does not merit another snapshot.
From 3e24e1d86b4ccc53094208d599c8347716bda9c8 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@fb.com> Date: Sun, 1 Nov 2015 15:38:23 -0800 Subject: [PATCH] tests: pcre-jitstack: upon failure, retry with no stack size limit * tests/pcre-jitstack: Don't let an example that provokes inordinate stack space use cause a test failure. Thanks to reports from and analysis by Bruce Dubbs; see http://debbugs.gnu.org/21755 --- tests/pcre-jitstack | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/pcre-jitstack b/tests/pcre-jitstack index 03587f1..d9a5615 100755 --- a/tests/pcre-jitstack +++ b/tests/pcre-jitstack @@ -34,6 +34,19 @@ test $? -eq 0 || framework_failure_ gzip -d pcrejit.txt || framework_failure_ LC_ALL=C grep -P -n '^([/](?!/)|[^/])*~/.*' pcrejit.txt -test $? -eq 1 || fail=1 +if test $? != 1; then + # The above often makes grep attempt to use an inordinate amount + # of stack space. If grep fails with $? != 1, try gain, but this + # time with no soft limit: + + # Use ulimit to remove that limit, if possible. + # If ulimit is not usable, just skip this test. + (ulimit -s unlimited; : ) || skip_ this shell lacks ulimit support + + # Rerun that same test, but now with no limit on stack size: + (ulimit -s unlimited; + LC_ALL=C grep -P -n '^([/](?!/)|[^/])*~/.*' pcrejit.txt) + test $? = 1 || fail=1 +fi Exit $fail -- 2.6.0