Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Investigate: Remove compinit warning suppression (#358)
Maximilian Roos7cff9afcaa57
diff --git a/src/shell.rs b/src/shell.rsindex 03f177fe8..3e87fe090 100644--- a/src/shell.rs+++ b/src/shell.rs@@ -386,11 +386,17 @@ pub fn detect_zsh_compinit() -> Option<bool> {// "zsh compinit: insecure directories, run compaudit for list."// "Ignore insecure directories and continue [y] or abort compinit [n]?"//- // This prompt goes to the TTY (not stderr), so it leaks through even with- // stderr redirected. It's safe to suppress because:- // 1. Users with this issue already see the warning every time they open a terminal- // 2. We're only probing zsh's state, not doing anything security-sensitive- // 3. This only affects our subprocess, not the user's actual shell+ // This prompt goes to /dev/tty (not stderr), bypassing our stderr redirect.+ //+ // Worktrunk does NOT cause this warning - our shell init script doesn't modify+ // fpath or call compinit. It only registers completions with `compdef` if the+ // user has already set up compinit themselves. The warning appears because:+ // 1. This probe runs `zsh -ic` which sources global configs like /etc/zsh/zshrc+ // 2. Some environments (notably Ubuntu CI) have global configs that call compinit+ // 3. Those environments may have insecure fpath directories+ //+ // Safe to suppress because we're only probing shell state, not doing anything+ // security-sensitive, and this only affects our subprocess..env("ZSH_DISABLE_COMPFIX", "true")// Prevent subprocesses from writing to the directive file.env_remove(crate::shell_exec::DIRECTIVE_FILE_ENV_VAR)diff --git a/tests/integration_tests/configure_shell.rs b/tests/integration_tests/configure_shell.rsindex 76ac9b0b7..c2f44b98e 100644--- a/tests/integration_tests/configure_shell.rs+++ b/tests/integration_tests/configure_shell.rs@@ -946,11 +946,12 @@ mod pty_tests {configure_pty_command(&mut cmd);cmd.env("HOME", temp_home.path());cmd.env("SHELL", "/bin/zsh");- // Skip compinit detection probe. The probe spawns `zsh -ic` which may trigger compinit's- // "insecure directories" warning on CI. That warning goes to /dev/tty (not stdout/stderr),- // so it leaks into PTY output despite ZSH_DISABLE_COMPFIX. This test is about install- // preview formatting, not compinit detection.- cmd.env("WORKTRUNK_TEST_COMPINIT_CONFIGURED", "1");+ // Skip the compinit probe and force the advisory to appear. The probe spawns+ // `zsh -ic` which triggers global zshrc configs that can produce "insecure+ // directories" warnings on some CI environments. These warnings go to /dev/tty+ // and leak into PTY output despite our ZSH_DISABLE_COMPFIX suppression.+ // Using MISSING=1 skips the probe while still showing the compinit advisory.+ cmd.env("WORKTRUNK_TEST_COMPINIT_MISSING", "1");let mut child = pair.slave.spawn_command(cmd).unwrap();drop(pair.slave);diff --git a/tests/integration_tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap b/tests/integration_tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snapindex 2e00b9f29..06dd4628c 100644--- a/tests/integration_tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap+++ b/tests/integration_tests/snapshots/integration__integration_tests__configure_shell__pty_tests__install_preview_with_gutter.snap@@ -13,4 +13,6 @@ y↳ Skipped fish; ~/.config/fish/conf.d not found✓ Configured 1 shell+▲ Completions require compinit; add to ~/.zshrc before the wt line:+ autoload -Uz compinit && compinit↳ Restart shell or run: source ~/.zshrc