Skip to content

Fix libc termios ABI mismatch in password-mode detection - #781

Merged
emil-e merged 1 commit into
dakra:mainfrom
emil-e:fix/780-termios-abi
Nov 1, 2026
Merged

emil-e merged 1 commit into
dakra:mainfrom
emil-e:fix/780-termios-abi

Conversation

@emil-e

@emil-e emil-e commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #780.

Use the C-imported termios struct together with c.tcgetattr in password-mode detection, matching PosixPtyProcess.zig. This avoids passing Zig's kernel-layout termios storage to libc, which can overwrite the stack on Linux. Read ICANON and ECHO using the corresponding C constants rather than adding padding around the mismatched type.

Add POSIX PTY tests covering all canonical/echo combinations, missing paths, and non-TTY paths. Register them only in the non-Windows test branch.

Verification

  • Native macOS module build passed with Zig 0.17.0.
  • All 41 Zig tests passed in Debug and ReleaseFast on macOS.
  • PTY regression tests cross-compiled for aarch64-linux-gnu and x86_64-linux-gnu in ReleaseSafe and ReleaseFast; not executed on Linux.
  • zig fmt and git diff --check passed.

@emil-e
emil-e merged commit 7ce870c into dakra:main Nov 1, 2026
30 checks passed
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.

Segfault on Linux when opening a terminal; stack overflow in pty_utils.isPasswordMode

1 participant