mirror of
https://github.com/openai/codex.git
synced 2026-11-29 00:00:54 +00:00
ci: publish versioned bash fork artifacts
This commit is contained in:
@@ -15,6 +15,30 @@ decision to the shell-escalation protocol over a shared file descriptor (specifi
|
||||
- `Deny`: the server has declared the proposed command to be forbidden, so
|
||||
`codex-execve-wrapper` prints an error to `stderr` and exits with `1`.
|
||||
|
||||
Both patched shells use `EXEC_WRAPPER` to locate `codex-execve-wrapper` and
|
||||
preserve `CODEX_ESCALATE_SOCKET` as the inherited escalation socket file
|
||||
descriptor. This shared environment contract lets intercepted commands pass
|
||||
through trees containing either shell without losing the escalation session.
|
||||
|
||||
## Patched bash
|
||||
|
||||
We carry a small patch to `execute_cmd.c` (see
|
||||
`patches/bash-exec-wrapper.patch`) that adds support for `EXEC_WRAPPER`. The
|
||||
patch applies to `a8a1c2fac029404d3f42cd39f5a20f24b6e4fe4b` from
|
||||
https://git.savannah.gnu.org/git/bash. To rebuild manually:
|
||||
|
||||
```bash
|
||||
git clone https://git.savannah.gnu.org/git/bash
|
||||
git checkout a8a1c2fac029404d3f42cd39f5a20f24b6e4fe4b
|
||||
git apply /path/to/patches/bash-exec-wrapper.patch
|
||||
./configure --without-bash-malloc
|
||||
make -j"$(nproc)"
|
||||
```
|
||||
|
||||
Release artifacts are built by `.github/workflows/rust-release-bash.yml` when
|
||||
a `codex-bash-vX.Y.Z` tag is pushed. When the bash commit or patch changes,
|
||||
publish the next version tag.
|
||||
|
||||
## Patched zsh
|
||||
|
||||
We carry a small patch to `Src/exec.c` (see `patches/zsh-exec-wrapper.patch`) that adds support for `EXEC_WRAPPER`. The patch applies to `77045ef899e53b9598bebc5a41db93a548a40ca6` from https://git.code.sf.net/p/zsh/code. To rebuild manually:
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
diff --git a/execute_cmd.c b/execute_cmd.c
|
||||
index 070f5119..d20ad2b9 100644
|
||||
--- a/execute_cmd.c
|
||||
+++ b/execute_cmd.c
|
||||
@@ -6129,6 +6129,19 @@ shell_execve (char *command, char **args, char **env)
|
||||
char sample[HASH_BANG_BUFSIZ];
|
||||
size_t larray;
|
||||
|
||||
+ char *exec_wrapper = getenv("EXEC_WRAPPER");
|
||||
+ if (exec_wrapper && *exec_wrapper && !whitespace (*exec_wrapper))
|
||||
+ {
|
||||
+ char *orig_command = command;
|
||||
+
|
||||
+ larray = strvec_len (args);
|
||||
+
|
||||
+ memmove (args + 2, args, (++larray) * sizeof (char *));
|
||||
+ args[0] = exec_wrapper;
|
||||
+ args[1] = orig_command;
|
||||
+ command = exec_wrapper;
|
||||
+ }
|
||||
+
|
||||
SETOSTYPE (0); /* Some systems use for USG/POSIX semantics */
|
||||
execve (command, args, env);
|
||||
i = errno; /* error from execve() */
|
||||
Reference in New Issue
Block a user