Repository navigation
macOS: cache data written to ~/.cache instead of ~/Library/Caches, XDG var ignored #15138
Unanswered
rycli
asked this question in
Issue Triage
Replies: 1 comment
|
Hi @rycli, good catch! I checked it, you are right. It got inverted in 15c50c1 ("crash: do not use global state", #13567), that's why 1.3.x is fine and 1.4.0 isn't. Before that commit it was: if (global.environ().containsUnemptyConstant("XDG_CACHE_HOME")) break :macos;so set and non-empty meant use XDG. Now it is: const xdg_cache_home = environ_map.get("XDG_CACHE_HOME") orelse break :macos;
if (xdg_cache_home.len > 0) {
return try internal_os.macos.cacheDir(alloc, "sentry");
}which picks if (comptime builtin.target.os.tag == .macos) macos: {
if (environ_map.get("XDG_CACHE_HOME")) |v| {
if (v.len > 0) break :macos;
}
return try internal_os.macos.cacheDir(alloc, "sentry");
}Until then you can delete Might be worth turning this into an issue/PR since the fix is small. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Issue Description
Since 1.4.0, Ghostty incorrectly uses/checks
XDG_CACHE_HOMEthat stores the Sentry database. When the variable is not set, it writes to~/.cache/ghostty/sentry. This ends up being the default scenario when Ghostty is opened from Spotlight/Dock/Finder. When the variable is set, it ignores it and writes to~/Library/Caches/com.mitchellh.ghostty/sentry.This seems to be caused by the logic at https://github.com/ghostty-org/ghostty/blob/main/src/crash/sentry.zig#L192 which seems to result in the opposite of what the comment above it describes..
Expected Behavior
Logic prior to 1.4:
XDG_CACHE_HOMEmissing or empty:~/Library/Caches/com.mitchellh.ghostty/sentryXDG_CACHE_HOMEset:$XDG_CACHE_HOME/ghostty/sentryActual Behavior
XDG_CACHE_HOMEmissing or empty:~/.cache/ghostty/sentryXDG_CACHE_HOMEset:~/Library/Caches/com.mitchellh.ghostty/sentryReproduction Steps
launchctl getenv XDG_CACHE_HOMEshows emptyls ~/.cacheGhostty Logs
No response
Ghostty Version
OS Version Information
macOS 27.2 (26B123)
(Linux only) Display Server
None
(Linux only) Desktop Environment/Window Manager
No response
Minimal Ghostty Configuration
Additional Relevant Configuration
No response
I acknowledge that:
```) on separate lines.All reactions