Check whether ROOTSYS is defined in rootcling_stage1.#10776
Conversation
|
Can one of the admins verify this patch? |
|
That's a symptom of another issue that we also need to understand. |
|
Yes, this happened because I was trying to compile on an officially unsupported system. The function |
|
|
||
| static const char *GetIncludeDir() { | ||
| static std::string incdir = std::string(getenv("ROOTSYS")) + "/include"; | ||
| const char *rootsys = getenv("ROOTSYS"); |
There was a problem hiding this comment.
Should we instead assert that ROOTSYS is set at this point? This is rootcling_stage1.cxx - ROOTSYS must have been set by rootcling itself.
There was a problem hiding this comment.
Yes, I agree that it is a better idea since the variable should always be defined. As requested, the assertion is added together with a comment pointing to the place of definition.
|
Hi @chilikink, what's the status of this PR? Is this tweak still needed, and so you still want to get it merged? If yes, please let us know and resolve the conflicts by re-basing the commits on master. |
|
Superseded by #12996. Thanks for the initial effort, I'm sure it was helpful for the authors of the linked PR! |
This Pull request:
Changes or fixes:
It is not checked in the existing code whether
getenv("ROOTSYS")returnsNULL. It does so if the environment variable is not defined; it is exactly what happens during building here. Thenstd::stringgets initialized from the C string from address 0, which may result in a segmentation fault.Checklist:
This PR fixes #