From e174226651b37d5a1947d06bff672b31d3295974 Mon Sep 17 00:00:00 2001 From: veg Date: Sat, 4 Jul 2026 09:44:32 +0000 Subject: [PATCH] fix: quote embedded paths in status-right widget --- party | 6 ++++-- tests/90-notifications.bats | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/party b/party index 343f803..b724434 100755 --- a/party +++ b/party @@ -446,7 +446,6 @@ party_self_path() { esac } - # After spawning the party server, configure status line and hooks. # All commands run against -S "$sock". Every literal name embedded # is shell-quoted to survive tmux's parser. @@ -486,8 +485,11 @@ EOF "$PARTY_TMUX" -S "$sock" set-option -s exit-empty on party_self=$(party_self_path) + # The #() body is run by the tmux server via sh, so the embedded + # paths are single-quoted — a path containing a single quote is + # accepted breakage (host's own install path). "$PARTY_TMUX" -S "$sock" set-option -g status-right \ - "party: #($party_self who --short --socket $sock 2>/dev/null)" + "party: #('$party_self' who --short --socket '$sock' 2>/dev/null)" # Join/leave broadcast. Hook bodies fan a display-message out to # every attached client of THIS server via the notify helper script. # tmux substitutes #{client_user} before running the shell command. diff --git a/tests/90-notifications.bats b/tests/90-notifications.bats index 34bf63e..e417fc5 100644 --- a/tests/90-notifications.bats +++ b/tests/90-notifications.bats @@ -24,11 +24,11 @@ party_rec() { printf '%s/party-%s:%s.d/roster\n' "$PARTY_SOCKET_DIR" "$USER" "$1 rec=$(party_rec srtest) sock=$(awk -F= '$1=="SOCKET"{print $2}' "$rec") sr=$(tmux -S "$sock" show-options -gv status-right) - [[ "$sr" == *"party who --short"* ]] + [[ "$sr" == *"who --short"* ]] # The #() body is executed with the tmux server's PATH, which need # not contain an installed `party` — the widget must pin the absolute # path of the script that hosted the party. - [[ "$sr" == "party: #(/"* ]] + [[ "$sr" == "party: #('/"* ]] } @test "client-attached hook invokes a notify helper that broadcasts display-message" {