From d5eaa4855a90057c268bf4d717f366ccf3197dba Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 16 Oct 2026 09:56:48 +0200 Subject: fix(user): userctl survives leading dashes and reports failed reads busctl and kwriteconfig6 parse a value starting with '-' as an option, so a location like '-x' failed; '--' before the value ends option parsing (checked against both binaries). get ran without pipefail, so a failing busctl gave empty fields and exit 0, which the page would show as a blank form. It now reads all fields first and, on failure, prints one error= line and exits 1. keys listed revoked, expired or invalid primaries, keys that cannot sign, and could label a key with a revoked uid. It now skips those. Unsetting the signing key uses --unset-all, since git exits 5 on a multi-valued key with --unset. Co-Authored-By: Claude Sonnet 5.5 --- desktop/modules/user/test-userctl.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'desktop/modules/user/test-userctl.sh') diff --git a/desktop/modules/user/test-userctl.sh b/desktop/modules/user/test-userctl.sh index cc90550..02a6e0c 100755 --- a/desktop/modules/user/test-userctl.sh +++ b/desktop/modules/user/test-userctl.sh @@ -42,7 +42,7 @@ for n in busctl kwriteconfig6 git gpg; do ln -s stub "$tmp/bin/$n"; done export PATH="$tmp/bin:$PATH" HOME="$tmp" LOG="$tmp/log" obj="/org/freedesktop/Accounts/User$(id -u)" -acc="busctl [--system] [call] [org.freedesktop.Accounts] [$obj] [org.freedesktop.Accounts.User]" +acc="busctl [--system] [call] [--] [org.freedesktop.Accounts] [$obj] [org.freedesktop.Accounts.User]" pass=0 fail=0 @@ -73,10 +73,14 @@ cat > "$tmp/gpg.txt" <<'EOF' sec:u:255:22:AAAA1111:1700000000:::u:::scESC:::+:::23::0: fpr:::::::::1111222233334444555566667777AAAA1111: grp:::::::::0000: +uid:r::::1700000000::HASH::Old Name ::::::::::0: uid:u::::1700000000::HASH::Jane Doèr ::::::::::0: uid:u::::1700000000::HASH::Jane D. ::::::::::0: ssb:u:255:18:SUB1:1700000000::::::e:::+:::23: fpr:::::::::9999888877776666555544443333SUB1: +sec:r:255:22:DEAD0000:1700000000:::u:::scESC:::#:::23::0: +fpr:::::::::DEAD0000DEAD0000DEAD0000DEAD00000000: +uid:r::::1700000000::HASH::Revoked Key ::::::::::0: sec:u:255:22:BBBB2222:1700000000:::u:::scESC:::#:::23::0: fpr:::::::::AAAABBBBCCCCDDDDEEEEFFFF0000BBBB2222: uid:u::::1700000000::HASH::Work Key ::::::::::0: @@ -90,7 +94,7 @@ reset out="$("$ctl" set name "Jane Doèr")" check "set name prints nothing" "" "$out" check "set name writes" "$acc [SetRealName] [s] [Jane Doèr] -kwriteconfig6 [--file] [emaildefaults] [--group] [PROFILE_Default] [--key] [FullName] [Jane Doèr] +kwriteconfig6 [--file] [emaildefaults] [--group] [PROFILE_Default] [--key] [FullName] [--] [Jane Doèr] git [config] [--global] [user.name] [Jane D.]" "$(cat "$LOG")" gitname() { reset; "$ctl" set name "$1" >/dev/null; grep '^git' "$LOG"; } @@ -103,7 +107,7 @@ check "extra spaces" "git [config] [--global] [user.name] [Jane D.]" "$(gitname reset "$ctl" set email jane@example.org >/dev/null check "set email writes" "$acc [SetEmail] [s] [jane@example.org] -kwriteconfig6 [--file] [emaildefaults] [--group] [PROFILE_Default] [--key] [EmailAddress] [jane@example.org] +kwriteconfig6 [--file] [emaildefaults] [--group] [PROFILE_Default] [--key] [EmailAddress] [--] [jane@example.org] git [config] [--global] [user.email] [jane@example.org]" "$(cat "$LOG")" # AccountsService only. @@ -121,11 +125,23 @@ reset export GIT_VALUE=OLD "$ctl" set signingkey "" >/dev/null check "unset signingkey" "git [config] [--global] [--get] [user.signingkey] -git [config] [--global] [--unset] [user.signingkey]" "$(cat "$LOG")" +git [config] [--global] [--unset-all] [user.signingkey]" "$(cat "$LOG")" reset "$ctl" set signingkey "" >/dev/null check "unset when none is set" "git [config] [--global] [--get] [user.signingkey]" "$(cat "$LOG")" +# A leading dash is a value, not an option. +reset +"$ctl" set location -x >/dev/null +check "dash value" "$acc [SetLocation] [s] [-x]" "$(cat "$LOG")" + +# A failing read: one error line, exit 1, no key=value lines. +reset +export FAIL=busctl +out="$("$ctl" get)"; rc=$? +check "get failure exit" "1" "$rc" +check "get failure output" "error=boom" "$out" + # A failing write stops there, says why on stdout, and exits 1. reset export FAIL=busctl -- cgit v1.2.3