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

sublime3: fix gksu support #63236

Closed
wants to merge 1 commit into from
Closed

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Jun 16, 2019

Motivation for this change

After bumping sublime3 in #61636 we realized that saving files as root
doesn't work anymore and somehow the paths weren't patched by
libredirect.

After some debugging it came out that sublime uses posix_spawnp(3) to
start new processes internally which resulted in a broken execve(2)
syscall that attempted to use /usr/bin/gksudo. Wrapping posix_spawnp
appears to fix the problem.

However it seems the use of pkexec isn't sufficient anymore and
gksudo is required which is why this part has been removed from the
package.

On a side note: it's been decided to remain using libredirect rather
than FHS user environments to ensure that it's still possible to edit
global files like /etc/nixos/configuration.nix.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

After bumping sublime3 in NixOS#61636 we realized that saving files as root
doesn't work anymore and somehow the paths weren't patched by
`libredirect`.

After some debugging it came out that sublime uses `posix_spawnp(3)` to
start new processes internally which resulted in a broken `execve(2)`
syscall that attempted to use `/usr/bin/gksudo`. Wrapping `posix_spawnp`
appears to fix the problem.

However it seems the use of `pkexec` isn't sufficient anymore and
`gksudo` is required which is why this part has been removed from the
package.

On a side note: it's been decided to remain using `libredirect` rather
than FHS user environments to ensure that it's still possible to edit
global files like `/etc/nixos/configuration.nix`.
@Ma27
Copy link
Member Author

Ma27 commented Jun 16, 2019

cc @SebTM for testing.

@jtojnar
Copy link
Contributor

jtojnar commented Jun 16, 2019

I do not really like reintroducing gksu as it is abandoned and relies on GTK 2 and GConf. I would rather remove it from Sublime altogether, since it finally switched to GTK 3.

We should instead find out why did pkexec stop working.

@jtojnar
Copy link
Contributor

jtojnar commented Jun 16, 2019

Can confirm that the libredirect patch alone is sufficient to fix pkexec calls.

@Ma27
Copy link
Member Author

Ma27 commented Jun 17, 2019

Can confirm that the libredirect patch alone is sufficient to fix pkexec calls.

As I have a rather minimalistic desktop environment: is there any extra config needed to get pkexec running properly (/run/wrappers/bin/pkexec exists and works)?

When I try to save I get /usr/bin/pkexec failed(according to strace /run/wrappers/bin/pkexec is used, but $0 in the execve call is /usr/bin/pkexec, so it seems to be a pkexec problem on my machine).

@jtojnar
Copy link
Contributor

jtojnar commented Jun 17, 2019

At minimum, you will need security.polkit.enable = true; and then some polkit agent. Maybe polkit_gnome as documented in Xfce section of the manual.

@jtojnar
Copy link
Contributor

jtojnar commented Jun 18, 2019

Merged as a part of #63447

@jtojnar jtojnar closed this Jun 18, 2019
@Ma27 Ma27 deleted the sublime-gksu-support branch June 18, 2019 22:58
@Ma27
Copy link
Member Author

Ma27 commented Jun 18, 2019

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants