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

In 1.19.4 extension does not work without root privileges #12021

Closed
Hyyy6 opened this issue Feb 26, 2024 · 6 comments · Fixed by #12022
Closed

In 1.19.4 extension does not work without root privileges #12021

Hyyy6 opened this issue Feb 26, 2024 · 6 comments · Fixed by #12022
Assignees
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. quick fix regression A bug that didn't exist in a previous release
Milestone

Comments

@Hyyy6
Copy link

Hyyy6 commented Feb 26, 2024

Environment

  • OS and Version: Ubuntu 22.04.4
  • VS Code Version: 1.86.2
  • C/C++ Extension Version: 1.19.4
  • If using SSH remote, specify OS of remote machine: N\A

Bug Summary and Steps to Reproduce

Bug Summary: Extension doesn't work without launching VS Code with sudo:
-- No pallet commands can be used: command 'C_Cpp.<command_name>' not found.
-- No Go to ... commands in context menu either.
-- Intellisense doesn't work either.

Older version 1.18.5 doesn't have these problems, so rolling back is the only workaround I found so far.

Steps to reproduce:
Install latest 1.19.4 version of C_Cpp VS code extension.

Expected behavior:
All features should work.

Configuration and Logs

No extension commands can run from the pallet.
Extension host logs:
2024-02-26 09:59:44.529 [info] ExtensionService#_doActivateExtension ms-vscode.cpptools, startup: true, activationEvent: 'workspaceContains:/.vscode/c_cpp_properties.json'
2024-02-26 09:59:44.667 [info] ExtensionService#_doActivateExtension ms-vscode.cmake-tools, startup: true, activationEvent: 'workspaceContains:*/CMakeLists.txt,*/*/CMakeLists.txt,*/*/*/CMakeLists.txt'
2024-02-26 09:59:44.698 [error] SystemError: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
	at new SystemError (node:internal/errors:256:5)
	at new NodeError (node:internal/errors:367:7)
	at Object.userInfo (node:os:365:11)
	at SSHConfig.compute (/home/rbabichev/.vscode/extensions/ms-vscode.cpptools-1.19.4-linux-x64/dist/src/main.js:42968:36)
	at /home/rbabichev/.vscode/extensions/ms-vscode.cpptools-1.19.4-linux-x64/dist/src/main.js:60977:45
	at Array.forEach (<anonymous>)
	at extractHostNames (/home/rbabichev/.vscode/extensions/ms-vscode.cpptools-1.19.4-linux-x64/dist/src/main.js:60976:32)
	at getSshConfigHostInfos (/home/rbabichev/.vscode/extensions/ms-vscode.cpptools-1.19.4-linux-x64/dist/src/main.js:60968:23)
	at async initializeSshTargets (/home/rbabichev/.vscode/extensions/ms-vscode.cpptools-1.19.4-linux-x64/dist/src/main.js:59866:16)
	at async Object.initialize (/home/rbabichev/.vscode/extensions/ms-vscode.cpptools-1.19.4-linux-x64/dist/src/main.js:47301:5)
	at async activate (/home/rbabichev/.vscode/extensions/ms-vscode.cpptools-1.19.4-linux-x64/dist/src/main.js:98306:5)
	at async c.n (/snap/code/152/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6256)
	at async c.m (/snap/code/152/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:6219)
	at async c.l (/snap/code/152/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:140:5676)
2024-02-26 09:59:44.954 [info] Eager extensions activated
2024-02-26 09:59:44.963 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2024-02-26 09:59:44.964 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2024-02-26 09:59:47.355 [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2024-02-26 09:59:47.366 [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc'

CMake logs:
[proc] Executing command: cmake --version
[proc] The command: cmake --version failed with error: Error: spawn cmake ENOENT
[proc] Executing command: cmake -E capabilities
[proc] The command: cmake -E capabilities failed with error: Error: spawn cmake ENOENT
[variant] Loaded new set of variants
[kit] Successfully loaded 1 kits from /home/rbabichev/.local/share/CMakeTools/cmake-tools-kits.json

Other Extensions

Problem appears on a clean VS Code install after cleaning all vs code configuration (~/.config/Code). No other extensions are installed.

Additional context

No response

@bobbrow
Copy link
Member

bobbrow commented Feb 26, 2024

This is related to SSHConfig.compute called in sshHosts.ts. I don't think we changed this recently, but @xisui-MSFT do you have any ideas?

@sean-mcmanus sean-mcmanus added bug regression A bug that didn't exist in a previous release labels Feb 26, 2024
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Feb 26, 2024

@bobbrow The regression is from PR #11785, i.e. the upgrade of ssh-config from to "4.2.1" to "4.4.1" in the yarn.lock file.

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Feb 26, 2024

@bobbrow The PR that added the new call to os.userInfo() that is failing is cyjake/ssh-config#68 .

@sean-mcmanus
Copy link
Contributor

@Hyyy6 For some reason, the os.userInfo() call is unable to determine your username/homedir (https://nodejs.org/api/os.html#osuserinfooptions). We have a fix at #12022 .

@xisui-MSFT
Copy link
Contributor

xisui-MSFT commented Feb 26, 2024

Found this microsoft/vscode#204178

@Hyyy6 I wonder if you installed VS Code using snap, as mentioned in that thread?

@Hyyy6
Copy link
Author

Hyyy6 commented Feb 26, 2024

@sean-mcmanus
My user info is not in /etc/passwd, as my environment uses LDAP for authentication. Could this be a problem depending on how os.userinfo() looks for the user?

@xisui-MSFT yes, code was installed via snap.
If try with dpkg .deb the pellet and "Go to ..." commands are listed but don't do anything. The errors in the console are different.
The extension does manage to initialize after a long time and all commands work:

2024-02-26 11:51:53.159 [info] Eager extensions activated
2024-02-26 11:51:53.209 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2024-02-26 11:51:53.210 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2024-02-26 11:51:53.214 [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onStartupFinished'
2024-02-26 11:54:49.730 [warning] TextEditor is closed/disposed <<<=== go to, pellet commands and intellisense available
2024-02-26 11:55:00.028 [warning] TextEditor is closed/disposed

UPD: looks like after building DB at first it works fine on subsequent launches

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. quick fix regression A bug that didn't exist in a previous release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants