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

Remote server status check can fail if you have a .curlrc file #3906

Closed
tru opened this issue Oct 27, 2020 · 6 comments
Closed

Remote server status check can fail if you have a .curlrc file #3906

tru opened this issue Oct 27, 2020 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug on-release-notes Issue/pull request mentioned in release notes ssh Issue in vscode-remote SSH verified Verification succeeded
Milestone

Comments

@tru
Copy link

tru commented Oct 27, 2020

  • VSCode Version: 1.50.1
  • Local OS Version: Windows 10
  • Remote OS Version: Clear Linux
  • Remote Extension/Connection Type: SSH

Steps to Reproduce:

  1. Create a .curlrc on remote OS and use --remote-name-all in it since this allows curl to work as wget (i.e writing to file when downloading)
  2. Connect from other host. Status check will fail since it won't echo the output to stdout
  3. Be very confused

Does this issue occur when you try this locally?: Yes
Does this issue occur when you try this locally and all extensions are disabled?: Yes

Curl should be called with -q which ignores the .curlrc to avoid this.

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Oct 27, 2020
@bamurtaugh bamurtaugh added the bug Issue identified by VS Code Team member as probable bug label Nov 4, 2020
@roblourens roblourens added this to the November 2020 milestone Nov 5, 2020
@roblourens roblourens modified the milestones: January 2021, On Deck Jan 28, 2021
@roblourens
Copy link
Member

roblourens commented Oct 12, 2021

For the status check, we need to add --no-remote-name (not for the download)

@tanhakabir tanhakabir assigned tanhakabir and unassigned roblourens Oct 18, 2021
@tanhakabir tanhakabir modified the milestones: On Deck, November 2021 Oct 26, 2021
@roblourens
Copy link
Member

roblourens commented Nov 19, 2021

