renovatebot/renovate

Nuget command escaping problem on Windows

Opened this issue · 1 comments

Describe the proposed change(s).

Reproducible only on Windows, potentially only on certain environments.

Ref: #31753

Per the logs this command is run:

C:\Windows\system32\cmd.exe /d /s /c "dotnet restore webapplication/WebApplication1/WebApplication1/WebApplication1.csproj --force-evaluate --configfile 'C:/Users/MARCO~1.VAN/AppData/Local/Temp/renovate/cache/__renovate-private-cache/nuget/nuget.config'"

Per @mratwork-dev, the command he could get to work manually is this:

C:\Windows\system32\cmd.exe /d /s /c ^"dotnet restore webapplication/WebApplication1/WebApplication1/WebApplication1.csproj --force-evaluate --configfile "C:/Users/MARCO~1.VAN/AppData/Local/Temp/renovate/cache/__renovate-private-cache/nuget/nuget.config" ^"

Note the differences:

  • The command is wrapped in ^" at start and end
  • Inside the command, the filename is double quoted and not single quoted

Commands are generated from

const cmds = [
...dependentPackageFileNames.map(
(fileName) =>
`dotnet restore ${quote(
fileName,
)} --force-evaluate --configfile ${quote(nugetConfigFile)}`,
),
];

Some of this escaping seems to be done by Node.js itself, so I'm not sure how easy this is to fix - will require a community contribution from someone determined to fix this on Windows. Until then: use Renovate's docker images.

this isn't easy to resolve. we use shlex to quote and pass it to node child process. so we don't do that cmd stuff directly