Skip to content

fix(tmux): every tmux command runs as a UTF-8 client, so a listing parses with no locale set - #360

Closed
WynandVStaden wants to merge 1 commit into
AltanS:mainfrom
WynandVStaden:fix/tmux-utf8-client-flag
Closed

WynandVStaden wants to merge 1 commit into
AltanS:mainfrom
WynandVStaden:fix/tmux-utf8-client-flag

Conversation

@WynandVStaden

Copy link
Copy Markdown
Contributor

Fixes #358.

Every tmux command the adapter runs now carries -u, so the client is UTF-8 whatever the ambient locale is. Started with no UTF-8 locale (a bare container, a systemd unit), tmux 3.7c sanitizes -F output and the U+001F field separator comes back as _. Every listing line then parses to nothing, the poll throws, and the bridge is marked disconnected while tmux is answering.

I went with the flag rather than LC_ALL=C.UTF-8 in the child environment (suggestion 1 in the issue) for two reasons: it does not need that locale to exist on the box, and it still holds when the operator's environment pins LC_ALL=C, which outranks any LANG. Both spawns in exec.ts now build their argv through one pure helper, tmuxArgv, so a test can pin the line. I left the error sentence alone, since with -u the locale can no longer be the cause.

Reproduction and result

Built tmux 3.7c from source on Ubuntu 24.04 and ran the real SpawnTmuxExec + LISTING_ARGS + parseListing against a server with one session, under env -i:

tmux environment main this branch
3.7c no locale 3 lines, 0 rows 1 session, 1 window, 1 pane
3.7c LC_ALL=C not run 1 session, 1 window, 1 pane
3.4 no locale not run 1 session, 1 window, 1 pane

Raw tmux 3.7c output for the same format string: S_$0_1_repro with no locale, S^_$0^_1^_repro with -u.

Base branch — see CONTRIBUTING.md:

  • Opened against main — there is one line of development, and main is it

Checks

  • bun run typecheck (root and web/), bun run lint, bun test ./bridge ./cli ./scripts, cd web && bun run test all pass

    Run on Ubuntu 24.04 (WSL), bun 1.4.2: both typechecks pass, lint reports 0 warnings and 0 errors, and the backend suite is 6392 pass, 0 fail. The web suite is 17723 passed and 1 failed: src/lib/table-run.test.ts › "claims real tables and nothing else across every committed capture". That test fails the same way on unmodified main in my environment, and this PR touches nothing under web/, so I have left the box unticked rather than claim it.

  • CHANGELOG entry: fork PR, so no version bump and no CHANGELOG edit. A suggested line, if useful:

    - **A tmux listing parses when no locale is set.** Started with no UTF-8 locale — a minimal container, a systemd unit — tmux 3.7 replaced the separator Collie reads with "_", so every poll failed and the app showed the host as down while tmux was answering. Collie now runs every tmux command with -u. Thanks @cyxou (#358).

…rses with no locale set

Started with no UTF-8 locale (a minimal container, a systemd unit), tmux 3.7
sanitizes its -F output and the U+001F field separator comes back as "_".
Every listing line then parses to nothing, the poll throws and the bridge is
marked disconnected although tmux is answering.

Pass -u on every invocation, which makes the client UTF-8 regardless of
LANG and LC_ALL. Both spawns now build their argv through one pure helper so
a test can pin it.

Fixes AltanS#358
@AltanS

AltanS commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Thanks @WynandVStaden, this ships in 1.17.0. Your -u at both spawn sites is kept as you wrote it, with your commits and authorship intact; on top I added a test that a listing with a sanitized separator still trips the parse guard, and removed the "tmux 3.7 only" claim, since a 3.6b client with no locale does it too. You are credited in the changelog, together with @cyxou for the report. I am closing this here because the work lands with the release branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tmux -F listings parse to zero rows under a non-UTF-8 locale: separator sanitized to 0x5f, bridge marks mux disconnected

2 participants