Skip to content

Commit

Permalink
Merge pull request #1673: ProductUpgrader: be extra careful about a c…
Browse files Browse the repository at this point in the history
…opy loop

The `ProductUpgrader` makes a backup of the `C:\Program Files\GVFS` folder before running the install, as a mechanism for backing out a failed upgrade. However, it copies that data into `C:\Program Files\GVFS\ProgramData\GVFS.Upgrade\Tools`, which can create a copy loop! This affected an actual user.

I'm not sure why this affects that one user but not another. In addition to adding more defensive programming (adding the target of the copy to the list of exclusions), I also added some extra tracing so we can see how these strings differ on this machine.

See #1672 for the master PR.
  • Loading branch information
derrickstolee authored Jun 2, 2020
2 parents a05334b + 5119adb commit 1612722
Showing 1 changed file with 9 additions and 2 deletions.
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

0 comments on commit 1612722

Please sign in to comment.