microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.47k stars 28.1k forks source link

Hyperlinks don't open on Arch Linux running KDE Plasma 5 #92902

Open nohupped opened 4 years ago

nohupped commented 4 years ago

Hello, I found an existing issue https://github.com/Microsoft/vscode/issues/50139 but it is marked as closed, hence creating a new issue.

- OS Version:

Operating System: Arch Linux KDE Plasma Version: 5.18.3 KDE Frameworks Version: 5.68.0 Qt Version: 5.14.1 Kernel Version: 5.5.9-arch1-2 OS Type: 64-bit Processors: 12 × Intel® Core™ i7-8750H CPU @ 2.20GHz Memory: 7.6 GiB of RAM


Steps to Reproduce:

1. On an arch linux running KDE Plasma 5, open vscode or vscode Insider Edition (with or without extensions disabled)
2. Open any file that has a hyperlink
3. Ctrl + Click to follow the link
4. Nothing happens.

Does this issue occur when all extensions are disabled?: Yes
Does this issue occur in the Insider Edition? Yes

I expected the hyperlink to open in a browser. 

Upon checking the process list, there is a processes associated with every Ctrl+Click (Because I clicked on the hyper link multiple times) and the PID changes because it crashes and the process re-spawns.

```bash
USER      59258  0.0  0.0   7840  3948 ?        S    11:50   0:00 /bin/sh /usr/bin/xdg-open https://bing.com/
USER      59260  0.0  0.4 286740 39696 ?        Rl   11:50   0:00 kde-open5 https://bing.com/
USER      59262  0.0  0.0   7840  3824 ?        S    11:50   0:00 /bin/sh /usr/bin/xdg-open https://bing.com/
USER      59263  0.0  0.0   7840  3904 ?        S    11:50   0:00 /bin/sh /usr/bin/xdg-open https://bing.com/
USER      59266  0.0  0.4 276048 38072 ?        Rl   11:50   0:00 kde-open5 https://bing.com/
USER      59267  0.0  0.0   7840  3672 ?        S    11:50   0:00 /bin/sh /usr/bin/xdg-open https://bing.com/
USER      59268  0.0  0.4 286740 39712 ?        Rl   11:50   0:00 kde-open5 https://bing.com/
USER      59269  0.0  0.4 286744 39752 ?        Rl   11:50   0:00 kde-open5 https://bing.com/
USER      59278  0.0  0.0   7840  3804 ?        S    11:50   0:00 /bin/sh /usr/bin/xdg-open https://bing.com/
USER      59281  0.0  0.3 201740 30188 ?        Rl   11:50   0:00 kde-open5 https://bing.com/
USER      59284  0.0  0.0   7840  3716 ?        S    11:50   0:00 /bin/sh /usr/bin/xdg-open https://bing.com/
USER      59285  0.0  0.3 176616 26216 ?        Sl   11:50   0:00 kde-open5 https://bing.com/

I managed to get the strace of the process if that is going to be of any help.


Process:
USER      30106  0.0  0.0   7840  3836 ?        S    12:25   0:00 /bin/sh /usr/bin/xdg-open https://bing.com/

strace: Process 30106 attached
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 30108
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f8b0ee30d70}, {sa_handler=0x559881b46ef0, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f8b0ee30d70}, 8) = 0
ioctl(2, TIOCGWINSZ, 0x7ffcb8e05300)    = -1 ENOTTY (Inappropriate ioctl for device)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30108, si_uid=1000, si_status=0, si_utime=5, si_stime=1} ---
wait4(-1, 0x7ffcb8e04b90, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn({mask=[]})                 = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

Not sure if it is related and would be of any help but journalctl also started showing the following error after the above process keeps crashing.

Mar 18 13:20:46 localghost kwin_x11[1758]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 26572, resource id: 125829125, major code: 18 (ChangeProperty), minor code: 0
Mar 18 13:20:46 localghost kwin_x11[1758]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 26597, resource id: 125829125, major code: 18 (ChangeProperty), minor code: 0
Mar 18 13:20:46 localghost kwin_x11[1758]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 26635, resource id: 125829125, major code: 18 (ChangeProperty), minor code: 0
Mar 18 13:20:46 localghost kwin_x11[1758]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 26643, resource id: 125829125, major code: 18 (ChangeProperty), minor code: 0
Mar 18 13:20:46 localghost kwin_x11[1758]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 26651, resource id: 125829125, major code: 18 (ChangeProperty), minor code: 0
Mar 18 13:20:46 localghost kwin_x11[1758]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 26659, resource id: 125829125, major code: 18 (ChangeProperty), minor code: 0

My default association for url opening is Chrome, and opening the same url from terminal using /bin/sh /usr/bin/xdg-open https://bing.com works.

Apologies if this issue doesn't belong here. I am not sure if this needs to be raised with vscode or KDE. Thank you.

deepak1556 commented 4 years ago

Thanks for the detailed report! Couple of things to try

nohupped commented 4 years ago

Thank you for looking into this. Please find the information below.

  • What is the output of chrome://sandbox/ in your chrome browser ?
Sandbox Status
Layer 1 Sandbox Namespace
PID namespaces  Yes
Network namespaces  Yes
Seccomp-BPF sandbox Yes
Seccomp-BPF sandbox supports TSYNC  Yes
Ptrace Protection with Yama LSM (Broker)    Yes
Ptrace Protection with Yama LSM (Non-broker)    No
You are adequately sandboxed.
  • Can you run vscode with --verbose flag and attach the output when you click the link with chrome as default browser

Clicked twice on the URL after starting vscode in verbose mode.

❯ code --verbose --disable-extensions                                                                                                    ✔  6090  07:55:58
Gtk-Message: 07:56:05.621: Failed to load module "canberra-gtk-module"
[main 2020-03-19T23:56:05.800Z] Starting VS Code
[main 2020-03-19T23:56:05.801Z] from: /var/lib/snapd/snap/code/27/usr/share/code/resources/app
[main 2020-03-19T23:56:05.801Z] args: {
  _: [],
  diff: false,
  add: false,
  goto: false,
  'new-window': false,
  'reuse-window': false,
  wait: false,
  version: false,
  help: false,
  telemetry: false,
  'list-extensions': false,
  'show-versions': false,
  verbose: true,
  status: false,
  'prof-startup': false,
  'disable-extensions': true,
  'disable-gpu': false,
  'extension-development-confirm-save': false,
  logExtensionHostCommunication: false,
  'skip-getting-started': false,
  'skip-release-notes': false,
  'sticky-quickopen': false,
  'disable-restore-windows': false,
  'disable-telemetry': false,
  'disable-updates': false,
  'disable-crash-reporter': false,
  'disable-user-env-probe': false,
  'skip-add-to-recently-opened': false,
  'unity-launch': false,
  'open-url': false,
  'file-write': false,
  'file-chmod': false,
  'driver-verbose': false,
  force: false,
  trace: false,
  'force-user-env': false,
  'no-proxy-server': false,
  nolazy: false,
  'force-renderer-accessibility': false,
  'ignore-certificate-error': false,
  'allow-insecure-localhost': false
}
===========snipped until Ctrl+Click the url===========
[17977:0320/075642.903545:INFO:CONSOLE(1647)] "%cTRACE color: #888 [text file model] load() - enter file:///home/nohup/tmp.txt", source: file:///var/lib/snapd/snap/code/27/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js (1647)
[17977:0320/075646.490460:INFO:CONSOLE(1647)] "%cTRACE color: #888 [storage state.vscdb] updateItems(): insert(Map(1) {memento/workbench.editors.files.textFileEditor => {"textEditorViewState":[["vscode-userdata:/home/nohup/.config/Code/User/settings.json",{"0":{"cursorState":[{"inSelectionMode":true,"selectionStart":{"lineNumber":52,"column":17},"position":{"lineNumber":52,"column":20}}],"viewState":{"scrollLeft":0,"firstPosition":{"lineNumber":30,"column":1},"firstPositionDeltaTop":-12},"contributionsState":{"editor.contrib.folding":{"lineCount":134,"provider":"syntax"},"editor.contrib.wordHighlighter":false}}}],["file:///home/nohup/tmp.txt",{"0":{"cursorState":[{"inSelectionMode":false,"selectionStart":{"lineNumber":1,"column":9},"position":{"lineNumber":1,"column":9}}],"viewState":{"scrollLeft":0,"firstPosition":{"lineNumber":1,"column":1},"firstPositionDeltaTop":0},"contributionsState":{"editor.contrib.folding":{"lineCount":1,"provider":"indent"},"editor.contrib.wordHighlighter":true}}}]]}}), delete(Set(0) {})", source: file:///var/lib/snapd/snap/code/27/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js (1647)
[17977:0320/075646.490913:INFO:CONSOLE(1647)] "%cTRACE color: #888 [storage state.vscdb] Trace (event): BEGIN TRANSACTION", source: file:///var/lib/snapd/snap/code/27/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js (1647)
[17977:0320/075646.491106:INFO:CONSOLE(1647)] "%cTRACE color: #888 [storage state.vscdb] Trace (event): INSERT INTO ItemTable VALUES ('memento/workbench.editors.files.textFileEditor','{"textEditorViewState":[["vscode-userdata:/home/nohup/.config/Code/User/settings.json",{"0":{"cursorState":[{"inSelectionMode":true,"selectionStart":{"lineNumber":52,"column":17},"position":{"lineNumber":52,"column":20}}],"viewState":{"scrollLeft":0,"firstPosition":{"lineNumber":30,"column":1},"firstPositionDeltaTop":-12},"contributionsState":{"editor.contrib.folding":{"lineCount":134,"provider":"syntax"},"editor.contrib.wordHighlighter":false}}}],["file:///home/nohup/tmp.txt",{"0":{"cursorState":[{"inSelectionMode":false,"selectionStart":{"lineNumber":1,"column":9},"position":{"lineNumber":1,"column":9}}],"viewState":{"scrollLeft":0,"firstPosition":{"lineNumber":1,"column":1},"firstPositionDeltaTop":0},"contributionsState":{"editor.contrib.folding":{"lineCount":1,"provider":"indent"},"editor.contrib.wordHighlighter":true}}}]]}')", source: file:///var/lib/snapd/snap/code/27/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js (1647)
[17977:0320/075646.491255:INFO:CONSOLE(1647)] "%cTRACE color: #888 [storage state.vscdb] Trace (event): END TRANSACTION", source: file:///var/lib/snapd/snap/code/27/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js (1647)
===========End of snippet===========
  • Does this work if you use firefox as default browser ?

No, it doesn't work with Firefox as the default browser either.

The above steps worked. The output inside the electron fiddle terminal was

Saving files to temp directory...

Saved files to /tmp/tmp-467856Ft8CUf9uClYx

Electron v8.1.1 started.

(electron) The default value of app.allowRendererProcessReuse is deprecated, it is currently "false".  It will change to be "true" in Electron 9.  For more information please check https://github.com/electron/electron/issues/18397

Opening in existing browser session.

the output in the new electron window was

Hello World!
We are using Node.js 12.13.0, Chromium 80.0.3987.141, and Electron 8.1.1.

and bing opened in a new chrome tab.

Thank you.

deepak1556 commented 4 years ago

Thanks for the update!

1) I mainly wanted to verify if chrome was using setuid sandbox on the system since there is a know issue with electron. But its using namespace sandbox so thats not the issue here.

4) I missed mentioning this, can you try the example on fiddle with electron 7.1.11 ?

Also just to clarify do you see this issue with clicking links from any file like markdown, release notes or just from extension pages ?

nohupped commented 4 years ago

Thank you again. To answer your question,

  1. I missed mentioning this, can you try the example on fiddle with electron 7.1.11 ?

I tried this and it is working. The output from within the fiddle console (with an error and a warning) was

Saving files to temp directory...

Saved files to /tmp/tmp-4527wx7gIyCICLr4

Electron v7.1.11 started.

[253336:0321/135529.940337:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command

Opening in existing browser session.

(electron:253284): IBUS-WARNING **: 13:55:30.779: Unable to connect to ibus: Could not connect: Connection refused

A new electron window was opened with the following content

Hello World!
We are using Node.js 12.8.1, Chromium 78.0.3904.130, and Electron 7.1.11.

and bing was opened in a new tab in chrome.

Also just to clarify do you see this issue with clicking links from any file like markdown, release notes or just from extension pages ?

Yes, I see it from every type of files that I've checked(markdown, text files, release notes and programming language specific files where hyperlinks are in comments are the ones I tried.)

I don't know if it is worth mentioning, but if it helps, I noticed that after the ctrl+click, the kde-open5 to open https://bing.com/ is the child process of xdg-open which makes sense, but xdg-open has a ppid of 1 (systemd). I was expecting its parent to be vscode's pid instead of systemd's pid.

UID          PID    PPID    PGID     SID  C STIME TTY          TIME CMD
nohup      26401       1   26400   26400  0 13:19 ?        00:00:00 /bin/sh /usr/bin/xdg-open https://bing.com/
nohup      26402   26401   26400   26400  0 13:19 ?        00:00:00 kde-open5 https://bing.com/
deepak1556 commented 4 years ago

Thanks for the info, helps!

but xdg-open has a ppid of 1 (systemd). I was expecting its parent to be vscode's pid instead of systemd's pid.

What is the pid of xdg-open in the case of using electron fiddle ?

nohupped commented 4 years ago

Thank you again. To answer your question,

What is the pid of xdg-open in the case of using electron fiddle ?

UID          PID    PPID    PGID     SID  C STIME TTY          TIME CMD
nohup      24095   23942   23015    2053  0 04:54 pts/1    00:00:00 /home/nohup/.config/Electron Fiddle/electron-bin/7.1.11/electron --type=renderer --field-trial-handle=11377938143948159513,14737777447393864844,131072 --disable-features=SpareRendererForSitePerProcess --lang=en-US --app-path=/tmp/tmp-23234AEXM1qaatsYw --node-integration --no-sandbox --no-zygote --background-color=#fff --num-raster-threads=4 --enable-main-frame-before-activation --service-request-channel-token=8500472037737174375 --renderer-client-id=5 --no-v8-untrusted-code-mitigations --shared-files=v8_context_snapshot_data:100,v8_natives_data:101
nohup      24143   24095   23015    2053  0 04:54 pts/1    00:00:00 /bin/sh /usr/bin/xdg-open https://bing.com/
nohup      24147   24143   23015    2053  0 04:54 pts/1    00:00:00 kde-open5 https://bing.com/

When using fiddle, the ppid of kde-open5 is that of xdg-open and the ppid of xdg-open is that of Electron (the fiddle application).

nohupped commented 4 years ago

A quick update. I checked if this is existing in the normal package installation and found that this issue exists only with the snap installation of vscode. When I installed it via pacman, the links are working as expected. My snapd configuration is default. Is there something that I need to do to fix this problem? Please advise if I should change the title of this issue, or should I be raising a new issue to address this.

Thank you.

AurevoirXavier commented 3 years ago

Same output of --verbose.

But I get this with require('electron').shell.openExternal('https://google.com')

Uncaught Error: Check dependency list! Synchronous require cannot resolve module 'electron'. This is the first mention of this module!

I'm also on snap-built version.

JeremyCaron commented 3 years ago

I'm on Manjaro and seeing the same thing with the snap version. Please help! :)

Onihani commented 1 year ago

use the version from the official arch linux repo https://aur.archlinux.org/visual-studio-code-bin.git