Skip to content

Fix Linux tmux segfault in user shell lookup#13900

Merged
etraut-openai merged 4 commits intomainfrom
etraut/issue-13842
Mar 10, 2026
Merged

Fix Linux tmux segfault in user shell lookup#13900
etraut-openai merged 4 commits intomainfrom
etraut/issue-13842

Conversation

@etraut-openai
Copy link
Collaborator

@etraut-openai etraut-openai commented Mar 7, 2026

Replace the Unix shell lookup path in codex-rs/core/src/shell.rs to use
libc::getpwuid_r() instead of libc::getpwuid() when resolving the current
user's shell.

Why:

  • getpwuid() can return pointers into libc-managed shared storage
  • on the musl static Linux build, concurrent callers can race on that storage
  • this matches the crash pattern reported in tmux/Linux sessions with parallel
    shell activity

Refs:

@etraut-openai etraut-openai changed the title Use getpwuid_r for shell lookups Fix Linux tmux segfault in user shell lookup Mar 7, 2026
@qtnx
Copy link

qtnx commented Mar 10, 2026

Thank you for this. Please consider adding it to the next release. I implemented the same approach in my local fork, and Codex has been running for over two days without any issues in the same environment, setup, and prompt.

@etraut-openai etraut-openai merged commit 9a501dd into main Mar 10, 2026
51 of 53 checks passed
@etraut-openai etraut-openai deleted the etraut/issue-13842 branch March 10, 2026 15:57
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crashed (segmentation fault, exited 139) inside tmux on Linux, introduced after v0.110.0

3 participants