Point GVFS.Service to the correct executable when C:\Program exists #1806
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
An issue was reported to our team where someone was unable to
gvfs clone
a repo. The error message they received wasCould not execute 'C:\Program Files\GVFS\GVFS.Hooks.exe'. CreateProcess error (193)
.After investigation, we discovered that GVFS.Service was stopped and could not be started with the same error. Eventually, we root-caused it to a rogue
C:\Program
file. When this file was deleted, GVFS.Service started up and the repo clone succeeded.To properly resolve paths with spaces in them, quotes must be added. The installer already attempted to do this, but the quotes it added around the
binPath
would get stripped away during argument parsing.Adding another set of quotes properly retains the quotes until it gets to sc.exe.
Without this change, the "path to executable" is not quoted:
![path-to-executable-unquoted](https://private-user-images.githubusercontent.com/2766036/311288318-4e55e042-838b-46bf-865f-775620a542fc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Nzk0MDUsIm5iZiI6MTczOTY3OTEwNSwicGF0aCI6Ii8yNzY2MDM2LzMxMTI4ODMxOC00ZTU1ZTA0Mi04MzhiLTQ2YmYtODY1Zi03NzU2MjBhNTQyZmMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDQxMTQ1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmMxZDYzYTEzODM0YWNlYjYxYmM3NDliM2JjMGU1NDMzMmEzNTViYzBhOTVhOWNmZDMyYzM0ZTA2YzlmZWQyZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.8-Ppdh_El0Am9gDbfH7nWe3AwRtkK7l8NxfzI2sD3Ds)
With this change, the path is now quoted:
![path-to-executable-quoted](https://private-user-images.githubusercontent.com/2766036/311288877-64aa7b79-c82b-41e8-b350-18b3c0bb14b9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Nzk0MDUsIm5iZiI6MTczOTY3OTEwNSwicGF0aCI6Ii8yNzY2MDM2LzMxMTI4ODg3Ny02NGFhN2I3OS1jODJiLTQxZTgtYjM1MC0xOGIzYzBiYjE0YjkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDQxMTQ1WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjFlYmU1ODc5ZWEzZGRiMjliMTdlZTY5YTQ5NzdhZWIxNGY5NzJkZDk3OTVjN2E0ZjI5MjY4ODYwOTEzMjk3NSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.VfHTkm-TIxRw72cv0OiYoU53gSd_WWblrBMEu8DDRRk)
This is consistent with other services that run out of paths with spaces in them, e.g. Logi Options+, Visual Studio Installer Elevation.
Validation
New-Item -Path C:\Program -ItemType File
.