Skip to content

Clarify realpath vs readlink fallback logic in Java integration script#28

Closed
Copilot wants to merge 1 commit into23-support-java_home-integration-for-misefrom
copilot/sub-pr-24-again
Closed

Clarify realpath vs readlink fallback logic in Java integration script#28
Copilot wants to merge 1 commit into23-support-java_home-integration-for-misefrom
copilot/sub-pr-24-again

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Addressed review question about the difference between the current realpath/readlink fallback implementation and the suggested alternative approach.

Context

The script verifies symbolic links by comparing resolved paths. Lines 78-86 implement a fallback pattern:

# Current implementation
REAL_LINK_TARGET=$(realpath "$TARGET_DIR/Contents" 2>/dev/null)
EXPECTED_TARGET=$(realpath "$JAVA_INSTALL_PATH/Contents" 2>/dev/null)

if [ -z "$REAL_LINK_TARGET" ] || [ -z "$EXPECTED_TARGET" ]; then
    REAL_LINK_TARGET=$(readlink "$TARGET_DIR/Contents")
    EXPECTED_TARGET="$JAVA_INSTALL_PATH/Contents"
fi

Response

Both the current implementation and the suggested command -v realpath check achieve the same result:

  • Current: Attempts realpath, suppresses errors via 2>/dev/null, falls back on empty output
  • Suggested: Checks for realpath existence first, then attempts it

The current approach is sufficient because error suppression handles both "command not found" and "command failed" cases. The explicit availability check adds verbosity without functional benefit in this context.

No code changes required—current implementation is correct.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update Java integration script for macOS java_home Clarify realpath vs readlink fallback logic in Java integration script Jan 22, 2026
Copilot AI requested a review from paigeman January 22, 2026 14:38
@paigeman paigeman closed this Jan 22, 2026
@paigeman paigeman deleted the copilot/sub-pr-24-again branch January 22, 2026 14:49
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.

2 participants

Comments