FS#61516 - [code] 1.30.2-1 not able to save a file with sudo (but should)

Attached to Project: Community Packages
Opened by No Name (Jaja) - Thursday, 24 January 2019, 13:14 GMT
Last edited by Filipe Laíns (FFY00) - Wednesday, 16 October 2019, 23:33 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Filipe Laíns (FFY00)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No



When trying to save a file with insufficient permissions, vscode pops up a notification.
You can now "retry with sudo".
However, this does not work.

AUR package 'visual-studio-code-bin' works like expected so its not an upstream issue.

Additional info:
* package version(s)
· code 1.30.2-1
· gnome 3.30
* config and/or log files etc.
· out-of-box behavior

Steps to reproduce:
· [user@machine ~]$ code /etc/fstab
· change a line…
· ^s (save) and click on "retry as sudo"
This task depends upon

Closed by  Filipe Laíns (FFY00)
Wednesday, 16 October 2019, 23:33 GMT
Reason for closing:  Won't fix
Comment by Craig (craigacgomez) - Thursday, 14 February 2019, 09:40 GMT
This is because the "execPath" is being recognised as the electron and is therefore looking for the "code-oss"

sudo[14275]: <user> : a password is required ; TTY=unknown ; PWD=/home/<user> ; USER=root ; COMMAND=/usr/lib/electron/bin/code-oss --file-write /tmp/code-elevated-vtaboo /etc/fuse.conf

The relevant code is in src/vs/platform/environment/node/environmentService.ts

if (isLinux) {
if (isBuilt) {
return path.join(path.dirname(execPath), 'bin', `${product.applicationName}`);

return path.join(appRoot, 'scripts', 'code-cli.sh');

execPath is resolved as /usr/lib/electron, to which "bin" is appended followed by "code-oss" as defined as applicationName in product.json
Comment by Filipe Laíns (FFY00) - Thursday, 14 March 2019, 16:15 GMT
I patched that and I still get the sname behavior. Do you have any other ideas?
Comment by Filipe Laíns (FFY00) - Monday, 25 March 2019, 19:44 GMT
Can I close this? This is something that should be fixed in the upstream.
Comment by No Name (Jaja) - Saturday, 30 March 2019, 17:27 GMT
Close as you like. I don't think this is really an upstream issue, but you have tried hard to solve. Anyway, it's not a show stopper for me. Thank you Filipe!
Comment by Filipe Laíns (FFY00) - Saturday, 06 April 2019, 16:16 GMT
No, it is an upstream issue. We are sane people so we don't distribute a full copy of electron with VS Code, we use the electron already present on your system. This is the exact same reason why we use dynamic libraries instead of statically linking everything. It is on the upstream for not supporting this properly, I already took the appropriate actions to try get them to look into this but they don't seem interested. As always, Microsoft doesn't give an f about the community. I can't do anything other that hope someone looks into this.
Comment by Kipras (sarpik) - Wednesday, 16 October 2019, 23:20 GMT
  • Field changed: Percent Complete (100% → 0%)

upstream is accepting PRs to solve this issue:
see https://github.com/microsoft/vscode/issues/82266,
specifically https://github.com/microsoft/vscode/issues/82266#issuecomment-541701097

I'd be great if this issue was re-opened, allowing additional related discussion.

Also, any feedback to the vscode repo issue mentioned above would be highly appreciated - let's solve this!
Comment by Filipe Laíns (FFY00) - Wednesday, 16 October 2019, 23:32 GMT
This is not new, and doesn't change things. See my comment on the issue. If you have the time to try and fix this then please go ahead, I would love seeing this fixed. But as I said it is not feasible for me to do it. I am going to close this again, please let me know if you have working patch.