From c67cb01f2d43f4b041a7d1f8c27195754b4ee1a5 Mon Sep 17 00:00:00 2001 From: dingo Date: Mon, 10 Aug 2026 11:48:50 +0700 Subject: [PATCH] Backport the session log block from the installed copy /usr/bin/start-hyprcosmic gained this during the blank-screen debugging and the versioned copy never did, so the next install from this repository would have silently removed it. Found by diffing the two while writing an installer; the installer's --check exists so that the next one is not found by hunch. What it does, unchanged from the copy that has been running: redirect the session's own output to ~/.cache/hyprcosmic/session.log. A session that fails drops you at the greeter taking its stderr with it, and by then the journal cannot be read from inside a session that no longer exists. A plain redirect rather than tee into a process substitution -- tee would be a child the session writes through, so its death would deliver SIGPIPE, and nothing about diagnostics should be able to kill the desktop. Every step is guarded, so a failure here starts the session with no log rather than refusing to log in. The previous log is kept as .1 so a second attempt does not erase the evidence from the first. --- data/start-hyprcosmic | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/data/start-hyprcosmic b/data/start-hyprcosmic index c95652f..218b956 100755 --- a/data/start-hyprcosmic +++ b/data/start-hyprcosmic @@ -26,6 +26,36 @@ if [[ ! -x "$HYPRCOSMIC_SESSION_BIN" ]]; then exit 1 fi +# Capture this session's output to a file that outlives it. +# +# A session that fails drops you straight back to the greeter, taking its +# stderr with it -- and by then you cannot read the journal from inside a +# session that no longer exists. A plain file in the cache directory is still +# there afterwards, whatever happened. +# +# A plain redirect, not `tee` into a process substitution: tee would be a child +# process the session writes through, so if it ever died the session would take +# a SIGPIPE. Nothing about diagnostics should be able to kill the desktop. +# +# Every step is guarded. If any of it fails the session starts anyway with no +# log -- losing diagnostics is an inconvenience, refusing to log in is not. +# +# The previous log is kept as .1, so a second attempt does not erase the +# evidence from the first. +HYPRCOSMIC_LOG="${XDG_CACHE_HOME:-$HOME/.cache}/hyprcosmic/session.log" +if mkdir -p "$(dirname "$HYPRCOSMIC_LOG")" 2>/dev/null; then + if [[ -f "$HYPRCOSMIC_LOG" ]]; then + mv -f "$HYPRCOSMIC_LOG" "${HYPRCOSMIC_LOG}.1" 2>/dev/null || true + fi + if : >>"$HYPRCOSMIC_LOG" 2>/dev/null; then + exec >>"$HYPRCOSMIC_LOG" 2>&1 + echo "=== hyprcosmic session starting $(date -Is) ===" + echo " session bin: $HYPRCOSMIC_SESSION_BIN" + echo " comp bin: $HYPRCOSMIC_COMP_BIN" + echo " autostart: ${XDG_CONFIG_HOME:-$HOME/.config}/hyprcosmic/autostart" + fi +fi + # Selects the component set in cosmic-session's profile module: cosmic-panel, # cosmic-launcher, cosmic-app-library, cosmic-workspaces, cosmic-bg and # cosmic-files-applet are skipped; waybar and friends come from