Tarun4201 commented on code in PR #13239:
URL: https://github.com/apache/maven/pull/13239#discussion_r4070064479


##########
apache-maven/src/assembly/maven/bin/mvn:
##########
@@ -462,6 +462,38 @@ if $cygwin || $mingw ; then
 fi
 MAVEN_PROJECTBASEDIR="$MAVEN_PROJECTBASEDIR_NATIVE"
 
+# MNG-8056: Under Cygwin, the JVM is a native Windows process and cannot 
resolve
+# Cygwin-style POSIX paths (e.g. /cygdrive/c/...) directly.  The internal paths
+# (MAVEN_HOME, CLASSWORLDS_CONF, JAVA_HOME, …) are already converted above, but
+# user-supplied paths passed via -f/--file, -s/--settings, 
-gs/--global-settings,
+# -st/--toolchains and -gt/--global-toolchains reach the JVM unconverted.
+# The loop below rewrites only those argument values that begin with '/' 
(absolute
+# POSIX paths); relative paths and already-Windows paths are left unchanged.
+# MinGW/MSYS2 perform automatic path mangling, so the fix is Cygwin-only.
+if $cygwin ; then
+  _cygwin_convert_paths() {
+    _out=; _np=false
+    for _a do
+      if $_np; then
+        case "$_a" in
+          /*) _a=$(cygpath --windows "$_a") ;;
+        esac
+        _np=false
+      else
+        case "$_a" in

Review Comment:
   Robust Argument Tokenization: I replaced the error-prone eval set -- and sed 
escaping logic with a clean, POSIX-compliant while loop that iterates over the 
arguments using shift and set -- "$@" "$_a". This safely modifies the arguments 
in-place without breaking any quotes, spaces, or native token boundaries. This 
inherently fixes the issue where arguments were getting mangled or lost in 
restricted environments.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to