Skip to content

The agent that grows with you

fix(update): address review — neutral gate comment, pin empty-target skew case

MatthewHines31bf8e504c00
diff --git a/scripts/desktop-update/posix.sh b/scripts/desktop-update/posix.sh
index 9caff956c6a..063d41bbab5 100755
--- a/scripts/desktop-update/posix.sh
+++ b/scripts/desktop-update/posix.sh
@@ -319,14 +319,14 @@ stop_ui() { # error/manual outcomes keep the window up briefly so a watching
GATE="" GATE_MSG=""
linux_gate() {
local unpacked="$INSTALL_ROOT/apps/desktop/release/linux-unpacked" sb arg
- # LOCAL (mhines 2026-08-21): canonicalize both sides before the prefix
- # compare. On this Fedora host /home is a symlink to /var/home; the
- # relaunch target is read from /proc/<pid>/exe (kernel-canonicalised to
- # /var/home/...) while INSTALL_ROOT is spelled /home/..., so the raw
- # prefix match false-gates as "skew" and tells the user to reinstall.
- # readlink -m canonicalises existing leading components without
- # requiring the full path to exist (unlike -f); no-op when both sides
- # already agree. Upstream issue drafted (not yet filed).
+ # Canonicalise both sides before the prefix compare. On some distros
+ # (e.g. Fedora/ostree) /home is a symlink to /var/home; the relaunch
+ # target is read from /proc/<pid>/exe, which the kernel canonicalises
+ # through symlinks, while INSTALL_ROOT keeps the original spelling —
+ # the raw prefix match then false-gates as "skew" and tells the user
+ # to reinstall an app that is fine. readlink -m canonicalises existing
+ # leading components without requiring the full path to exist (unlike
+ # -f); a no-op when both sides are already spelled the same.
unpacked="$(readlink -m -- "$unpacked")"
[ -n "$RELAUNCH_TARGET" ] && RELAUNCH_TARGET="$(readlink -m -- "$RELAUNCH_TARGET")"
case "$RELAUNCH_TARGET" in
diff --git a/tests/test_desktop_update_linux_gate.py b/tests/test_desktop_update_linux_gate.py
index cb33039267d..96444f7a2e9 100644
--- a/tests/test_desktop_update_linux_gate.py
+++ b/tests/test_desktop_update_linux_gate.py
@@ -135,4 +135,20 @@ def test_gate_canonicalises_the_patch_is_present():
fn = extract_linux_gate(src)
assert 'readlink -m' in fn, "linux_gate no longer canonicalises paths"
# Both sides must be canonicalised, not just one.
- assert fn.count("readlink -m") >= 2, "expected both sides canonicalised"
\ No newline at end of file
+ assert fn.count("readlink -m") >= 2, "expected both sides canonicalised"
+
+
+@requires_bash
+def test_empty_relaunch_target_falls_to_skew(tmp_path):
+ """An unset/empty RELaunch_TARGET must still gate 'skew'.
+
+ The canonicalisation line is guarded with [ -n "$RELAUNCH_TARGET" ] so
+ an empty value skips readlink and the raw empty string falls through
+ the case to the skew branch. This pins that behavior so the guard
+ cannot be "simplified" away without a visible test failure.
+ """
+ src = POSIX_SH.read_text()
+ fn = extract_linux_gate(src)
+ base = tmp_path / "install"
+ make_tree(base)
+ assert run_gate(fn, str(base), "") == "skew"