Use the "correct" wrong SSH_AUTH_SOCK value
Marco Ricci

Marco Ricci commited on 2026-01-18 16:37:36
Zeige 2 geänderte Dateien mit 6 Einfügungen und 1 Löschungen.


Some tests require a wrong SSH_AUTH_SOCK value where no SSH agent can be
listening, but which is nonetheless syntactically valid.  Since Windows
named pipes have a specific address format, syntactically valid but
wrong values look different on The Annoying OS than they look on POSIX.
So fill in wrong values OS-specifically, not generally: on POSIX, we use
what is clearly a directory, and on The Annoying OS, we use the common
pipe name prefix (which is also a directory).
... ...
@@ -251,6 +251,8 @@ class SocketAddressAction(str, enum.Enum):
251 251
                 "SSH_AUTH_SOCK",
252 252
                 os.environ["SSH_AUTH_SOCK"] + "~"
253 253
                 if "SSH_AUTH_SOCK" in os.environ
254
+                else socketprovider.PIPE_PREFIX
255
+                if os.name == "nt"
254 256
                 else "/",
255 257
             )
256 258
         elif self == self.UNSET_ADDRESS:
... ...
@@ -822,7 +822,10 @@ class TestStoringConfigurationFailures:
822 822
             patch_suitable_ssh_keys=False,
823 823
         ) as monkeypatch:
824 824
             cwd = pathlib.Path.cwd().resolve()
825
-            monkeypatch.setenv("SSH_AUTH_SOCK", str(cwd))
825
+            monkeypatch.setenv(
826
+                "SSH_AUTH_SOCK",
827
+                socketprovider.PIPE_PREFIX if os.name == "nt" else str(cwd),
828
+            )
826 829
 
827 830
             def mangled_address(
828 831
                 *_args: Any, **_kwargs: Any
829 832