Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: handle paths with spaces in Match exec clause of SSH config#18266

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
spikecurtis merged 5 commits intomainfromspike/18199-path-with-spaces
Jun 6, 2025

Conversation

spikecurtis
Copy link
Contributor

fixes#18199

Corrects handling of paths with spaces in theMatch !exec clause we use to determine whether Coder Connect is running. This is handled differently than the ProxyCommand, so we have a different escape routine, which also varies by OS.

On Windows, we resort to a pretty gnarly hack, but it does work and I feel the only other option would be to reduce functionality such that we could not detect the Coder Connect state.

@spikecurtisspikecurtisforce-pushed thespike/18199-path-with-spaces branch from6f0ac31 tocaee378CompareJune 6, 2025 10:35
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the research and docs here. Although this is indisputably gnarly, I much prefer it to the alternative of reducing functionality. Kudos on finding this hack 👍🏻

Please note QQ in inline comment, but other than that, approved!

// Constructing the string and then passing it to another instance of cmd.exe does this trick here.
// - OpenSSH passes the `Match exec` command to cmd.exe regardless of whether the user has a unix-like shell like
// git bash, so we don't have a `forceUnixPath` option like for the ProxyCommand which does respect the user's
// configured shell on Windows.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the great write-up! ❤️

QQ: Is there a chance the "default shell" that OpenSSH uses can be configured to be powershell instead of cmd.exe? And if yes, would the for loop break?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.


ifstrings.ContainsAny(path," ") {
// c.f. function comment for how this works.
path=fmt.Sprintf("for /f %%%%a in ('powershell.exe -Command [char]34') do @cmd.exe /c %%%%a%s%%%%a",path)//nolint:gocritic // We don't want %q here.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

💫😵💫 %%%%%%%%%%%%%%%%%%%%%%%% 💫😵💫

@spikecurtisspikecurtis merged commitd47a53d intomainJun 6, 2025
34 checks passed
@spikecurtisspikecurtis deleted the spike/18199-path-with-spaces branchJune 6, 2025 12:44
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJun 6, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@EmyrkEmyrkAwaiting requested review from Emyrk

Assignees

@spikecurtisspikecurtis

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

bug: config-ssh writes bad Match exec clause on Windows
2 participants
@spikecurtis@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp