You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "bmarwell (via GitHub)" <gi...@apache.org> on 2023/01/22 20:37:47 UTC

[GitHub] [maven-wrapper] bmarwell commented on a diff in pull request #44: [MWRAPPER-67] Remove '\r' when using IFS on windows for wrapperUrl from mvnw script usage such as git bash

bmarwell commented on code in PR #44:
URL: https://github.com/apache/maven-wrapper/pull/44#discussion_r1083540094


##########
maven-wrapper-distribution/src/resources/mvnw:
##########
@@ -194,7 +194,9 @@ else
       wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar"
     fi
     while IFS="=" read -r key value; do
-      case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;;
+      # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
+      safeValue=$(echo "$value" | sed 's/\r$//')

Review Comment:
   -1. See: https://www.shellcheck.net/wiki/SC2006
   We use `/bin/sh` which  should never point too `csh`, only  to posix compliant shells (bash, dash on Ubuntu).
   If you do this, shellcheck will fail.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org