#!/usr/bin/env bats # # Uninvited-guest semantics. tmux >= 3.3 answers a non-allowlisted # user's connection with "access not allowed" on stderr and EXIT 0 # (verified live on 3.3a and 3.5a with two real users), for every # command — including has-session, which then reports any target as # existing. Exit-code-based checks therefore misclassified # "unauthorized" as "authorized": party status reported uninvited # members as joined, party leave silently "succeeded", and party list # printed bogus "0 attendee(s)" rows. These tests pin the corrected # classification. load 'helpers' setup() { setup_party_sandbox export TMUX_PARTY_GROUP="$(id -gn)" # Stub tmux that answers every command the way a real server answers # a non-allowlisted user: message on stderr, exit 0. cat > "$PARTY_TMP/tmux-denied" <<'STUB' #!/bin/sh echo "access not allowed" >&2 exit 0 STUB chmod +x "$PARTY_TMP/tmux-denied" export PARTY_TMUX="$PARTY_TMP/tmux-denied" # Plant a live-looking party dir + roster. Ownership is ours (bats # can't fake a foreign uid without root), so cmd_status will also see # this fixture as "hosting" — that's orthogonal to the joined/leave # misreporting under test. ensure_party_dir "$USER" fiesta d="$PARTY_SOCKET_DIR/party-$USER:fiesta.d" cat > "$d/roster" < "$PARTY_TMP/tmux-dead" <<'STUB' #!/bin/sh echo "no server running" >&2 exit 1 STUB chmod +x "$PARTY_TMP/tmux-dead" export PARTY_TMUX="$PARTY_TMP/tmux-dead" run "$PARTY_BIN" list [ "$status" -eq 0 ] [[ "$output" == *"no parties found"* ]] }