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

+9 -5
View File
@@ -6,6 +6,10 @@
use std::sync::OnceLock;
/// Re-export of the derived version constants (`VERSION_STRING`, `COMMIT`,
/// `RELEASE_CHANNEL`, `BUILD_MODE`) from `ghostty-build-info`.
pub use ghostty_build_info as derived;
/// A `major.minor.micro` version (Zig: `gtk_version.zig` / `adw_version.zig`).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Version {
@@ -49,11 +53,11 @@ pub struct BuildInfo {
impl Default for BuildInfo {
fn default() -> Self {
BuildInfo {
// Derived by `build.rs` (git describe / workspace app-version).
version_string: env!("GHOSTTY_VERSION_STRING").to_string(),
commit: Some(env!("GHOSTTY_COMMIT").to_string()).filter(|c| !c.is_empty()),
release_channel: env!("GHOSTTY_RELEASE_CHANNEL").to_string(),
build_mode: env!("GHOSTTY_BUILD_MODE").to_string(),
// Derived by `ghostty-build-info` (single source of truth).
version_string: ghostty_build_info::VERSION_STRING.to_string(),
commit: ghostty_build_info::COMMIT.map(str::to_string),
release_channel: ghostty_build_info::RELEASE_CHANNEL.to_string(),
build_mode: ghostty_build_info::BUILD_MODE.to_string(),
app_runtime: ".gtk".to_string(),
font_backend: ".fontconfig_freetype".to_string(),
renderer: "renderer.generic.Renderer(renderer.OpenGL)".to_string(),