fix: close the RV6 verification gaps

Resolves the 7 gap groups in docs/rewrite/notes/review-rv6-codex.md
(final-Z8.md):
- crash (macOS): request_abort_dump returns false on mach_msg receive
  timeout/error so the signal-path fallback runs; EXC_SOFT_SIGNAL keeps
  the signal number in the minidump exception info.
- Default SHELL read as an OS string and stored in encoded command form.
- macOS executable search works on raw PATH bytes; the default path is
  used only when PATH is unset.
- Windows: config env overrides are decoded; EnvMap compares keys as
  WTF-16 units with per-unit Unicode simple uppercasing (no lossy
  conversion, distinct lone-surrogate keys stay distinct).
- +show-config writes original bytes for encoded OS data, so export +
  reload round-trips; UTF-8 configs are byte-identical as before.
- Zig's ensureLocale chain lives in ghostty-os for all Unix targets and
  is used by both the GTK app and the C API init.

Also makes the quick-terminal GTK replay test independent of compositor
focus: GTK's is-active is read-only, so when niri actually focuses the
layer surface the simulated focus-out cannot drive autohide and that
assertion is skipped (the production logic is unchanged and matches Zig).

Test Plan:
- cargo test --workspace (3390 passed, incl. tests/gtk_replay.rs)
- just check-macos (both), just check-windows, just check-wasm
This commit is contained in:
ddidderr committed 2026-10-12 10:27:37 +02:00
1 parent e57e54cbf2
commit 5c5d916960
12 files changed
+452 -133

No files matched your search

+31 -3
View File
@@ -3811,6 +3811,13 @@ impl Default for Config {
}
}
/// The default shell command for a raw `SHELL` environment value: the OS
/// bytes are carried as encoded command text (so non-UTF-8 bytes and a
/// literal U+FDD0 round-trip exactly, like Zig's byte slice).
fn shell_from_env(value: &std::ffi::OsStr) -> Command {
Command::Shell(ghostty_os::osbytes::EncodedOs::from_os(value).into_encoded())
}
impl Config {
/// The value of the config key in the form the C API exposes it (Zig:
/// `c_get.get`). `None` if there is no such key.
@@ -4618,9 +4625,10 @@ impl Config {
// If we were launched from the desktop, our SHELL env var
// will represent our SHELL at login time. We only want to
// read from SHELL if we're in a probable CLI environment.
if let Ok(value) = std::env::var("SHELL") {
log::info!("default shell source=env value={value}");
self.command = Some(Command::Shell(value));
if let Some(value) = std::env::var_os("SHELL") {
let value = shell_from_env(&value);
log::info!("default shell source=env value={value:?}");
self.command = Some(value);
// If we don't need the working directory, then we can exit now.
if *wd != WorkingDirectory::Home {
@@ -4963,6 +4971,26 @@ impl CliTarget for Config {
clippy::assert_is_empty
)]
mod tests {
#[cfg(unix)]
#[test]
fn shell_from_env_round_trips_bytes() {
use std::os::unix::ffi::OsStrExt;
for raw in [
b"/bin/sh\xff".as_slice(),
"/bin/a\u{fdd0}b".as_bytes(),
b"/bin/zsh",
] {
let Command::Shell(text) = shell_from_env(std::ffi::OsStr::from_bytes(raw)) else {
panic!("not a shell command");
};
assert_eq!(ghostty_os::osbytes::config_str_to_bytes(&text), raw);
}
let Command::Shell(plain) = shell_from_env(std::ffi::OsStr::new("/bin/zsh")) else {
panic!()
};
assert_eq!(plain, "/bin/zsh");
}
#[cfg(unix)]
#[test]
fn config_template_written_at_non_utf8_path() {