Skip to content

Conversation

@bmarwell
Copy link
Contributor

@bmarwell bmarwell commented Nov 27, 2025

@bmarwell bmarwell requested a review from gnodet November 27, 2025 20:08
gnodet added a commit to gnodet/maven that referenced this pull request Dec 2, 2025
This commit unifies the .mvn/jvm.config parsing approach by using
JvmConfigParser.java on both Unix and Windows platforms, solving
multiple related issues with special character handling.

Issues Fixed:
- MNG-11363: Pipe symbols (|) in jvm.config cause shell parsing errors
- MNG-11485: Non-POSIX xargs -0 fails on AIX, FreeBSD, and other systems
- MNG-11486: sed command fails when paths contain @ symbols

Changes:
- Modified mvn (Unix): Replaced awk/sed pipeline with JvmConfigParser.java
  compilation and execution. This ensures POSIX compliance and handles
  all special characters (pipes, quotes, @, etc.) correctly.
- Modified mvn.cmd (Windows): Removed debug output and updated comments
  to reflect all special characters now handled correctly.
- Added integration test MavenITgh11485AtSignInJvmConfigTest to verify
  @ symbol handling in jvm.config files (important for Jenkins workspaces
  like workspace/project_PR-350@2).

The Java-based parser approach:
- Handles comment removal (both # at start and end-of-line)
- Performs variable substitution (${MAVEN_PROJECTBASEDIR})
- Correctly parses quoted arguments with special characters
- Works consistently across all platforms
- Is POSIX-compliant (no xargs -0, awk, or complex sed needed)

Performance Impact:
Unix script is ~200ms slower (320ms → 520ms for mvn -v) due to Java
compilation, but this is acceptable for the correctness, maintainability,
and cross-platform consistency benefits.

Related PRs:
- Fixes apache#11365 (MNG-11363: pipe symbols)
- Fixes apache#11489 (MNG-11485: POSIX compliance)
- Fixes apache#11499 (MNG-11486: @ symbols in paths)
@gnodet
Copy link
Contributor

gnodet commented Dec 2, 2025

This PR has been superseded by #11365, which now fixes all three related issues:

The unified solution uses JvmConfigParser.java on both Unix and Windows platforms, ensuring consistent behavior and handling all special characters correctly.

Integration tests for @ symbol handling have been added to #11365.

@bmarwell bmarwell closed this Dec 2, 2025
@bmarwell bmarwell deleted the #11486_sed_at_pipe branch December 2, 2025 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sed: -e expression #1, char 125: unknown option to `s'

3 participants