Skip to content

Fix macOS CI failure in test-mvn-path-conversion.sh (PR #12546) - #12563

Closed
gnodet wants to merge 2 commits into
masterfrom
ci-fix/mvn-path-test-double-slash
Closed

Fix macOS CI failure in test-mvn-path-conversion.sh (PR #12546)#12563
gnodet wants to merge 2 commits into
masterfrom
ci-fix/mvn-path-test-double-slash

Conversation

@gnodet

@gnodet gnodet commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes the 22 test assertion failures in test-mvn-path-conversion.sh that affect all macOS CI jobs in PR Convert paths for MSYS2 and jvm.config placeholders in bin/mvn #12546
  • Root cause: On macOS, $TMPDIR ends with a trailing / (e.g. /var/folders/.../T/), so mktemp -d "${TMPDIR}/..." produces a path with a double slash (/T//mvn-path-...). The pwd builtin inside the mvn launcher normalizes this to a single slash, causing every path assertion in the test to mismatch.
  • Fix: Normalize work_dir through cd/pwd immediately after mktemp, so the test's reference paths match what the launcher produces.

This is a one-line fix (plus comment) that resolves all 22 failures without changing the launcher script itself.

Applies on top of PR #12546.

Test plan

  • All 29 assertions pass locally (Linux)
  • CI should now pass on macOS (was failing on all 6 macOS jobs)
  • Ubuntu and Windows jobs should continue to pass (unaffected by this change)

🤖 Generated with Claude Code

Hiteshsai007 and others added 2 commits July 28, 2026 11:05
The launcher already converted POSIX paths to their native Windows form
for Cygwin and MinGW (GH-7958), but a few paths still reached the JVM in
a mangled or mixed form:

* uname(1) reports MSYS_NT-* for the MSYS2 shell, which did not match the
  MINGW* pattern, so no conversion happened at all there. The MSYS2
  argument conversion then rewrote the POSIX path into the mixed form
  D:/a/... instead of D:\a\...

* ${MAVEN_PROJECTBASEDIR} placeholders in .mvn/jvm.config were expanded
  with the POSIX path, since JvmConfigParser was invoked before the
  conversion took place. The base directory is now converted upfront and
  both representations are kept: the POSIX one to locate jvm.config from
  the shell, the native one for everything handed over to the JVM.

* -Dlibrary.jline.path was built by appending /lib/jline-native to the
  already converted MAVEN_HOME, producing C:\maven/lib/jline-native. It
  is now converted on its own.

Values holding a path are printed with printf rather than echo, including
the debug logging: several POSIX shells (dash and the other Almquist
derivatives commonly installed as /bin/sh) expand backslash escapes in
echo, so C:\tmp\build was emitted with a tab in place of \t. The
conversion is also guarded, so a missing cygpath(1) warns and falls back
to POSIX paths rather than passing empty paths to the JVM.

A shell test covering all of the above is added and wired into the build
through exec-maven-plugin, so mvn verify runs it. It stubs uname, cygpath
and java and runs the launcher with a PATH holding nothing but those
stubs, so the Windows-only code paths are exercised identically on every
platform; keeping the ambient PATH would let the genuine cygpath(1) of an
actual Cygwin/MSYS2 installation be picked up and the missing-cygpath
fallback would never be exercised there.

Related to GH-12537
On macOS the $TMPDIR variable ends with a trailing slash, so
mktemp -d "${TMPDIR}/mvn-path-conversion.XXXXXX" produces a path
containing a double slash (e.g. .../T//mvn-path-conversion.XNBzZw).
The pwd(1) calls inside the mvn launcher collapse the double slash,
causing all 22 path assertions to fail on macOS CI runners.

Resolve the work directory through cd/pwd right after creation so
the test's reference paths stay in sync with the launcher output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Hiteshsai007

Copy link
Copy Markdown
Contributor

Confirmed — this is a bug in my test harness, not the launcher. I reproduced it locally with TMPDIR=/tmp/foo/ and got exactly the same 22 failures: pwd inside the launcher collapses the // that mktemp returns, so the test's reference paths never matched.

Verified your fix passes with a trailing-slash TMPDIR, a normal one, and with TMPDIR unset, across sh/dash/bash/busybox sh. It also still reports failures against the unpatched launcher, so the normalisation hasn't made the test vacuous.

Thanks for catching and fixing it — happy for this to be merged in place of #12546.

@gnodet

gnodet commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Pushed the fix commit directly to PR #12546's branch instead. The macOS CI fix is now part of that PR.

@gnodet gnodet closed this Jul 28, 2026
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