ROOT 6.22/06 mis-handling regex special characters in $CMAKE_SOURCE_DIR

Root version: 6.22/06
OS: Linux Debian Buster
Compiler: GCC 8.3.0

CMake fails when there is a “+” in ${CMAKE_SOURCE_DIR}. I suspect any special regular expression character would cause a problem.

The problem can be reproduced in a debian:buster-slim docker image with the following commands:

$ apt -y update && apt -y upgrade && apt -y install dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev python  libmariadb-dev  gfortran libpcre3-dev xlibmesa-glu-dev libglew1.5-dev libftgl-dev  libfftw3-dev libcfitsio-dev graphviz-dev libavahi-compat-libdnssd-dev libldap2-dev python-dev libxml2-dev libkrb5-dev libgsl0-dev libqt4-dev  libssl-dev git python3 python3-dev                                               
$ git clone --branch=v6-22-06 --depth=1 https://github.com/root-project/root.git root/root_src+tag
$ mkdir root/root_build && cd root/root_build
$ cmake -DCMAKE_CXX_STANDARD=11 -Druntime_cxxmodules=OFF  -Dthread=ON -Dshadowpw=ON -Dpythia8=ON -Dr=ON -Dminuit2=ON -Dmathmore=ON -Ddataframe=ON -Ddcache=ON -Dfortran=ON -Dgfal=ON -Dgsl_shared=ON -Dgviz=ON -Dmysql=ON -Dodbc=ON -Dopengl=ON -Dpgsql=ON -Dsoversion=ON -Dtmva-rmva=ON -Dunuran=ON -Dvmc=ON -Dxrootd=ON -Dbuiltin_xrootd=ON -Dbuiltin_gsl=OFF -Dgnuinstall=ON -Dimt=OFF -Ddavix=ON -Dmemstat=ON -Dbuiltin_vdt=OFF -Dvdt=ON -Dbuiltin_llvm=ON -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../root_src+tag

CMake will fail trying to bulid the MultiProc dictionary.

I think the culprit is is in cmake/modules/RootMacros.cmake:301

if(${dir} MATCHES "^${CMAKE_SOURCE_DIR}")

It builds a regex out of $CMAKE_SOURCE_DIR without handling special characters.

Hi @evonreis,
thank you for the report, could you please open an issue at https://github.com/root-project/root/issues so we don’t forget to take a look?

Cheers,
Enrico

New issue posted here: https://github.com/root-project/root/issues/7009

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.