From 49768c646496200110a60f3be0b6ffe2a369e476 Mon Sep 17 00:00:00 2001 From: Maciek Borzecki Date: Fri, 9 Jan 2026 15:48:41 +0100 Subject: [PATCH] snap: fix handling of nonexistent last_revision file Assuming /bin/sh is symlinked to bash, the handling of special builtin 'source' is slightly different between bash and bash-in-POSIX-mode (as a result of being invoked through /bin/sh). Specifically errors in builtin 'source' cannot be masked with `|| true`. Compare $ ls -l /bin/sh lrwxrwxrwx 1 root root 4 Dec 11 11:00 /bin/sh -> bash $ /bin/sh -c 'set -e ; source nofile || true; echo ok' /bin/sh: line 1: source: nofile: file not found $ /bin/bash -c 'set -e ; source nofile || true; echo ok' /bin/bash: line 1: nofile: No such file or directory ok Thus ghostty from snap would not start at all when $SNAP_USER_DATA/.last_revision does not exist causign the launcher script to exit prematurely. Signed-off-by: Maciek Borzecki --- snap/local/launcher | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/snap/local/launcher b/snap/local/launcher index 89e0d1709..71b92f5bb 100755 --- a/snap/local/launcher +++ b/snap/local/launcher @@ -14,7 +14,14 @@ if [ -z "$XDG_DATA_HOME" ]; then export XDG_DATA_HOME="$SNAP_REAL_HOME/.local/share" fi -source "$SNAP_USER_DATA/.last_revision" 2>/dev/null || true +if [ -f "$SNAP_USER_DATA/.last_revision" ]; then + if ! source "$SNAP_USER_DATA/.last_revision" 2>/dev/null; then + # file exist but sourcing it fails, so it's likely + # not good anyway + rm -f "$SNAP_USER_DATA/.last_revision" + fi +fi + if [ "$LAST_REVISION" = "$SNAP_REVISION" ]; then needs_update=false else