core-agent-ide/shell-tool-mcp/patches/zsh-exec-wrapper.patch
Jeremy Rose 9cf7a07281
feat(shell-tool-mcp): add patched zsh build pipeline (#11668)
## Summary
- add `shell-tool-mcp/patches/zsh-exec-wrapper.patch` against upstream
zsh `77045ef899e53b9598bebc5a41db93a548a40ca6`
- add `zsh-linux` and `zsh-darwin` jobs to
`.github/workflows/shell-tool-mcp.yml`
- stage zsh binaries under `artifacts/vendor/<target>/zsh/<variant>/zsh`
- include zsh artifact jobs in `package.needs`
- mark staged zsh binaries executable during packaging

## Notes
- zsh source is cloned from `https://git.code.sf.net/p/zsh/code`
- workflow pins zsh commit `77045ef899e53b9598bebc5a41db93a548a40ca6`
- zsh build runs `./Util/preconfig` before `./configure`

## Validation
- parsed workflow YAML locally (`yaml-ok`)
- validated zsh patch applies cleanly with `git apply --check` on a
fresh zsh clone
2026-02-13 01:34:48 +00:00

34 lines
998 B
Diff

diff --git a/Src/exec.c b/Src/exec.c
index 27bca11..baea760 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -507,7 +507,9 @@ zexecve(char *pth, char **argv, char **newenvp)
{
int eno;
static char buf[PATH_MAX * 2+1];
- char **eep;
+ char **eep, **exec_argv;
+ char *orig_pth = pth;
+ char *exec_wrapper;
unmetafy(pth, NULL);
for (eep = argv; *eep; eep++)
@@ -526,8 +528,17 @@ zexecve(char *pth, char **argv, char **newenvp)
if (newenvp == NULL)
newenvp = environ;
+ exec_argv = argv;
+ if ((exec_wrapper = getenv("EXEC_WRAPPER")) &&
+ *exec_wrapper && !inblank(*exec_wrapper)) {
+ exec_argv = argv - 2;
+ exec_argv[0] = exec_wrapper;
+ exec_argv[1] = orig_pth;
+ pth = exec_wrapper;
+ }
winch_unblock();
- execve(pth, argv, newenvp);
+ execve(pth, exec_argv, newenvp);
+ pth = orig_pth;
/* If the execve returns (which in general shouldn't happen), *
* then check for an errno equal to ENOEXEC. This errno is set *