[Bug]: ripgrep giving segfault and quietly making searches fail
Is there an existing issue for this?
- [X] I have searched the existing issues
OS/Web Information
- Web Browser: Chrome
- Local OS: macOS
- Remote OS: Ubuntu
- Remote Architecture: x86_64
-
code-server --version: 4.5.0
Steps to Reproduce
- Install
code-serverin the remote machine via conda-forge (mamba install code-server=4.5.0) - attempt to execute the ripgrep binary included in this installation
- Also, after opening code-server and accessing via browser, try to search for a string in all files
Expected
- When executing
rg, the binary executes (i.e. if you just execute/path/to/conda/env/share/code-server/lib/vscode/node_modules/@vscode/ripgrep/bin/rg, you should get an error that no arguments were required - which is expected) - When searching for a string in all files, you should see all matches
Actual
- Get a segfault instead of observing that
rgexecutes. - When searching for a string in all open files, only see matches in open files
Logs
Having trouble finding relevant logs doing this, but I have confirmed that if I install a working version of ripgrep (i.e. via mamba install ripgrep and then replace the segfaulting binary rg inside of share/code-server/lib/vscode/node_modules/@vscode/ripgrep/bin with a symlink to this working version (which I tried based on #5216) then the search functionality works fine. So I'm pretty sure this is the source of the issue. I just don't know WHY that binary gives a segfault.
Screenshot/Video
No response
Does this issue happen in VS Code or GitHub Codespaces?
- [X] I cannot reproduce this in VS Code.
- [X] I cannot reproduce this in GitHub Codespaces.
Are you accessing code-server over HTTPS?
- [X] I am using HTTPS.
Notes
No response
We've definitely had issues before with ripgrep not being installed properly. I'm using code-server on macOS and don't have this same issue so it makes me wonder if the issue is specific to conda-forge - i'm not super familiar with that.
@code-asher any ideas?
I think we would need to look into how exactly this installs code-server. Is there a recipe somewhere? I have no experience with conda.
https://github.com/conda-forge/code-server-feedstock/tree/main/recipe
Thank you for the link!
It appears to download the standalone releases from GitHub so I tried replicating by downloading and running it on an Ubuntu host:
$ wget
https://github.com/cdr/code-server/releases/download/v4.5.0/code-server-4.5.0-linux-amd64.tar.gz
$ tar -xf *.tar.gz
$ ./code-server-4.5.0-linux-amd64/bin/code-server --auth none
Then I opened code-server in a browser and successfully ran a search.
The recipe seems to get rid of the packaged Node. Does it use the Node
installed on the system instead maybe? What does node --version
give you?
It requires (and installs) 16.X. The installed version is 16.14.2.
Ah, I was thinking that since the code-server script Conda
installs invokes plain node then depending on your path or the
last version of Node you installed it could be the wrong version.
But I realized that ripgrep segfaults when you run it directly so the version of Node has nothing to do with this anyway.
The sha256 does not match the release on GitHub so I am not sure what happened to it. There might be another part to the Conda build process I am missing.
9b85e1a11cd624e775ab33e6b7e86fe60844f534be89d04b34a17cebf6ccc611
/home/coder/miniconda3/share/code-server/lib/vscode/node_modules/@vscode/ripgrep/bin/rg
80e049a3e46689b4fdee6b70bb02ee748a6ab88f6f4853753f23ae4aa2a7e958
/home/coder/code-server-4.5.0-linux-amd64/lib/vscode/node_modules/@vscode/ripgrep/bin/rg
Edit: fixed the paths; GitHub mangled them thinking they were email addresses.
I was going to say that checksum mismatches on the binaries are not surprising, since conda builds everything from source. However, that's clearly not what's happening here. Something is very wrong:
[I] Mon, Jul 25, 2022: 21:40:40 fultob01:LOAD@li03c02 ~/local/src/lab_operations main ✔ ./rw
$ sha256sum /sc/arion/work/fultob01/conda/envs/py3.9/bin/rg (py3.9)
ed70a72a11ec57f60ecdf88eed747796cecbd09350f636d9e4ea6c22c0f4ec1d /sc/arion/work/fultob01/conda/envs/py3.9/bin/rg
[I] Mon, Jul 25, 2022: 21:41:33 fultob01:LOAD@li03c02 ~/local/src/lab_operations main ✔ ./rw
$ sha256sum /sc/arion/work/fultob01/conda/envs/py3.9/share/code-server/lib/vscode/node_modules/*vscode/ripgrep/bin/rg (py3.9)
9b85e1a11cd624e775ab33e6b7e86fe60844f534be89d04b34a17cebf6ccc611 /sc/arion/work/fultob01/conda/envs/py3.9/share/code-server/lib/vscode/node_modules/@vscode/ripgrep/bin/rg
[I] Mon, Jul 25, 2022: 21:43:31 fultob01:LOAD@li03c02 ~/local/src/lab_operations main ✔ ./rw
$ /sc/arion/work/fultob01/conda/envs/py3.9/share/code-server/lib/vscode/node_modules/*vscode/ripgrep/bin/rg --version (py3.9)
fish:
[I] Mon, Jul 25, 2022: 21:44:04 fultob01:LOAD@li03c02 ~/local/src/lab_operations main ✔ ./rw
$ /sc/arion/work/fultob01/conda/envs/py3.9/share/code-server/lib/vscode/node_modules/*vscode/ripgrep/bin/rg (py3.9)
fish: