Make sure you completed the following tasks
Environment and version details
- Operating System+version: Kubuntu 24.04
- Compiler+version: GCC 13.3
- Shell: Bash
- B2 Version: B2 5.4.2 (OS=LINUX, jobs=16) (built from revision 85252c9d6a3817daca23ddae94ce16c7be4d2c12 in tools/build)
Brief problem description
b2 crashes with SIGSEGV when regex.replace is used in a Jamfile like this:
import regex ;
rule check-linkflag-no-undefined ( properties * )
{
local result ;
if <link>shared in $(properties)
{
local props ;
for local property in $(properties)
{
ECHO "Input property: $(property)" ;
if [ MATCH "^(<(c|cxx|link)flags>.*-fsanitize=.+)$" : $(property) ]
{
property = [ regex.replace $(property) : "-fsanitize=[^\s]+\s*" : "" ] ; # <- HERE
# property = [ regex.transform $(property) : "^(.*)\s*$" : 1 ] ;
if [ MATCH "^(<(c|cxx|link)flags>)\s*$" : $(property) ]
{
continue ;
}
}
ECHO "Output property: $(property)" ;
props += $(property) ;
}
if [ configure.builds ../config//has_linkflag_no_undefined : $(props) : "has -Wl,--no-undefined" ]
{
result = <linkflags>"-Wl,--no-undefined" ;
}
else if [ configure.builds ../config//has_linkflag_undefined_error : $(props) : "has -Wl,-undefined,error" ]
{
result = <linkflags>"-Wl,-undefined,error" ;
}
}
#ECHO Result: $(result) ;
return $(result) ;
}
In my case, the property that triggers this is "-Wno-unused-local-typedefs -fsanitize=address -ftemplate-backtrace-limit=0".
Here is the backtrace:
b2_crash.txt
Steps to reproduce the issue
This issue appeared in my work-in-progress version of Boost.Filesystem Jamfile. To reproduce:
- Open libs/filesystem/build/Jamfile.v2.
- Replace the
check-linkflag-no-undefined rule with the one presented above.
- In Boost root, run
b2:
b2 -j 8 --toolset=gcc cxxstd=17-gnu "cxxflags=-Wno-unused-local-typedefs -fsanitize=address -ftemplate-backtrace-limit=0" "linkflags=-fsanitize=address" variant=debug debug-symbols=on threading=multi runtime-link=shared link=static libs/filesystem/test
Actual behavior summary
The build crashes with SIGSEGV.
Expected behavior summary
b2 should not crash.
Make sure you completed the following tasks
Environment and version details
Brief problem description
b2crashes with SIGSEGV whenregex.replaceis used in a Jamfile like this:In my case, the property that triggers this is "-Wno-unused-local-typedefs -fsanitize=address -ftemplate-backtrace-limit=0".
Here is the backtrace:
b2_crash.txt
Steps to reproduce the issue
This issue appeared in my work-in-progress version of Boost.Filesystem Jamfile. To reproduce:
check-linkflag-no-undefinedrule with the one presented above.b2:Actual behavior summary
The build crashes with SIGSEGV.
Expected behavior summary
b2should not crash.