nick-boss-tech opened a new pull request, #5116:
URL: https://github.com/apache/solr/pull/5116

   🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)*
   
   https://issues.apache.org/jira/browse/SOLR-18540
   
   ## What happens today
   
   **gradlew fails under Git Bash on Windows before the build starts, because 
APP_HOME and CLASSPATH are converted to Windows form twice.**
   
   APP_HOME is converted once early in the script, at [line 
159](https://github.com/nick-boss-tech/solr/blob/d76fc14b9857e77b830d7a82514b28c523a239c2/gradlew#L159)
 (line numbers in this section are at the merge-base commit), so by the time 
the script reaches the Cygwin and MSYS block it is already a Windows path. The 
block converts APP_HOME and CLASSPATH a second time, at [lines 216 to 
217](https://github.com/nick-boss-tech/solr/blob/d76fc14b9857e77b830d7a82514b28c523a239c2/gradlew#L216-L217).
 `cygpath --path` treats its input as a colon-separated list, so the second 
conversion splits the path at the drive-letter colon and produces a classpath 
like `C;C:/Users/.../gradle-wrapper.jar`. The JVM then reports: Could not find 
or load main class org.gradle.wrapper.GradleWrapperMain.
   
   ## What this change does
   
   **This change deletes the second conversion, so each path is converted 
once.**
   
   The deleted lines are the second APP_HOME conversion, the second CLASSPATH 
conversion, and the blank line after them, in the Cygwin and MSYS block of 
[gradlew](https://github.com/nick-boss-tech/solr/blob/58e07b4571fbbfc83c14bdd28283cd573acb0d7a/gradlew#L214-L216).
 The JAVACMD conversion in the same block stays. APP_HOME is already in Windows 
form from the first conversion, and CLASSPATH is built from APP_HOME, so 
neither needs converting again. gradlew.bat has no cygpath conversion and does 
not change.
   
   ## Proof
   
   **On a Windows Git Bash host, the unmodified script fails with the error 
above, and the changed script prints Gradle 9.7.0 and exits 0.**
   
   I ran `gradlew -version` under Git Bash (MINGW64, JDK 21) on 2026-10-11, 
once on unmodified main (498a09aea97) and once on this branch before the 
changelog entry was added (192aacaaf89). The main run failed with "Could not 
find or load main class org.gradle.wrapper.GradleWrapperMain", exit 1. The 
branch run printed Gradle 9.7.0, exit 0. The only tree change since that run is 
the changelog entry, so the gradlew that was run is the gradlew in this PR. The 
run covers wrapper startup only; see Limits.
   
   ## Limits
   
   **Only wrapper startup was run: gradlew -version under Git Bash (MSYS), one 
run per tree on one host.**
   
   - gradlew check, gradlew build, and test tasks were not run.
   - Cygwin (non-MSYS) was not run. The deleted lines sat in the block shared 
by Cygwin and MSYS, and the first conversion covers both, but only MSYS was 
exercised.
   - gradlew.bat, Linux, and macOS were not run. The change touches only the 
Cygwin and MSYS block, so other platforms never reach the deleted lines.
   
   Changelog: 
[changelog/unreleased/SOLR-18540-gradlew-git-bash.yml](https://github.com/nick-boss-tech/solr/blob/58e07b4571fbbfc83c14bdd28283cd573acb0d7a/changelog/unreleased/SOLR-18540-gradlew-git-bash.yml)
   
   ### AI assistance
   
   AI agents assisted with research, implementation, review, and drafting. Nick 
Shanin directed the work and takes responsibility for this contribution.
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to