From 6dcab73837dce51b6163575af58341e36a1578cc Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Wed, 28 Oct 2026 17:47:38 -0400 Subject: [PATCH] tools/phone-smoke: nothing may read the script's stdin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From the laptop, phone-smoke reaches the phone on bash's stdin (tools/phone-ssh "bash -s" < tools/phone-smoke). pacman -Q also loads the sync databases, and one signed by a key the phone doesn't trust (a --local build's, RELEASES §10) makes it ask on stderr whether to import the key and read the answer from stdin: the rest of the script. The report then never printed. A contributor found this on panther (#79). pacman -Q now reads /dev/null, which also means it can never answer yes to a key import, and so do the commands run as the desktop user, which never need input. Reproduced with a stand-in pacman that reads stdin as fgets does, piped like tools/phone-ssh: before, it took the last 1212 bytes and no report printed; after, it reads nothing and the full report prints. Co-Authored-By: Claude Opus 5.5 --- tools/phone-smoke | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/phone-smoke b/tools/phone-smoke index e97864580..d463c48cf 100755 --- a/tools/phone-smoke +++ b/tools/phone-smoke @@ -55,7 +55,9 @@ check() { results+=("$1|$2|$3|${4:-}"); } # The desktop user (uid 1000 on our images) for user units and the session bus. user=$(loginctl list-users --no-legend 2>/dev/null | awk '$2 != "root" {print $2; exit}') uid=$(id -u "$user" 2>/dev/null || true) -as_user() { runuser -u "$user" -- env XDG_RUNTIME_DIR="/run/user/$uid" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" "$@"; } +# From the laptop this script arrives on bash's stdin, so a command that reads +# stdin would swallow the rest of it: nothing here may read it. +as_user() { runuser -u "$user" -- env XDG_RUNTIME_DIR="/run/user/$uid" DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" "$@" /dev/null; d [[ -n $hot ]] && check ok 0 "thermal" "hottest zone $((hot / 1000)) °C" # ---------------------------------------------------------------- versions -pkgs=$(pacman -Q 2>/dev/null | grep -E '^(omamobile[-a-z]*|omacam|omatel[-a-z]*|omaphone|omamessages|omarchy|mesa|libcamera|hyprland|quickshell) ' | tr '\n' ',' | sed 's/,$//; s/,/, /g') +# pacman -Q also loads the sync databases, and one signed by a key the phone +# doesn't trust (a --local build's) makes it ask on stderr whether to import +# the key, reading the answer from stdin: the rest of this script. +pkgs=$(pacman -Q /dev/null | grep -E '^(omamobile[-a-z]*|omacam|omatel[-a-z]*|omaphone|omamessages|omarchy|mesa|libcamera|hyprland|quickshell) ' | tr '\n' ',' | sed 's/,$//; s/,/, /g') # ---------------------------------------------------------------- report device=${SMOKE_DEVICE:-unknown}