From 773a507b01a10f3d24d08c6df86e98605bd9f887 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 13 Oct 2023 19:04:07 +0200 Subject: [PATCH] fish.rs: fix regression in fish_xdm_login_hack_hack_hack_hack This is off by one from the C++ version. It wasn't super obvious why this worked in the first place. Looks like args[0] is "-" because we are invoked like fish -c 'exec "${@}"' - "${@}" and it looks like "-" is treated like "--" by bash, so we emulate that. See https://github.com/fish-shell/fish-shell/issues/367#issuecomment-11740812 --- fish-rust/src/fish.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fish-rust/src/fish.rs b/fish-rust/src/fish.rs index b3637f620..5c9c70dc1 100644 --- a/fish-rust/src/fish.rs +++ b/fish-rust/src/fish.rs @@ -856,7 +856,7 @@ fn fish_xdm_login_hack_hack_hack_hack(cmds: &mut Vec, args: &[&wstr]) // We're going to construct a new command that starts with exec, and then has the // remaining arguments escaped. let mut new_cmd = OsString::from("exec"); - for arg in args { + for arg in &args[1..] { new_cmd.push(" "); new_cmd.push(escape_single_quoted_hack_hack_hack_hack(arg)); }