quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.6k stars 2.63k forks source link

quarkus:update fails on Windows with quarkus-cli #43473

Open codengine opened 20 hours ago

codengine commented 20 hours ago

Describe the bug

I'm using the Quarkus CLI 3.14.4 that I installed through Chocolatey with PowerShell on Windows 10. When I try to update my project through quarkus:update, the generated openrewrite recipe contains a non-escaped path to the recipe itself here:

configFile = project.getRootProject().file("C:\Users\xxx\AppData\Local\Temp\quarkus-project-recipe-8715019618984806815.yaml")

It should be

configFile = project.getRootProject().file("C:\\Users\\xxxx\\AppData\\Local\\Temp\\quarkus-project-recipe-8715019618984806815.yaml")

With that change, the recipe works fine when I invoke the upgrade through gradle manually.

Moreover, instead of reporting the error, the upgrade itself is stuck and does nothing.

Expected behavior

The upgrade is cancelled on errors and paths should be generated correctly on Windows environments.

Actual behavior

Process is stuck and silent, upgrade fails.

How to Reproduce?

Output of uname -a or ver

Windows 10 22H2

Output of java -version

openjdk version "22.0.1" 2024-04-16

Quarkus version or git rev

3.14.4

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.8

Additional information

No response

quarkus-bot[bot] commented 20 hours ago

/cc @ebullient (cli), @maxandersen (cli)

maxandersen commented 2 hours ago

the bug is here https://github.com/quarkusio/quarkus/blob/main/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/update/rewrite/QuarkusUpdateCommand.java#L85

that is resulting in an unescaped string to be made.

up for try fix that and test on windows and make a pullrequest ?

maxandersen commented 2 hours ago

something like path.replace("\\", "\\\\"); should suffice.