Check XDG_RUNTIME_DIR is writable, not just set

SSH sessions may export XDG_RUNTIME_DIR=/run/user/<uid> even when that
directory doesn't exist or isn't writable. Check writability rather than
emptiness before falling back to /tmp/podman-<uid>.

https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
This commit is contained in:
Claude 2026-03-22 07:40:53 +00:00
parent 139a03c774
commit cf50332a8f
No known key found for this signature in database

View file

@ -66,7 +66,7 @@ echo "[hiy] Generated proxy/caddy.json for ${DOMAIN_SUFFIX}"
# shells. Podman uses XDG_RUNTIME_DIR for RunRoot, events dirs, and the
# default socket path, so we must set it to something writable before any
# podman invocation.
if [ -z "${XDG_RUNTIME_DIR:-}" ]; then
if [ ! -d "${XDG_RUNTIME_DIR:-}" ] || [ ! -w "${XDG_RUNTIME_DIR:-}" ]; then
export XDG_RUNTIME_DIR="/tmp/podman-$(id -u)"
mkdir -p "$XDG_RUNTIME_DIR"
fi