fix: preserve non-UTF-8 bytes in OS, config and CLI layers

Zig treats paths, arguments and environment values as byte slices; the
port converted them lossily in many places. Now (final-Z1.md):
- argv, env (incl. present non-UTF-8 values), HOME, PATH lookup,
  passwd, resources dir, TMPDIR, cgroup, config path canonicalization,
  +validate-config, +list-themes and Zig-string escapes (\xFF) keep raw
  bytes. String-based config values carry bytes via ghostty_os::osbytes,
  a bijective escape (noncharacter U+FDD0 + byte) that leaves all valid
  UTF-8 - including Nerd Font private-use icons - unchanged.
- os/file rlimit fallbacks exist on all targets.
- i18n locale canonicalization is an exact port of libintl's tables
  (e.g. pa-Guru -> pa_IN).
- New ghostty-build-info crate is the single source of version, channel,
  commit and build mode for all consumers.

Test Plan:
- cargo test -p ghostty-os -p ghostty-config -p ghostty-cli
  (incl. randomized osbytes round-trip property tests)
This commit is contained in:
ddidderr committed 2026-10-12 08:14:02 +02:00
1 parent e4cdd8e007
commit 395cff8981
32 files changed
+1464 -333

No files matched your search

+10 -4
View File
@@ -59,11 +59,12 @@ impl Options {
let expanded =
ghostty_os::expand_home(stripped).map_err(|e| ArgError::Other(e.to_string()))?;
let realpath =
std::fs::canonicalize(&expanded).map_err(|e| ArgError::Other(e.to_string()))?;
std::fs::canonicalize(ghostty_os::osbytes::config_str_to_path(&expanded))
.map_err(|e| ArgError::Other(e.to_string()))?;
self.working_directory_seen = true;
return Ok(Some(format!(
"--working-directory={}",
realpath.to_string_lossy()
ghostty_os::osbytes::path_to_config_string(&realpath)
)));
}
@@ -192,8 +193,13 @@ pub fn run(args: &[String]) -> Result<u8, Error> {
if !opts.working_directory_seen {
// This should be inserted at the beginning of the list, just in case `-e` was used.
let wd = std::fs::canonicalize(".")?;
opts.arguments
.insert(0, format!("--working-directory={}", wd.to_string_lossy()));
opts.arguments.insert(
0,
format!(
"--working-directory={}",
ghostty_os::osbytes::path_to_config_string(&wd)
),
);
}
let target = match opts.class {