summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/codex-0.144.1-test-shebangs.patch
blob: 1606fe9550209457b6be8eaeb14e53538562cde1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Author: Danny Milosavljevic <dannym@friendly-machines.com>
Date: 2026-07-11
License: ASL2.0
Subject: Use @SHELL@ placeholder for shebangs in embedded test scripts.

Tests that create and execute temporary shell scripts at runtime use a
hardcoded "#!/bin/sh" shebang.  Replace it with @SHELL@ so the Guix
build phase can substitute the actual store path.

Also change assertions to print the actual error on failure.

--- a/codex-rs/rmcp-client/src/program_resolver.rs
+++ b/codex-rs/rmcp-client/src/program_resolver.rs
@@ -149,10 +149,7 @@
         cmd.envs(&env.mcp_env);
         let output = cmd.output().await;
 
-        assert!(
-            output.is_ok(),
-            "Resolved program should execute successfully"
-        );
+        output.expect("Resolved program should execute successfully");
         Ok(())
     }
 
@@ -200,7 +197,7 @@
             #[cfg(unix)]
             {
                 let file = dir.join(Self::TEST_PROGRAM);
-                fs::write(&file, "#!/bin/sh\nexit 0")?;
+                fs::write(&file, "#!@SHELL@\nexit 0")?;
                 Self::set_executable(&file)?;
             }
 
--- a/codex-rs/tui/src/external_editor.rs
+++ b/codex-rs/tui/src/external_editor.rs
@@ -159,7 +159,7 @@
 
         let dir = tempdir().unwrap();
         let script_path = dir.path().join("edit.sh");
-        fs::write(&script_path, "#!/bin/sh\nprintf \"edited\" > \"$1\"\n").unwrap();
+        fs::write(&script_path, "#!@SHELL@\nprintf \"edited\" > \"$1\"\n").unwrap();
         let mut perms = fs::metadata(&script_path).unwrap().permissions();
         perms.set_mode(0o755);
         fs::set_permissions(&script_path, perms).unwrap();