Skip to content

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

Open
krystynaShatkovska wants to merge 7 commits into
devonfw:mainfrom
krystynaShatkovska:feature/issue-2286-systempath-findbinary-extra
Open

#2286: Fix SystemPath.findBinary to search extraPathEntries#2321
krystynaShatkovska wants to merge 7 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 31786549548

Warning

No base build found for commit 31dabbf on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 72.93%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 17553
Covered Lines: 13347
Line Coverage: 76.04%
Relevant Branches: 7763
Covered Branches: 5116
Branch Coverage: 65.9%
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
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: 👀 In review

Development

Successfully merging this pull request may close these issues.

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

3 participants