I have no idea where I got --no-remote-name from... it doesn't seem to exist as an option and is causing problems for me.

  • Set "remote.SSH.remoteServerListenOnSocket": true so it uses curl instead of wget
  • Connect to a remote
  • Connect a second time (so it's connecting to a server that is already running)

Get an error message that the flag can't be used.

I'm a little nervous about using -q because there might be some other necessary flag in the config file, like for a proxy, but since we are connecting to a local address that probably won't matter, so using -q like originally suggested might be a better fix. I can't find another way to override --remote-name and force curl to use stdout

@roblourens roblourens reopened this Nov 19, 2021
@tanhakabir
Copy link

When I try with -q and useLocalServer: true I see:

[13:37:53.993] Server status check failed - waiting and retrying

@tanhakabir tanhakabir modified the milestones: February 2022, March 2022 Feb 18, 2022
@tanhakabir tanhakabir modified the milestones: March 2022, April 2022 Mar 23, 2022
@tanhakabir tanhakabir modified the milestones: April 2022, May 2022 Apr 27, 2022
@tanhakabir tanhakabir modified the milestones: May 2022, June 2022 Jun 1, 2022
@tanhakabir tanhakabir removed this from the June 2022 milestone Jun 29, 2022
@tanhakabir tanhakabir modified the milestones: July 2022, June 2022 Jun 29, 2022
@tanhakabir tanhakabir modified the milestones: July 2022, August 2022 Jul 25, 2022
@tanhakabir tanhakabir assigned roblourens and unassigned tanhakabir Sep 2, 2022
@roblourens roblourens removed their assignment Sep 29, 2022
@rebornix rebornix modified the milestones: October 2022, November 2022 Oct 25, 2022
@eleanorjboyd eleanorjboyd modified the milestones: November 2022, On Deck Nov 29, 2022
@eleanorjboyd
Copy link
Member

Hello! My name is Eleanor the new maintainer for Remote-SSH. After reviewing this issue it seems the fix decided is to add the -q tag to the .curlrc command. I will review this suggestion to make sure -q as described by the curl man pages does what we expect and that this will not be a breaking change to different setups for users. Thanks

@joshspicer
Copy link
Member

Tomorrow's pre-release build of the extension will start to ignore curlrc and wgetrc files by default, ensuring that this extension can run in isolation of a user's configuration.

Additionally, I've added the remote.SSH.useCurlAndWgetConfigurationFiles setting which one can enable to continue honoring these configuration files. I don't believe there will be many reasons to do so - please let me know if you find a need to enable this setting!

@joshspicer joshspicer modified the milestones: On Deck, July 2024 Jul 22, 2024
@joshspicer
Copy link
Member

Validation steps

Setup/Cleanup (repeat for each section below)

  1. Use insiders
  2. Set up a remote machine that is either linux or Mac-based (SSH'ing to your Mac over localhost is fine too)
  3. Delete ~/.vscode-server-insiders/ on the remote to ensure the server/CLI aren't cached
  4. Run > Remote-SSH: Kill VS Code Server on Host against your remote machine to ensure a clean slate
  5. Add some setting to both curlrc and wgetrc that will clearly fail (I set non-existant proxies, see below)
    • Image

(A) Test with defaults

  1. Follow Setup/Cleanup
  2. Ensure that remote.SSH.useCurlAndWgetConfigurationFiles is set to false (Default value)
  3. Attempt to connect to the remote machine with the extension
  4. Confirm in the Remote-SSH output logs that wget was used successfully:
...
[13:53:41.084] > Downloading with wget
[13:53:43.750] > Download complete
...

(B) Test with curl

wget is preferred if available on your local machine, this sequence of steps "removes" wget so that the curl codepath is exercised.

  1. Follow Setup/Cleanup
  2. Ensure that remote.SSH.useCurlAndWgetConfigurationFiles is still set to false (Default value)
  3. Change the name of the wget binary on your remote's $PATH so that the curl codepath is used:
    eg:
[~]$ which wget
/opt/homebrew/bin/wget
[~]$ mv /opt/homebrew/bin/wget /opt/homebrew/bin/wget-DISABLED
  1. Confirm in the Remote-SSH output logs that wget was used successfully:
...
[13:58:31.011] > Downloading with curl
[13:58:31.018] stderr>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[13:58:31.018] stderr>                                  Dload  Upload   Total   Spent    Left  Speed
[13:58:31.018] stderr> 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[13:58:31.187] stderr> 
100   162  100   162    0     0    965      0 --:--:-- --:--:-- --:--:--   970
[13:58:31.757] stderr> 
 87 5835k   87 5088k    0     0  6895k      0 --:--:-- --:--:-- --:--:-- 6895k
[13:58:31.852] stderr> 
100 5835k  100 5835k    0     
[13:58:31.853] stderr> 0  7006k      0 --:--:-- --:--:-- --:--:-- 7871k
[13:58:31.858] > Download complete
...

(C) Test with fallback setting enabled

  1. Follow Setup/Cleanup
  2. Ensure that remote.SSH.useCurlAndWgetConfigurationFiles is set to TRUE
  3. Attempt to connect to the remote machine with the extension
  4. Note that wget will fail. (This is expected since it's honoring the remote's wgetrc, but will fallback to scp'ing from the local host.)
[14:02:32.253] Copying file to remote with scp -o ConnectTimeout=15 'vscode-cli-22e3447b4b410dcf8426bf70743c5dd4030d6122.tar.gz' 'vscode-cli-22e3447b4b410dcf8426bf70743c5dd4030d6122.tar.gz.done' localhost:'/Users/joshspicer/.vscode-server-insiders'
[14:02:32.254] Using cwd: file:///var/folders/rn/8hrxbc556pq_020kvg5hm8qh0000gn/T/vscode_server_1721854952225
[14:02:32.577] "Copy server to host" terminal received data: "
(joshspicer@localhost) Password:"
[14:02:32.577] Showing password prompt
[14:02:34.854] >  
[14:02:36.549] Got password response
[14:02:36.549] "Copy server to host" wrote data to terminal: "******************"
[14:02:36.565] "Copy server to host" terminal received data: ""
[14:02:36.800] "Copy server to host" terminal received data: "
vscode-cli-22e3447b4b410dcf8426bf70743c5dd403   0%    0     0.0KB/s   --:-- ETA"
[14:02:36.828] "Copy server to host" terminal received data: "
vscode-cli-22e3447b4b410dcf8426bf70743c5dd403 100% 5836KB 197.2MB/s   00:00    

vscode-cli-22e3447b4b410dcf8426bf70743c5dd403   0%    0     0.0KB/s   --:-- ETA
vscode-cli-22e3447b4b410dcf8426bf70743c5dd403 100%    9    52.6KB/s   00:00    "
[14:02:37.075] "Copy server to host" terminal command done

Notes

  • It should not be possible to totally break connection to the remote unless scp is not installed.

@connor4312 connor4312 added the verified Verification succeeded label Jul 24, 2024
@joshspicer joshspicer added the on-release-notes Issue/pull request mentioned in release notes label Jul 26, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Sep 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug on-release-notes Issue/pull request mentioned in release notes ssh Issue in vscode-remote SSH verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

8 participants