Skip to content

Enable mac upgrade MVP#1284

Merged
jamill merged 3 commits into
microsoft:masterfrom
jamill:enable_mac_upgrade
Jun 26, 2019
Merged

Enable mac upgrade MVP#1284
jamill merged 3 commits into
microsoft:masterfrom
jamill:enable_mac_upgrade

Conversation

@jamill
Copy link
Copy Markdown
Member

@jamill jamill commented Jun 19, 2019

Final changes to enable upgrade on Mac MVP. This includes:

  • Run upgrade application inline on platforms that support this
  • Updating flags on Mac platform to indicate it supports upgrade

Copy link
Copy Markdown
Contributor

@derrickstolee derrickstolee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that the only functional change is actually supporting upgrade and changing the messaging around upgrade launching separately or running inline. Feel free to ignore my style nit.

get { return new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "GVFS.Mount", "git", "wish" }; }
}

public override bool SupportsInlineUpgrade { get; } = true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not a fan of this notation. Can we replace the { get; } = true with => true; and still have it work with the override and virtual members?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly - but I updated to use the Expression body definition.

UseShellExecute = true,
UseShellExecute = useShellExecute,
WorkingDirectory = Environment.SystemDirectory,
WindowStyle = ProcessWindowStyle.Normal,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this trying to change window style of the parent process's window, when running inline?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - It does not want to change the parent process's window style... WindowStyle's default value is Normal.

public MacPlatform()
public MacPlatform() : base(
underConstruction: new UnderConstructionFlags(
supportsGVFSUpgrade: true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

}


public override bool SupportsInlineUpgrade { get; } = false;
Copy link
Copy Markdown
Contributor

@alameenshah alameenshah Jun 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few lines in comment would help document what an inline upgrade is.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you (or anyone) has a better term for this, please suggest it :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe SupportsUpgradeWhileRunning that's the best I can come up with. Not sure how accurate that is either?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote for SupportsInlineUpgrade. The context can be made clear with additional comments. Alternate name ideas -SupportsSingleWindowUpgrade?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tweaked the name and added comments to the base abstract property.

@alameenshah
Copy link
Copy Markdown
Contributor

Testing notes

  • On first run as a regular user, gvfs upgrade crashes. But after running sudo gvfs config upgrade.ring fast, the config file gets created (I think?) and there is no problem after that.
$ gvfs upgrade

Unhandled Exception: GVFS.Common.FileBasedCollectionException: Access to the path '/usr/local/vfsforgit/gvfs.config' is denied. ---> System.UnauthorizedAccessException: Access to the path '/usr/local/vfsforgit/gvfs.config' is denied. ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at GVFS.Common.FileBasedCollection.OpenOrCreateDataFile(Boolean retryUntilSuccess) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/FileBasedCollection.cs:line 383
   at GVFS.Common.FileBasedCollection.TryLoadFromDisk[TKey,TValue](TryParseAdd`2 tryParseAdd, TryParseRemove`1 tryParseRemove, Action`2 add, String& error, Action synchronizedAction) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/FileBasedCollection.cs:line 233
   --- End of inner exception stack trace ---
   at GVFS.Common.FileBasedCollection.TryLoadFromDisk[TKey,TValue](TryParseAdd`2 tryParseAdd, TryParseRemove`1 tryParseRemove, Action`2 add, String& error, Action synchronizedAction) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/FileBasedCollection.cs:line 300
   at GVFS.Common.FileBasedDictionary`2.TryCreate(ITracer tracer, String dictionaryPath, PhysicalFileSystem fileSystem, FileBasedDictionary`2& output, String& error, IEqualityComparer`1 keyComparer) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/FileBasedDictionary.cs:line 38
   at GVFS.Common.LocalGVFSConfig.TryLoadSettings(String& error) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/LocalGVFSConfig.cs:line 113
   at GVFS.Common.LocalGVFSConfig.TryPerformAction(Action action, String& error) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/LocalGVFSConfig.cs:line 88
   at GVFS.Common.LocalGVFSConfig.TryGetAllConfig(Dictionary`2& allConfig, String& error) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/LocalGVFSConfig.cs:line 25
   at GVFS.Common.ProductUpgrader.TryCreateUpgrader(ITracer tracer, PhysicalFileSystem fileSystem, LocalGVFSConfig gvfsConfig, ICredentialStore credentialStore, Boolean dryRun, Boolean noVerify, ProductUpgrader& newUpgrader, String& error) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/ProductUpgrader.cs:line 85
   at GVFS.CommandLine.UpgradeVerb.TryInitializeUpgrader(String& error) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS/CommandLine/UpgradeVerb.cs:line 126
   at GVFS.CommandLine.UpgradeVerb.Execute() in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS/CommandLine/UpgradeVerb.cs:line 82
   at GVFS.Program.<>c.<Main>b__0_3(ForNoEnlistment verb) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS/Program.cs:line 80
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at GVFS.Program.Main(String[] args) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS/Program.cs:line 51
Abort trap: 6
$ sudo gvfs config upgrade.ring Fast
Password:
$ gvfs upgrade
Checking for GVFS upgrades...Succeeded
New GVFS version 1.0.19157.1 available in ring Fast.

Upgrade will unmount and remount gvfs repos, ensure you are at a stopping point.
When ready, run `gvfs upgrade --confirm` from an elevated command prompt.
  • sudo gvfs upgrade --confirm failure.
$ sudo gvfs upgrade --confirm
Checking for GVFS upgrades...Succeeded
New GVFS version 1.0.19157.1 available in ring Fast.
Launching upgrade tool...
Downloading...Failed

ERROR: Could not find Git installer in the latest release.

Upgrade logs can be found at: /Users/Ameen/Library/Application Support/GVFS/GVFS.Upgrade/UpgraderLogs with file names that end with the installation ID: 20190619_155931.

Press Enter to exit.


Upgrade completed.

Log file -

[2019-06-19 15:59:31 -04:00] TryRunPreUpgradeChecks (Start)
[2019-06-19 15:59:31 -04:00] Information {"Message":"Successfully finished pre upgrade checks. Okay to run `gvfs upgrade`."}
[2019-06-19 15:59:31 -04:00] TryRunPreUpgradeChecks (Stop) {"DurationMs":86}
[2019-06-19 15:59:31 -04:00] TryCheckIfUpgradeAvailable (Start)
[2019-06-19 15:59:32 -04:00] Information {"Message":"New release found - latest available version: 1.0.19157.1"}
[2019-06-19 15:59:32 -04:00] TryCheckIfUpgradeAvailable (Stop) {"DurationMs":537}
[2019-06-19 15:59:32 -04:00] Installed Version {"installedGVFSVersion":"0.2.173.2","installedGitVersion":"2.22.0.vfs.1.1"}
[2019-06-19 15:59:32 -04:00] TryDownloadUpgrade (Start) {"Upgrade Step":"TryDownloadUpgrade","Version":"1.0.19157.1"}
[2019-06-19 15:59:32 -04:00] Error {"Upgrade Step":"TryDownloadUpgrade","Version":"1.0.19157.1","ErrorMessage":"TryDownloadNewestVersion failed. Could not find Git installer in the latest release."}
[2019-06-19 15:59:32 -04:00] TryDownloadUpgrade (Stop) {"DurationMs":8}

@nickgra
Copy link
Copy Markdown
Member

nickgra commented Jun 19, 2019

Testing notes

  • On first run as a regular user, gvfs upgrade crashes. But after running sudo gvfs config upgrade.ring fast, the config file gets created (I think?) and there is no problem after that.
$ gvfs upgrade

