Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProductUpgrader: be extra careful about a copy loop #1672

Merged
merged 3 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions GVFS/GVFS.Common/ProductUpgrader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,15 @@ public virtual bool TrySetupUpgradeApplicationDirectory(out string upgradeApplic
// directory causes a cycle(at some point we start copying C:\Program Files\GVFS\ProgramData\GVFS.Upgrade
// and its contents into C:\Program Files\GVFS\ProgramData\GVFS.Upgrade\Tools). The exclusion below is
// added to avoid this loop.
HashSet<string> directoriesToExclude = new HashSet<string>();
directoriesToExclude.Add(GVFSPlatform.Instance.GetSecureDataRootForGVFS());
HashSet<string> directoriesToExclude = new HashSet<string>(StringComparer.OrdinalIgnoreCase);

string secureDataRoot = GVFSPlatform.Instance.GetSecureDataRootForGVFS();
directoriesToExclude.Add(secureDataRoot);
directoriesToExclude.Add(upgradeApplicationDirectory);

this.tracer.RelatedInfo($"Copying contents of '{currentPath}' to '{upgradeApplicationDirectory}',"
+ $"excluding '{upgradeApplicationDirectory}' and '{secureDataRoot}'");

this.fileSystem.CopyDirectoryRecursive(currentPath, upgradeApplicationDirectory, directoriesToExclude);
}
catch (UnauthorizedAccessException e)
Expand Down
12 changes: 12 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ will prompt you for upgrade using a notification. To check manually, run
`gvfs upgrade` to see if an upgrade is available. Run `gvfs upgrade --confirm`
to actually perform the upgrade, if you wish.

### Upgrade fails with

**Symptom:** `gvfs upgrade` fails with the following error:

> ERROR: Could not launch upgrade tool. File copy error - The specified path, file name, or both are too long"

**Fix:** There is a known issue with VFS for Git v1.0.20112.1 where the
`gvfs upgrade` command fails with a long-path error. The root cause is a
[recursive directory copy](https://github.com/microsoft/VFSForGit/pull/1672)
that loops the contents of that directory into the copy and it never ends.
The only fix is to [manually upgrade to version v1.0.20154.3](https://github.com/microsoft/VFSForGit/releases/tag/v1.0.20154.3).

Common Issues
-------------

Expand Down