Skip to content

fix(bin): canonicalize Windows drive-letter herdr socket paths before identity comparison - #2918

Open
3min-lang wants to merge 2 commits into
kunchenguid:mainfrom
3min-lang:windows-herdr-socket-identity
Open

fix(bin): canonicalize Windows drive-letter herdr socket paths before identity comparison#2918
3min-lang wants to merge 2 commits into
kunchenguid:mainfrom
3min-lang:windows-herdr-socket-identity

Conversation

@3min-lang

@3min-lang 3min-lang commented Aug 24, 2026

Copy link
Copy Markdown

Problem

On native Windows the herdr server injects and reports drive-letter socket
paths (C:\Users\...\herdr.sock), while the launcher's claimed socket arrives
in POSIX spelling. fm_backend_herdr_socket_identity compares the two
literally, so the same socket compares unequal. That comparison is the single
owner for the presentation session lock and the launcher-identity
same-session proof, so both reject a socket that is in fact their own.

Fix

Convert a drive-letter path to its POSIX spelling with cygpath -u before the
existing directory resolution, so both sides land in the same form.

The case guard matches only [A-Za-z]:[\/]*, a shape that cannot occur on
Linux or macOS, so cygpath is never invoked there and behaviour on those
platforms is unchanged. An unresolvable drive-letter path returns 1 rather than
comparing a half-converted string.

Testing and scope

  • bin/fm-lint.sh bin/backends/herdr.sh clean.
  • Read against current main: fm_backend_herdr_socket_identity still compares
    the two spellings literally, so the mismatch this fixes is still present.

Scope note, stated because it limits what this PR can be said to fix: on the
Windows host where this was found, fm_backend_herdr_presentation_session_lock_path
fails earlier, at fm_backend_herdr_presentation_lock_namespace_valid, which
requires mode 700. Git Bash mounts both /c and /tmp with noacl, so
mkdir -m 700 is a silent no-op there and the namespace directory reads 755.
That is a separate defect with a separate cause, and this PR does not address
it. So this change is offered as a correctness fix to the identity comparison
itself, not as an end-to-end repair of presentation locking on Windows.

🤖 Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "test(herdr): cover Windows drive-letter ..." | Re-trigger Greptile

Comment thread bin/backends/herdr.sh
Adds the regression coverage the review asked for. `cygpath` ships only with
Git for Windows, so the cases stub it and therefore run on every platform; the
adapter guard matches only `[A-Za-z]:[\/]*`, a shape that cannot occur on
Linux or macOS.

Three cases: a drive-letter spelling normalizes to the same identity as the
POSIX spelling of the same socket, a failed `cygpath` is refused rather than
compared half-converted, and empty `cygpath` output is refused.

Verified the cases fail for the right reason: with the guard removed, the
normalization case reports an empty identity against the expected POSIX path.
@3min-lang

Copy link
Copy Markdown
Author

Added the regression coverage in 72e411c.

Three cases in tests/fm-backend-herdr.test.sh:

  • a drive-letter spelling normalizes to the same identity as the POSIX spelling of the same socket
  • a failed cygpath is refused rather than compared half-converted
  • empty cygpath output is refused

cygpath ships only with Git for Windows, so the cases stub it and run on every platform. The adapter guard matches only [A-Za-z]:[\/]*, a shape that cannot occur on Linux or macOS, so nothing about the POSIX path changes.

I checked the cases can fail for the right reason rather than just passing: with the guard removed, the normalization case reports an empty identity against the expected POSIX path.

One note in case you see it on your side too. On this host tests/fm-backend-herdr.test.sh already halts earlier, at not ok - the ambiguity refusal did not name the candidate workspaces (missing: 'w1 w7'), and that failure reproduces identically on unpatched main here, so it is pre-existing and unrelated to this PR. Because the suite stops there, I verified the three new cases in isolation rather than through a full green run of the file.

🤖 Generated with Claude Code

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.

1 participant