Unhandled Exception: GVFS.Common.FileBasedCollectionException: Access to the path '/usr/local/vfsforgit/gvfs.config' is denied. ---> System.UnauthorizedAccessException: Access to the path '/usr/local/vfsforgit/gvfs.config' is denied. ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at GVFS.Common.FileBasedCollection.OpenOrCreateDataFile(Boolean retryUntilSuccess) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/FileBasedCollection.cs:line 383
   at GVFS.Common.FileBasedCollection.TryLoadFromDisk[TKey,TValue](TryParseAdd`2 tryParseAdd, TryParseRemove`1 tryParseRemove, Action`2 add, String& error, Action synchronizedAction) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/FileBasedCollection.cs:line 233
   --- End of inner exception stack trace ---
   at GVFS.Common.FileBasedCollection.TryLoadFromDisk[TKey,TValue](TryParseAdd`2 tryParseAdd, TryParseRemove`1 tryParseRemove, Action`2 add, String& error, Action synchronizedAction) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/FileBasedCollection.cs:line 300
   at GVFS.Common.FileBasedDictionary`2.TryCreate(ITracer tracer, String dictionaryPath, PhysicalFileSystem fileSystem, FileBasedDictionary`2& output, String& error, IEqualityComparer`1 keyComparer) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/FileBasedDictionary.cs:line 38
   at GVFS.Common.LocalGVFSConfig.TryLoadSettings(String& error) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/LocalGVFSConfig.cs:line 113
   at GVFS.Common.LocalGVFSConfig.TryPerformAction(Action action, String& error) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/LocalGVFSConfig.cs:line 88
   at GVFS.Common.LocalGVFSConfig.TryGetAllConfig(Dictionary`2& allConfig, String& error) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/LocalGVFSConfig.cs:line 25
   at GVFS.Common.ProductUpgrader.TryCreateUpgrader(ITracer tracer, PhysicalFileSystem fileSystem, LocalGVFSConfig gvfsConfig, ICredentialStore credentialStore, Boolean dryRun, Boolean noVerify, ProductUpgrader& newUpgrader, String& error) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS.Common/ProductUpgrader.cs:line 85
   at GVFS.CommandLine.UpgradeVerb.TryInitializeUpgrader(String& error) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS/CommandLine/UpgradeVerb.cs:line 126
   at GVFS.CommandLine.UpgradeVerb.Execute() in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS/CommandLine/UpgradeVerb.cs:line 82
   at GVFS.Program.<>c.<Main>b__0_3(ForNoEnlistment verb) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS/Program.cs:line 80
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at GVFS.Program.Main(String[] args) in /Users/Ameen/Work/Microsoft/GVFS/VFSForGit_Actions/GVFS/GVFS/Program.cs:line 51
Abort trap: 6
$ sudo gvfs config upgrade.ring Fast
Password:
$ gvfs upgrade
Checking for GVFS upgrades...Succeeded
New GVFS version 1.0.19157.1 available in ring Fast.

Upgrade will unmount and remount gvfs repos, ensure you are at a stopping point.
When ready, run `gvfs upgrade --confirm` from an elevated command prompt.
  • sudo gvfs upgrade --confirm failure.
$ sudo gvfs upgrade --confirm
Checking for GVFS upgrades...Succeeded
New GVFS version 1.0.19157.1 available in ring Fast.
Launching upgrade tool...
Downloading...Failed

ERROR: Could not find Git installer in the latest release.

Upgrade logs can be found at: /Users/Ameen/Library/Application Support/GVFS/GVFS.Upgrade/UpgraderLogs with file names that end with the installation ID: 20190619_155931.

Press Enter to exit.


Upgrade completed.

Log file -

[2019-06-19 15:59:31 -04:00] TryRunPreUpgradeChecks (Start)
[2019-06-19 15:59:31 -04:00] Information {"Message":"Successfully finished pre upgrade checks. Okay to run `gvfs upgrade`."}
[2019-06-19 15:59:31 -04:00] TryRunPreUpgradeChecks (Stop) {"DurationMs":86}
[2019-06-19 15:59:31 -04:00] TryCheckIfUpgradeAvailable (Start)
[2019-06-19 15:59:32 -04:00] Information {"Message":"New release found - latest available version: 1.0.19157.1"}
[2019-06-19 15:59:32 -04:00] TryCheckIfUpgradeAvailable (Stop) {"DurationMs":537}
[2019-06-19 15:59:32 -04:00] Installed Version {"installedGVFSVersion":"0.2.173.2","installedGitVersion":"2.22.0.vfs.1.1"}
[2019-06-19 15:59:32 -04:00] TryDownloadUpgrade (Start) {"Upgrade Step":"TryDownloadUpgrade","Version":"1.0.19157.1"}
[2019-06-19 15:59:32 -04:00] Error {"Upgrade Step":"TryDownloadUpgrade","Version":"1.0.19157.1","ErrorMessage":"TryDownloadNewestVersion failed. Could not find Git installer in the latest release."}
[2019-06-19 15:59:32 -04:00] TryDownloadUpgrade (Stop) {"DurationMs":8}

