Subject: bug#47396: grep-3.6 stack-overflow test fails on fedora rawhide

From: Paul Eggert <[email-masked]>
Date: Mon, 9 Aug 2021 04:28:19 -0700

On 3/25/21 11:53 AM, Jaroslav Skarvada wrote:

> on fedora rawhide the stack-overflow test is failing for grep-3.6:

Thanks for reporting the problem. I'm not seeing it on Fedora 34 x86-64 
with the current Savannah master grep:

23-penguin $ i=3;printf %0${i}0000d 0|tr 0 '(' > in
24-penguin $ ./grep -E -f in
grep: stack overflow

which is the expected behavior.

We're planning to release a new grep, and it uses current Gnulib which 
has some bug fixes in the stack-overflow area, so perhaps the bug is 
fixed now. You can see if it works for you by building from a very 
recent snapshot as per this email:

https://lists.gnu.org/r/grep-devel/2021-08/msg00003.html

I configured using the flags you specified:

./configure CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g 
-grecord-gcc-switches -pipe -Wall -Werror=format-security 
-Wp,-_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS 
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong 
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic 
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' 
LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now 
-specs=/usr/lib/rpm/redhoat/redhat-hardened-ld '

Since I was building from .git and warnings are enabled, I needed to 
build with:

make WERROR_CFLAGS=

to prevent diagnostics from stopping the build. I did not have time to 
investigate whether the warnings are bogus, as they usually are.