diff --git a/docs/changelog.md b/docs/changelog.md index 282a707ac..0a7df44ba 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -17,7 +17,8 @@ usually the best available version. As features stabilize some brief notes about them will accumulate here. -#### Not Yet +#### Fixed +* ssh ProxyCommand didn't parse command lines containing `=` correctly. #3307 ### 20230320-124340-559cb7b0 diff --git a/wezterm-ssh/src/config.rs b/wezterm-ssh/src/config.rs index efabd7c02..9b2afd090 100644 --- a/wezterm-ssh/src/config.rs +++ b/wezterm-ssh/src/config.rs @@ -239,8 +239,7 @@ impl ParsedConfigFile { } if let Some(sep) = line - .find('=') - .or_else(|| line.find(|c: char| c.is_whitespace())) + .find(|c: char| c == '=' || c.is_whitespace()) { let (k, v) = line.split_at(sep); let k = k.trim().to_lowercase(); @@ -739,6 +738,54 @@ mod test { use super::*; use k9::snapshot; + #[test] + fn parse_proxy_command() { + let mut config = Config::new(); + config.add_config_string( + r#" + Host foo + ProxyCommand /usr/bin/ssh-proxy-helper -oX=Y host 22 + "#, + ); + + snapshot!( + &config, + r#" +Config { + config_files: [ + ParsedConfigFile { + options: {}, + groups: [ + MatchGroup { + criteria: [ + Host( + [ + Pattern { + negated: false, + pattern: "^foo$", + original: "foo", + is_literal: true, + }, + ], + ), + ], + context: FirstPass, + options: { + "proxycommand": "/usr/bin/ssh-proxy-helper -oX=Y host 22", + }, + }, + ], + loaded_files: [], + }, + ], + options: {}, + tokens: {}, + environment: None, +} +"# + ); + } + #[test] fn parse_user() { let mut config = Config::new();