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

Linux Snap: Prevent GDK_PIXBUF env from leaking out #109608

Merged
merged 3 commits into from
Oct 29, 2020
Merged

Conversation

joaomoreno
Copy link
Member

This is a nasty one:

This PR takes the debacle even further by reverting 7d62a5b and making sure every single shell.openExternal call is wrapped with a unset-set env operation,when running as a Linux Snap. This hopefully fixes both the issue with Firefox as well as the issue with the native dialogs.

  • @bpasero: Does the wrapping of shell.openExternal make sense and is it in the right place?
  • @Tyriar: Does the approach generally make sense to you?

I've triggered a build and I have VMs ready to verify whether it works, will let you know asap.

cc @flexiondotorg @sergiusens

@joaomoreno joaomoreno added linux Issues with VS Code on Linux snap Issues related to the snap package labels Oct 28, 2020
@joaomoreno joaomoreno added this to the October 2020 milestone Oct 28, 2020
@joaomoreno joaomoreno self-assigned this Oct 28, 2020
Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

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

Overall this looks OK to me, but ideally we could have this logic inside INativeHostMainService and everyone else depends on this service. I think it should be possible to use it everywhere.

@joaomoreno
Copy link
Member Author

@bpasero I actually started there, but stumbled over that AddFirstParameterToFunctions thing and didn't know if passing undefined would be OK. If everything works well, I'll adapt the PR to do that.

@bpasero
Copy link
Member

bpasero commented Oct 28, 2020

@joaomoreno yeah that is fine, I use it in electron-main too, e.g. here:

const encryptedSerializedProxyCredentials = await this.nativeHostMainService.getPassword(undefined, ProxyAuthHandler2.PROXY_CREDENTIALS_SERVICE_KEY, authInfoHash);

@joaomoreno
Copy link
Member Author

Fix works great 🎆 Tested Ubuntu, Manjaro and CentOS.

Will refactor tomorrow.

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

Approach seems fine, it's a shame we need to jump through these hoops though.

@joaomoreno
Copy link
Member Author

joaomoreno commented Oct 29, 2020

Approach seems fine, it's a shame we need to jump through these hoops though.

Tell me about it. 🤦‍♂️


@deepak1556 Says:

Hey Joao! I was following your work on https://github.com/microsoft/vscode/compare/joao/snap , isn't the core problem related to the incorrect path to gdk-pixbuf-2.0 on these platforms ? for 64 bit we always default to x86_64-linux-gnu https://github.com/microsoft/vscode/blob/master/resources/linux/snap/electron-launch#L8 but the library is under /usr/lib/. Am i understanding the problem incorrectly ?

The actual problem is that Code should always use the gdk-pixbuf inside the snap. But by removing the env very early on (7d62a5b) we hit the situation in which the About dialog reads the wrong env later on and looks up a path which doesn't exist in the snap, so ends up falling back to the OS. In Ubuntu this isn't a problem, but in other Linuxes the path doesn't exist.

7d62a5b must be reverted, but we still need to address spawning other processes (eg Firefox), that's what this PR does.

@joaomoreno joaomoreno merged commit 96d03d1 into master Oct 29, 2020
@joaomoreno joaomoreno deleted the joao/snap branch October 29, 2020 13:13
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
linux Issues with VS Code on Linux snap Issues related to the snap package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snap: User fonts are missing
3 participants