Skip to content

Commit

Permalink
[core] Use the resolved library path.
Browse files Browse the repository at this point in the history
GetSharedLibDeps may need to resolve to the absolute path, however, if we give
only the file stem GetSharedLibDeps cannot support features such as resolving
of relative path to $ROOTSYS/lib/. For example,
`cd /home/`; root.exe -e 'gSystem->Load("../test/libEvent.so")'.
`TSystem::Load` will call an interface passing the relative path which will
resolve to $ROOTSYS/lib/../test/libEvent.so, however, if GetSharedLibDeps calls
the same interface it will give the wrong results.

This patch fixes this behavior and optimizes GetSharedLibDeps when we have
already the full path.
  • Loading branch information
vgvassilev committed Mar 28, 2020
1 parent a7869de commit 3572435
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/base/src/TSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1838,8 +1838,7 @@ int TSystem::Load(const char *module, const char *entry, Bool_t system)
{
// don't load libraries that have already been loaded
TString libs( GetLibraries() );
TString moduleBasename( BaseName(module) );
TString l(moduleBasename);
TString l(BaseName(module));

Ssiz_t idx = l.Last('.');
if (idx != kNPOS) {
Expand Down Expand Up @@ -1887,7 +1886,7 @@ int TSystem::Load(const char *module, const char *entry, Bool_t system)
int ret = -1;
if (path) {
// load any dependent libraries
TString deplibs = gInterpreter->GetSharedLibDeps(moduleBasename);
TString deplibs = gInterpreter->GetSharedLibDeps(path);
if (deplibs.IsNull()) {
TString libmapfilename;
libmapfilename = path;
Expand All @@ -1899,7 +1898,7 @@ int TSystem::Load(const char *module, const char *entry, Bool_t system)
if (gSystem->GetPathInfo(libmapfilename, 0, (Long_t*)0, 0, 0) == 0) {
if (gDebug > 0) Info("Load", "loading %s", libmapfilename.Data());
gInterpreter->LoadLibraryMap(libmapfilename);
deplibs = gInterpreter->GetSharedLibDeps(moduleBasename);
deplibs = gInterpreter->GetSharedLibDeps(path);
}
} else {
TString delim(" ");
Expand Down

0 comments on commit 3572435

Please sign in to comment.