Repository navigation
[core] Fix plugin lookup when Root.PluginPath has multiple directories - #23796
Open
JainAyush-01 wants to merge 1 commit into
Open
JainAyush-01 wants to merge 1 commit into
JainAyush-01 wants to merge 1 commit into
Conversation
When Root.PluginPath (or ROOT_PLUGIN_PATH) contains multiple colon-separated directories, TPluginManager::LoadHandlersFromPluginDirs loops over each directory to load handler macros for the requested base class. In commit e60640c (root-project#18859), ConcatFileName was replaced by PrependPathName. Unlike ConcatFileName which returned a new heap-allocated string, PrependPathName modifies its second parameter in-place. Because `sbase` was passed directly: const char *p = gSystem->PrependPathName(d, sbase); the variable `sbase` was mutated in-place across iterations (e.g., from "TArchiveFile" to "/dir1/TArchiveFile", then to "/dir2//dir1/TArchiveFile"). Consequently, subsequent search directories received a mangled path and ROOT could not find its own built-in plugins whenever a custom plugin directory was prepended. Fix this by copying `sbase` to a temporary `TString temp = sbase;` on each iteration, matching the pattern used in the rest of TPluginManager.cxx. Fixes root-project#23536. Added regression test in core/base/test/TPluginManagerTests.cxx.
JainAyush-01
requested review from
bellenot,
dpiparo and
pcanal
as code owners
October 22, 2026 11:17
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull request:
Fixes an in-place string mutation bug in
TPluginManager::LoadHandlersFromPluginDirsthat breaks plugin discovery whenRoot.PluginPath(orROOT_PLUGIN_PATH) contains multiple colon-separated directories.Changes or fixes:
Root Cause:
In commit e60640c (#18859),
gSystem->ConcatFileNamewas replaced withgSystem->PrependPathName. UnlikeConcatFileNamewhich returned a new heap-allocated string without modifying the input,PrependPathName(const char *dir, TString &name)modifiesnamein place.In
TPluginManager::LoadHandlersFromPluginDirs(const char *base):Because
sbasewas passed directly toPrependPathNamewithout copying to a temporary variable:dir0 = "/custom/plugins"):sbasewas mutated from"TArchiveFile"to"/custom/plugins/TArchiveFile".dir1 = "$ROOTSYS/etc/plugins"):PrependPathNameprependeddir1to the already mutatedsbase, resulting in"$ROOTSYS/etc/plugins//custom/plugins/TArchiveFile".As a result, whenever a user or experiment environment (e.g. ALICE O2 / JAliEn) prepended a custom directory to
Root.PluginPath, all subsequent directories—including ROOT's own built-in plugins in$ROOTSYS/etc/plugins—failed to load.Fix:
Copy
sbaseto a temporaryTString temp = sbase;inside the loop before callingPrependPathName(d, temp), matching the pattern already used in theelsebranch (lines 545–546) and throughoutTPluginManager.cxx.Testing:
TEST(TPluginManager, MultiDirectoryPluginPath)incore/base/test/TPluginManagerTests.cxx.ctest -R CorePluginManagerTests: 100% passed (0.26s).Checklist:
This PR fixes #23536