Skip to content

#2286: Fix SystemPath.findBinary to search extraPathEntries - #2321

Merged
hohwille merged 8 commits into
devonfw:mainfrom
krystynaShatkovska:feature/issue-2286-systempath-findbinary-extra
Aug 18, 2026
Merged

#2286: Fix SystemPath.findBinary to search extraPathEntries#2321
hohwille merged 8 commits into
devonfw:mainfrom
krystynaShatkovska:feature/issue-2286-systempath-findbinary-extra

Conversation

@krystynaShatkovska

@krystynaShatkovska krystynaShatkovska commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2286

Implemented changes:

withPathEntry() adds directories to the PATH exported to child processes, but SystemPath.findBinary() never searched extraPathEntries. This caused binaries added this way to
fail with CreateProcess error=2.

  • Added extraPathEntries as the first search location in findBinary() — matching the PATH precedence order used by toString() (extraPathEntriestool2pathMappaths)
  • Added testFindBinaryFindsBinaryInExtraPathEntries() to verify the fix

Testing instructions

  1. Run mvn clean test — all tests (CLI: 848, GUI: 56, URL-Updater: 72) pass with BUILD SUCCESS
  2. The new test creates a directory with a fake binary, adds it via withPath(), and verifies findBinary() resolves it correctly

Checklist for this PR

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary»
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you
  • You followed all coding conventions
  • You have not changed any dependency in pom.xml files
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@github-project-automation github-project-automation Bot moved this to 🆕 New in IDEasy board Aug 12, 2026
@krystynaShatkovska krystynaShatkovska self-assigned this Aug 12, 2026
@krystynaShatkovska krystynaShatkovska added CLI IDEasy command-line-interface (parsing args, etc.) process executing external programs (ProcessContext) ready-to-implement labels Aug 12, 2026
…Entries to work on Linux

The test created 'faketool.cmd' which only exists on Windows. On Linux,
findBinaryInOrder doesn't try .cmd extensions, so the file was never
found, causing the assertion to fail.

Fixed by creating a plain 'faketool' file without extension, which works
on both Linux (no extension search) and Windows (falls through
EXTENSION_PRIORITY to empty extension).
@coveralls

coveralls commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 32148279960

Coverage remained the same at 72.933%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 5 coverage regressions across 3 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

5 previously-covered lines in 3 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/common/SystemPath.java 2 89.38%
com/devonfw/tools/ide/version/VersionSegment.java 2 90.81%
com/devonfw/tools/ide/tool/ide/IdeToolCommandlet.java 1 78.69%

Coverage Stats

Coverage Status
Relevant Lines: 17561
Covered Lines: 13357
Line Coverage: 76.06%
Relevant Branches: 7765
Covered Branches: 5114
Branch Coverage: 65.86%
Branches in Coverage %: Yes
Coverage Strength: 3.23 hits per line

💛 - Coveralls

@krystynaShatkovska krystynaShatkovska moved this from 🆕 New to Team Review in IDEasy board Aug 13, 2026

@Ali-Shariati-Najafabadi Ali-Shariati-Najafabadi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic looks right, extraPathEntries now gets checked before tool2pathMap, matching the order toString() already uses. Tested it against the actual bug path in ProcessContextImpl.run(), ran the full suite locally, all green.

Issue #2286 isn't labeled internal, so it needs a CHANGELOG.adoc entry per the DoD.

Comment thread cli/src/test/java/com/devonfw/tools/ide/common/SystemPathTest.java Outdated
Comment thread cli/src/test/java/com/devonfw/tools/ide/common/SystemPathTest.java
Comment thread cli/src/test/java/com/devonfw/tools/ide/common/SystemPathTest.java Outdated
The test created 'mytool' as a plain file, but collectToolPath only
registers subdirectories (checks Files.isDirectory before adding to
tool2pathMap). Changed to create 'mytool' as a subdirectory with the
binary file inside, so it's properly registered in tool2pathMap and
the test correctly verifies extra PATH entries win over tool2pathMap.

Fixes reviewer feedback on PR devonfw#2286.
@krystynaShatkovska
krystynaShatkovska force-pushed the feature/issue-2286-systempath-findbinary-extra branch from e5c0098 to 7ee800b Compare August 14, 2026 09:04
@Ali-Shariati-Najafabadi Ali-Shariati-Najafabadi moved this from Team Review to 👀 In review in IDEasy board Aug 14, 2026
@hohwille hohwille added this to the release:2026.08.002 milestone Aug 18, 2026

@hohwille hohwille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krystynaShatkovska thanks for your PR. Straight forward fix with solid JUnit test - nice job 👍
BTW: The end-user will not have any clue what this story will mean. It would have made mode sense to mark the story as internal. When I do not create the story, I miss such details and do not want to get in the way. I am just trying to raise the awareness in the team so you can understand for yourself what should belong into the CHANGELOG and what not.
For today, I want to get some PRs merged rather than blocking it due to such detailed discussions...

@hohwille
hohwille merged commit f1e5a54 into devonfw:main Aug 18, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in IDEasy board Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI IDEasy command-line-interface (parsing args, etc.) process executing external programs (ProcessContext) ready-to-implement

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

SystemPath.findBinary ignores extraPathEntries, so withPathEntry has no effect on binary resolution

4 participants