Skip to content

fix: strip AppImage runtime vars from PTY shell env - #3

Merged
omartelo merged 1 commit into
mainfrom
fix/terminal-appimage-env-leak
Jul 12, 2026
Merged

omartelo merged 1 commit into
mainfrom
fix/terminal-appimage-env-leak

Conversation

@omartelo

@omartelo omartelo commented Jul 12, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Opening a terminal in a mise / asdf-managed shell errors on every launch:

mise ERROR lich-v0.1.1-x86_64_...AppImage is not a valid shim. This likely
means you uninstalled a tool and the shim does not point to anything.

Root cause

The AppImage runtime injects ARGV0 (the .AppImage's invocation name),
APPIMAGE, APPDIR and OWD into the process environment. Start passed the
full os.Environ() to the spawned PTY shell (internal/terminal/terminal.go),
so mise/asdf activation hooks read ARGV0 and mistook the shell for an
invalid tool shim.

Fix

childEnv filters only those four AppImage runtime variables before spawning
the shell. The rest of the user's login environment (PATH, SHELL, HOME,
LANG, …) is preserved — the reason os.Environ() was used (commit 2e90529)
stays intact. Applied at the shared spawn point, so both shell and Claude
sessions are covered.

No regression

Outside an AppImage (.deb / .rpm / .pkg / task run) none of these vars
are set, so childEnv is a no-op.

Test plan

  • go vet ./internal/terminal/ clean, gofmt applied
  • childEnv filter logic verified (keeps PATH/HOME, drops the 4 AppImage vars)
  • CI (Ubuntu): go test -race ./... — local run cannot link WebKitGTK on CachyOS
  • Manual: open a terminal from the AppImage build with mise activate in the rc, confirm no shim error

The AppImage runtime injects ARGV0 (the .AppImage's invocation name),
APPIMAGE, APPDIR and OWD into the process environment. Start passed the
full os.Environ() to the spawned PTY shell, so mise/asdf activation hooks
read ARGV0 and mistook the shell for an invalid tool shim, erroring on
every terminal open.

childEnv filters only those four runtime variables; the rest of the
user's login environment (PATH, SHELL, HOME, LANG, ...) is preserved.
Applied at the shared spawn point, so both shell and Claude sessions are
covered. Outside an AppImage the vars are absent and childEnv is a no-op.
@omartelo
omartelo merged commit 64609a0 into main Jul 12, 2026
1 check passed
@omartelo
omartelo deleted the fix/terminal-appimage-env-leak branch July 14, 2026 15:58
omartelo added a commit that referenced this pull request Nov 8, 2026
…double click (#1063)

Picks up lichdotdev/gio #3 to #6: a 400 ms double click window, the flip
model on Windows, partial redraw into a framebuffer the renderer keeps
instead of trusting the buffer age, and upstream main.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant