Skip to content

fix(compass): manually set the keychain on linux to try to work around electron automatic keychain detection issues #5958

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
14 changes: 13 additions & 1 deletion packages/compass/src/setup-hadron-distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ if (
process.type === 'browser'
) {
if (process.platform === 'linux') {
const isLibsecretInstalled = () => {
try {
process.dlopen({ exports: {} }, 'libsecret-1.so.0');
return true;
} catch (err: any) {
return err && err.message?.includes('did not self-register');
}
};
Comment on lines +36 to +43
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Totally forgot about this PR, @addaleax does this check looks good to you? The error codes between not installed and failed to open look the same, so I'm checking for the error message here, not sure if there's a better way to do it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I don't think there's a better way right now 😕


// For Linux users with drivers that are avoided by Chromium we disable the
// GPU check to attempt to bypass the disabled WebGL settings.
app.commandLine.appendSwitch('ignore-gpu-blacklist', 'true');
Expand All @@ -47,7 +56,10 @@ if (
*
* @see {@link https://github.com/microsoft/vscode/issues/185212#issuecomment-1593271415}
*/
if (app.commandLine.hasSwitch('password-store') === false) {
if (
app.commandLine.hasSwitch('password-store') === false &&
isLibsecretInstalled()
) {
app.commandLine.appendSwitch('password-store', 'gnome-libsecret');
Copy link
Collaborator

@addaleax addaleax Jun 21, 2024

Choose a reason for hiding this comment

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

Are there any other factors we should be taking into account when setting this default, e.g. specific values of $XDG_CURRENT_DESKTOP or whether the gnome-keyring binary is in PATH/whether a libsecret.so is available on the current system (I think a relatively easy way to check the latter would be to see which error gets thrown by process.dlopen({exports: {}}, 'libsecret-1.so.0'))?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good point! I was thinking about checking that XDG_ var is not in the "supported" list, but it seemed like a mess to maintain. I like the idea of checking for libsecret!

One thing I want to do first is to check what exactly happens when you set this in the environment where it's not supported. If it's not different from not setting it at all I think, just from the perspective of having less logic to maintain, I would prefer not to do any extra checks, but please tell me if this doesn't sound right to you 🙂

}
}
Expand Down
Loading