pyROOT crashes when "$" in arguments

Dear ROOT experts,

I found that when a $ symbol is present in the arguments to a python2.7.6 script that uses pyROOT, I get an odd crash.

Example script

#!/usr/bin/env python
import argparse

if __name__ == "__main__":

    parser = argparse.ArgumentParser()
    parser.add_argument("-c", "--cut", help="Specify a TCut expression", default="")
    args = parser.parse_args()

    print "Your cut was: {}".format(args.cut)
    import ROOT as r
    ch = r.TChain("t")

I run it with python blah.py -c 'test' with no problems, but something like python blah.py -c 'Sum$(1)' causes the segfault below.

Your cut was: Sum$(1)
Error in <TSystem::ExpandFileName>: input: Sum$, output: Sum$

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x0000003005eac82e in waitpid () from /lib64/libc.so.6
#1  0x0000003005e3e479 in do_system () from /lib64/libc.so.6
#2  0x00007f06ebe761ca in TUnixSystem::StackTrace() () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc493/lib/libCore.so
#3  0x00007f06ebe7819c in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc493/lib/libCore.so
#4  <signal handler called>
#5  0x00007f06ebe792a2 in TUnixSystem::UnixFilestat(char const*, FileStat_t&) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc493/lib/libCore.so
#6  0x00007f06ebdcb9cd in TSystem::GetPathInfo(char const*, long*, long long*, long*, long*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc493/lib/libCore.so
#7  0x00007f06ebd8dfef in TApplication::GetOptions(int*, char**) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc493/lib/libCore.so
#8  0x00007f06ebd8ea31 in TApplication::TApplication(char const*, int*, char**, void*, int) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc493/lib/libCore.so
#9  0x00007f06ec67ae74 in PyROOT::TPyROOTApplication::TPyROOTApplication(char const*, int*, char**, bool) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/lcg/root/6.06.00-ikhhed5/lib/libPyROOT.so
#10 0x00007f06ec67b02a in PyROOT::TPyROOTApplication::CreatePyROOTApplication(bool) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/lcg/root/6.06.00-ikhhed5/lib/libPyROOT.so
#11 0x00007f06eb8a906e in ?? ()
#12 0x00007ffd1b1e5b50 in ?? ()
#13 0x00007ffd1b1e5bdf in ?? ()
#14 0x00007ffd1b1e5b10 in ?? ()
#15 0x0000000000000000 in ?? ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x00007f06ebe792a2 in TUnixSystem::UnixFilestat(char const*, FileStat_t&) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc493/lib/libCore.so
#6  0x00007f06ebdcb9cd in TSystem::GetPathInfo(char const*, long*, long long*, long*, long*) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc493/lib/libCore.so
#7  0x00007f06ebd8dfef in TApplication::GetOptions(int*, char**) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc493/lib/libCore.so
#8  0x00007f06ebd8ea31 in TApplication::TApplication(char const*, int*, char**, void*, int) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_20/external/slc6_amd64_gcc493/lib/libCore.so
#9  0x00007f06ec67ae74 in PyROOT::TPyROOTApplication::TPyROOTApplication(char const*, int*, char**, bool) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/lcg/root/6.06.00-ikhhed5/lib/libPyROOT.so
#10 0x00007f06ec67b02a in PyROOT::TPyROOTApplication::CreatePyROOTApplication(bool) () from /cvmfs/cms.cern.ch/slc6_amd64_gcc493/lcg/root/6.06.00-ikhhed5/lib/libPyROOT.so
#11 0x00007f06eb8a906e in ?? ()
#12 0x00007ffd1b1e5b50 in ?? ()
#13 0x00007ffd1b1e5bdf in ?? ()
#14 0x00007ffd1b1e5b10 in ?? ()
#15 0x0000000000000000 in ?? ()
===========================================================

It looks like the TChain constructor triggers the segfault. The ROOT import alone is harmless as far as I can see. Right now, I’m having to use some arbitrary token in place of the $ on the command line, and then replace that token with $ after creating and using my TChain.

Any idea as to what’s going on?

P.S. I am using v6.06/01 of ROOT.

Thanks in advance!
Nick

Maybe @wlav or @mato can give some hints…

Hi,

you can try

#!/usr/bin/env python
import argparse

if __name__ == "__main__":

    parser = argparse.ArgumentParser()
    parser.add_argument("-c", "--cut", help="Specify a TCut expression", default="")
    args = parser.parse_args()

    print "Your cut was: {}".format(args.cut)
    import ROOT as r
    r.PyConfig.IgnoreCommandLineOptions = True # <------------------
    ch = r.TChain("t")

Hi,

Thanks for the prompt response. This works perfectly for me.

Thanks again,
Nick

1 Like

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