fix: harden party_self_path; pin (U,R) ACL format; widen breakage comments

This commit is contained in:
veg 2026-07-04 10:42:58 +00:00
parent 2dc9285433
commit b44a3b705f
2 changed files with 34 additions and 4 deletions

16
party
View file

@ -482,7 +482,13 @@ party_self_path() {
/*) printf '%s\n' "$0" ;;
*/*) printf '%s/%s\n' "$(cd "$(dirname "$0")" && pwd)" \
"$(basename "$0")" ;;
*) command -v "$0" 2>/dev/null || printf '%s\n' "$0" ;;
*) _sp=$(command -v "$0" 2>/dev/null) || _sp="$0"
# command -v may itself answer relatively (PATH with "." or
# an empty entry); anchor those to cwd like the */* case.
case "$_sp" in
/*) printf '%s\n' "$_sp" ;;
*) printf '%s/%s\n' "$PWD" "$_sp" ;;
esac ;;
esac
}
@ -500,8 +506,9 @@ tmux_party_setup_server() {
# was hosted with — a bare `tmux` from the server's PATH may be a
# different, older binary than $PARTY_TMUX, which is the whole reason
# PARTY_TMUX exists. The second (quoted) is the static body. A
# PARTY_TMUX containing a double quote or $ would break the pin;
# that's accepted — it's the host's own env var on their own party.
# PARTY_TMUX containing a double quote, $, or backslash would break
# the pin; that's accepted — it's the host's own env var on their
# own party.
cat > "$notify_script" <<EOF
#!/bin/sh
tmux="$PARTY_TMUX"
@ -526,7 +533,8 @@ 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
# paths are single-quoted — a path containing a single quote, a `)`,
# or `#{` (tmux's #() parser ends at the first unescaped `)`) 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)"