From 777b82c9525037994ca500d49c2ac3d55ea13012 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 09:23:10 +0000 Subject: [PATCH 1/3] Start fix for gem remedy tests on Windows Refs #2276. Assisted-by: Claude Code:claude-fable-5-2 From 3034869adec6ccdec2954a3b43774c464da1f5a7 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 09:28:38 +0000 Subject: [PATCH 2/3] Quote paths in gem remedy test expectations Two gem_refresh unit tests built the expected `rm -rf ... && bundle install` command from Path::display(), but the code renders each path of that command through shell_word, which single-quotes a path holding a character outside its safe set. A Windows temp path holds a backslash, so both tests failed on the Windows nightly. A temp dir with a space in its path fails them the same way on Linux. Build the expected commands with shell_word. The warning detail lists the paths unquoted, so its assertions stay as they are. Fixes #2276. Assisted-by: Claude Code:claude-fable-5-2 --- crates/socket-patch-cli/src/commands/gem_refresh.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/socket-patch-cli/src/commands/gem_refresh.rs b/crates/socket-patch-cli/src/commands/gem_refresh.rs index f23b3f4d8..756998a67 100644 --- a/crates/socket-patch-cli/src/commands/gem_refresh.rs +++ b/crates/socket-patch-cli/src/commands/gem_refresh.rs @@ -2393,11 +2393,13 @@ mod tests { x86_64-linux/3.3.0/json-1.0.0, but the installed extension is /p/ruby/\ 3.2.0/extensions/x86_64-linux/3.2.0/json-1.0.0 (another Ruby's))"; let policy = policy(tmp.path(), true, false, false); + // The command quotes a path as `shell_word` does (a Windows path + // holds `\`); the warning's detail below lists the paths as they are. let command = format!( "`rm -rf {} {} {} && bundle install`", - dir.display(), - spec.display(), - cache.display() + shell_word(&dir), + shell_word(&spec), + shell_word(&cache) ); let pass = failed_for(&gem, reason); @@ -2473,7 +2475,7 @@ mod tests { assert!( bullet.contains(&format!( "racc 1.0.0. Run `rm -rf {} && bundle install`", - dir.display() + shell_word(&dir) )), "{bullet}" ); From ebf0df9666a56f560eeadd2f5a53047e41855077 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 09:36:22 +0000 Subject: [PATCH 3/3] Build gem remedy test paths as the code does a_copy_no_ruby_owns_is_removed_with_its_gem_dir joined `specifications/json-1.0.0.gemspec` onto the gem home as one component. The code joins the directory and the file name apart, so on Windows the test's path kept a `/` where the remedy has a `\\`, and the expected command and detail would still not match there. the_rm_remedy_quotes_a_path_the_shell_would_split wrapped display() in literal quotes, which breaks under a temp dir with a `'` in its path. It now uses shell_word too. Refs #2276. Assisted-by: Claude Code:claude-fable-5-2 --- crates/socket-patch-cli/src/commands/gem_refresh.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/socket-patch-cli/src/commands/gem_refresh.rs b/crates/socket-patch-cli/src/commands/gem_refresh.rs index 756998a67..c38d3baad 100644 --- a/crates/socket-patch-cli/src/commands/gem_refresh.rs +++ b/crates/socket-patch-cli/src/commands/gem_refresh.rs @@ -1986,9 +1986,9 @@ mod tests { let tmp = tempfile::tempdir().unwrap(); let (proj, home) = (tmp.path().join("proj"), tmp.path().join("Jane Doe/gemhome")); std::fs::create_dir_all(&proj).unwrap(); - let file = |dir: &str, name: &str| home.join(dir).join(name).display().to_string(); + let file = |dir: &str, name: &str| shell_word(&home.join(dir).join(name)); let expected = format!( - "run `rm -f '{}' '{}' && bundle install`", + "run `rm -f {} {} && bundle install`", file("specifications", "rack-1.0.0.gemspec"), file("cache", "rack-1.0.0.gem") ); @@ -2384,8 +2384,10 @@ mod tests { let home = tmp.path().join("vendor/bundle/ruby/3.2.0"); let gem = installed("json", &home, true); let (dir, _) = gem.installed.clone().unwrap(); - let spec = home.join("specifications/json-1.0.0.gemspec"); - let cache = home.join("cache/json-1.0.0.gem"); + // Joined a component at a time, as the code builds them: on Windows + // a `/` inside a component stays a `/`. + let spec = home.join("specifications").join("json-1.0.0.gemspec"); + let cache = home.join("cache").join("json-1.0.0.gem"); std::fs::create_dir_all(home.join("cache")).unwrap(); std::fs::write(&cache, "").unwrap(); let reason = "its native extension could not be rebuilt: no Ruby owning this install \