Skip to content

fix: resolve path canonicalization issue in acceptFolder on macOS/Windows#107

Open
maxandersen wants to merge 1 commit into
mainfrom
fix/path-canonicalization
Open

fix: resolve path canonicalization issue in acceptFolder on macOS/Windows#107
maxandersen wants to merge 1 commit into
mainfrom
fix/path-canonicalization

Conversation

@maxandersen

Copy link
Copy Markdown
Contributor

On macOS, temp directories resolve through /private/var (e.g. /var/folders/.../private/var/folders/...) causing jdkFolder.startsWith(jdksRoot) to return false when the jdkFolder path has been resolved via toRealPath() but jdksRoot has not.

This caused LinkedJdk.linked() to fall through to ExternalJdkProvider, producing external-<hash> ids instead of the correct provider id (e.g. 17.0.7-jbang).

Fix

Adds an isUnderRoot() helper in BaseFoldersJdkProvider that falls back to comparing real (canonical) paths when the simple startsWith check fails. The resolved real root path is cached for performance. DefaultJdkProvider.acceptFolder() is updated to use the same helper.

Related

…dows

On macOS, temp directories resolve through /private/var (e.g.
/var/folders/... -> /private/var/folders/...) causing
jdkFolder.startsWith(jdksRoot) to return false when the jdkFolder
path has been resolved via toRealPath() but jdksRoot has not.

This caused LinkedJdk.linked() to fall through to ExternalJdkProvider,
producing external-<hash> ids instead of the correct provider id.

The fix adds an isUnderRoot() helper that falls back to comparing
real (canonical) paths when the simple startsWith check fails.
The resolved real root path is cached for performance.

Fixes jbangdev/jbang#2515 test failures on macOS and Windows.
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ai-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e40f9df4-a507-47cf-99e2-b2c3fab181ca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant