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

+33 -3
View File
@@ -583,6 +583,17 @@ fn write_thread_main(handle: &OwnedHandle, rx: &Receiver<Vec<u8>>) {
//-------------------------------------------------------------------------
// Subprocess
/// Insert the config `env` overrides, decoding the encoded key/value text
/// to OS strings (WTF-16 on Windows) like the Unix implementation.
fn apply_env_overrides(env: &mut EnvMap, overrides: &RepeatableStringMap) {
for (k, v) in overrides.iter() {
env.insert(
ghostty_os::osbytes::config_str_to_os(k),
ghostty_os::osbytes::config_str_to_os(v),
);
}
}
struct Subprocess {
cwd: Option<EncodedOs>,
env: Option<EnvMap>,
@@ -687,9 +698,7 @@ impl Subprocess {
};
// Add the environment variables that override any others.
for (k, v) in cfg.env_override.iter() {
env.insert(k, v);
}
apply_env_overrides(&mut env, &cfg.env_override);
// Build our args list. If we fail to find the shell, we'd still like
// to try to run something so Ghostty can launch.
@@ -926,6 +935,27 @@ pub fn exec_command(command: &ConfigCommand, windir: Option<&str>) -> Result<Vec
#[cfg(test)]
mod tests {
#[test]
fn env_overrides_are_decoded() {
use std::os::windows::ffi::OsStringExt;
use ghostty_config::cli_args::ConfigField;
// A lone surrogate (escaped) value and a literal U+FDD0 key.
let lone = EncodedOs::from_wide(&[0x61, 0xD800]).into_encoded();
let lit = EncodedOs::from_plain_text("K\u{fdd0}").into_encoded();
let mut m = RepeatableStringMap::default();
m.parse_cli(Some(&format!("A={lone}"))).unwrap();
m.parse_cli(Some(&format!("{lit}=v"))).unwrap();
let mut env = EnvMap::new();
super::apply_env_overrides(&mut env, &m);
assert_eq!(
env.get("A").unwrap(),
std::ffi::OsString::from_wide(&[0x61, 0xD800])
);
assert_eq!(env.get("K\u{fdd0}").unwrap(), "v");
}
#[test]
fn terminfo_dir_is_sibling_of_resources_and_lossless() {
use std::os::windows::ffi::{OsStrExt, OsStringExt};