Skip to content

Conversation

@ahmedbilal9
Copy link

Fixes #7052

Changes or fixes:

The --replace flag was not being checked when copying regular objects (non-tree, non-collection) in recursive mode. This caused objects to be written with new cycles instead of replacing existing ones.

Added replaceOption check in the else block of copyRootObjectRecursive() to delete existing objects before writing replacements.

Checklist:

  • Tested changes locally
  • Updated the docs (if necessary)

@ahmedbilal9 ahmedbilal9 requested a review from pcanal as a code owner November 8, 2025 08:05
@guitargeek
Copy link
Contributor

Thank you very much for your PR! Could you fix the Python syntax errors? Thanks.

The --replace flag was not being checked when copying regular objects
(non-tree, non-collection) in recursive mode. This caused objects to be
written with new cycles instead of replacing existing ones.

Added replaceOption check in the else block of copyRootObjectRecursive()
to delete existing objects before writing replacements.

Fixes root-project#7052
@ahmedbilal9 ahmedbilal9 force-pushed the fix-rootcp-replace-recursive branch from 674d1cb to 4c59740 Compare November 8, 2025 09:50
Ahmed Bilal added 2 commits November 8, 2025 15:17
The --replace flag was not being checked when copying regular objects
(non-tree, non-collection) in recursive mode. This caused objects to be
written with new cycles instead of replacing existing ones.

Added replaceOption check in the else block of copyRootObjectRecursive()
to delete existing objects before writing replacements.

Fixes root-project#7052
@ahmedbilal9
Copy link
Author

The CI failures appear to be unrelated to my changes. The build is failing with:

Error: roofit/hs3/src/RooJSONFactoryWSTool.cxx:260:1: error: '{anonymous}::Var::Var' defined but not used [-Werror=unused-function]

This error is in C++ RooFit code, while my changes only modify main/python/cmdLineUtils.py. The Python linting checks (ruff) pass successfully.

Could a maintainer please advise if this is a known issue or if I should rebase on the latest master?

@dpiparo dpiparo requested a review from silverweed November 8, 2025 17:12
@github-actions
Copy link

github-actions bot commented Nov 8, 2025

Test Results

    19 files      19 suites   3d 13h 19m 41s ⏱️
 3 741 tests  3 737 ✅   1 💤  3 ❌
69 365 runs  69 058 ✅ 287 💤 20 ❌

For more details on these failures, see this check.

Results for commit 86a3691.

@ahmedbilal9
Copy link
Author

Hi @bellenot,

I've fixed the Python linting errors as requested. The ruff check now passes successfully .

However, the CI is failing with an error in RooFit code that appears unrelated to my changes:
Error: roofit/hs3/src/RooJSONFactoryWSTool.cxx:260:1: error: '{anonymous}::Var::Var' defined but not used
My PR only modifies main/python/cmdLineUtils.py, while this failure is in C++ RooFit code.

Could you advise if:

  1. This is a known issue in the current master branch?
  2. Should I rebase my branch on the latest master?
  3. Or should we wait for the RooFit issue to be resolved?

Thank you for your guidance!

@bellenot
Copy link
Member

Hi @ahmedbilal9 I see failures like:

1795:roottest-main-SimpleRootmv1
1796:roottest-main-SimpleRootmv1CheckOutput
1797:roottest-main-SimpleRootmv1Clean

And not the one with RooFit

@ahmedbilal9
Copy link
Author

Hi @ahmedbilal9 I see failures like:

1795:roottest-main-SimpleRootmv1
1796:roottest-main-SimpleRootmv1CheckOutput
1797:roottest-main-SimpleRootmv1Clean

And not the one with RooFit

Hi @bellenot,

Thank you for clarifying! I see now - the failures are in the roottest-main-SimpleRootmv tests, not the RooFit code.

I'll investigate these test failures:

  • roottest-main-SimpleRootmv1
  • roottest-main-SimpleRootmv1CheckOutput
  • roottest-main-SimpleRootmv1Clean

Could you point me to where I can find the detailed CI logs for these tests, or should I look at the full CI output? I want to understand what specific behavior is failing so I can fix it properly.

Thank you!

The previous implementation would delete the existing object but then
skip writing the replacement due to 'continue' statement. This caused
the roottest-main-SimpleRootmv1 tests to fail.

Now after deleting, the code flows through to write the new object.
@bellenot
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rootcp --replace option ineffective

4 participants