I ran into the first issue when I was helping Jameson test this. It seems like an easy enough mistake to make, should we fix it in a follow up PR?

@jamill
Copy link
Copy Markdown
Member Author

jamill commented Jun 19, 2019

@alameenshah Thank you for trying this! The crash on the initial run as a regular issue is a known issue that I will fix. As you pointed out, it is because the regular user does not have permission to create this file.

For the second issue, it looks (in part) like a configuration issue. But does bring up another question - how should we handle the GitHub upgrader on non-Windows platforms.

@alameenshah
Copy link
Copy Markdown
Contributor

One more testing note. After running sudo gvfs upgrade --confirm successfully, GVFS.Service showed multiple auto-mount failures caused by missing git credentials. As discussed, this is probably because GVFS.Service initiated auto-mount as soon as it got launched by VFSForGitInstaller.pkg::postinstall script, before gvfs upgrader got the chance to run its post installer and restore gcm settings.

[2019-06-19 16:25:33 -04:00] ExecuteMount (Start) {"Version":"0.2.173.2","EnlistmentRoot":"/Users/Ameen/Work/Microsoft/TestRepos/GVFS_5","Remote":"https://mseng.visualstudio.com/AzureDevOps/_git/GVFS","ObjectsEndpoint":"https://mseng.visualstudio.com/AzureDevOps/_git/GVFS","Unattended":false,"IsElevated":false,"NamedPipeName":"/Users/Ameen/Work/Microsoft/TestRepos/GVFS_5/.gvfs/GVFS_NetCorePipe","EnlistmentRootPathParameter":"/Users/Ameen/Work/Microsoft/TestRepos/GVFS_5"}
[2019-06-19 16:25:33 -04:00] AttemptAnonymousAuth (Start)
[2019-06-19 16:25:34 -04:00] NetworkResponse {"RequestId":1,"availableConnections":4,"CacheName":"","StatusCode":401,"connectionWaitTimeMS":"0.0013","responseWaitTimeMS":"893.9655"}
[2019-06-19 16:25:34 -04:00] AttemptAnonymousAuth (Stop) {"HttpStatus":"401","QuerySucceeded":true,"IsAnonymous":false,"DurationMs":1175}
[2019-06-19 16:25:34 -04:00] TryGetCredential (Start)
[2019-06-19 16:25:34 -04:00] Warning {"WarningMessage":"Git could not get credentials: git: 'credential-osxkeychain' is not a git command. See 'git --help'.\nfatal: could not read Username for 'https://mseng.visualstudio.com': terminal prompts disabled\n"}
[2019-06-19 16:25:34 -04:00] TryGetCredential (Stop) {"DurationMs":285}
[2019-06-19 16:25:35 -04:00] RetryConfig_LoadedRetryConfig {"Area":"RetryConfig","Timeout":"00:00:30","MaxRetries":6,"Message":"RetryConfigLoaded"}
[2019-06-19 16:25:36 -04:00] NetworkResponse {"RequestId":2,"availableConnections":4,"CacheName":"","StatusCode":401,"connectionWaitTimeMS":"0.0010","responseWaitTimeMS":"814.9171"}
[2019-06-19 16:25:36 -04:00] NetworkError {"RequestId":2,"AttemptNumber":1,"Operation":"QueryGvfsConfig","WillRetry":false,"Exception":"GVFS.Common.Http.GitObjectsHttpException: Anonymous request was rejected with a 401","ErrorMessage":"Anonymous request was rejected with a 401"}
[2019-06-19 16:25:36 -04:00] Error {"Exception":"GVFS.Common.Http.GitObjectsHttpException: Anonymous request was rejected with a 401","ErrorMessage":"TryQueryGVFSConfig failed"}
[2019-06-19 16:25:36 -04:00] Error {"ErrorMessage":"Unable to query /gvfs/config\nAnonymous request was rejected with a 401"}
[2019-06-19 16:25:36 -04:00] ExecuteMount (Stop) {"DurationMs":3478}

@jamill jamill force-pushed the enable_mac_upgrade branch from 92c624a to 214a173 Compare June 25, 2019 19:28
@jamill jamill merged commit dbcf56c into microsoft:master Jun 26, 2019
@jamill jamill mentioned this pull request Jun 26, 2019
15 tasks
@jrbriggs jrbriggs added this to the M155 milestone Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants