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

Installation fails to create symlink when Java GCM is installed #44

Closed
mjcheetham opened this issue May 22, 2019 · 1 comment · Fixed by #45
Closed

Installation fails to create symlink when Java GCM is installed #44

mjcheetham opened this issue May 22, 2019 · 1 comment · Fixed by #45
Assignees
Labels
bug A bug in Git Credential Manager platform:osx Specific to the macOS platform

Comments

@mjcheetham
Copy link
Collaborator

When the Java-based Git Credential Manager for Mac and Linux is installed a git-credential-manager symlink exists in /usr/local/bin. The Mac installer script does nothing if any such file exists. We should probably make some attempt at either warning the user they have the Java GCM installed or otherwise just walk over that symlink (typically the Java GCM is installed via Homebrew which can re-link if needed).

@mjcheetham mjcheetham added the bug A bug in Git Credential Manager label May 22, 2019
@mjcheetham mjcheetham self-assigned this May 22, 2019
@mjcheetham mjcheetham added the platform:osx Specific to the macOS platform label May 22, 2019
@mjcheetham
Copy link
Collaborator Author

These are the offending lines in the script. We should probably replace the 'exists' check with a delete-if-exists and always create a new link.

https://github.com/microsoft/Git-Credential-Manager-Core/blob/0acd9bb962f31bc11860bde304073f4efa425553/src/osx/Installer.Mac/scripts/postinstall#L4-L8

We might also want a preinstall script that checks for Java GCM first and offers to unlink or uninstall Java GCM via brew (or should we just do the unlink and not ask?).

mjcheetham added a commit that referenced this issue May 15, 2023
We are spending about 45ms on macOS to read version information by
shelling out to `sw_vers` on each run of GCM.

Let's try and be smarter and use BCL APIs, system APIs or file-based
sources for the OS and distribution information before resorting to
external processes.

In my testing, on macOS, we went from 45ms to 4.5ms (10x speedup).

Note that we are now also getting something a little bit more useful for
Linux:

Before:
```
$ GCM_TRACE=1 ./git-credential-manager --version
20:55:36.776385 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.1.1.0
20:55:36.787669 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.16
20:55:36.787711 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
20:55:36.787749 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Linux ubuntu2204-vm1 5.15.0-1037-azure #44-Ubuntu SMP Thu Apr 20 13:19:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
..
```

After:
```
$ GCM_TRACE=1 ./git-credential-manager --version
20:52:12.325628 ...re/Application.cs:95 trace: [RunInternalAsync] Version: 2.1.1.0
20:52:12.337234 ...re/Application.cs:96 trace: [RunInternalAsync] Runtime: .NET 6.0.16
20:52:12.337283 ...re/Application.cs:97 trace: [RunInternalAsync] Platform: Linux (x86-64)
20:52:12.337301 ...re/Application.cs:98 trace: [RunInternalAsync] OSVersion: Ubuntu 22.04.1 LTS
..
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in Git Credential Manager platform:osx Specific to the macOS platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant