Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

credential-cache: handle ECONNREFUSED gracefully #5329

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rimrul
Copy link
Member

@rimrul rimrul commented Dec 22, 2024

I should probably add some tests for this.

@rimrul rimrul force-pushed the credential-cache-unknown-error branch 2 times, most recently from ff41d09 to 1059d6f Compare December 22, 2024 18:47
Copy link

@hickford hickford Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To distinguish the two identical error messages "unable to connect to cache daemon", consider changing the second to “unable to connect to spawned cache daemon”

@rimrul rimrul force-pushed the credential-cache-unknown-error branch 2 times, most recently from 7b24188 to 87d0f06 Compare December 28, 2024 11:52
We map WSAGetLastError() errors to errno errors in winsock_error_to_errno(),
but the MSVC strerror() implementation only produces "Unknown error" for
most of them. Produce some more meaningful error messages in these
cases.

Our builds for ARM64 link against the newer UCRT strerror() that does know
these errors, so we won't change the strerror() used there.

The wording of the messages is copied from glibc strerror() messages.

Reported-by: M Hickford <[email protected]>
Signed-off-by: Matthias Aßhauer <[email protected]>
The part about keeping the original error number hasn't been accurate since
commit c11f75c (mingw: make sure errno is set correctly when socket
operations fail, 2019-11-25) and the part about strerror() not knowing
about these errors is untrue since the previous commit.

Signed-off-by: Matthias Aßhauer <[email protected]>
In 245670c (credential-cache: check for windows specific errors, 2021-09-14)
we concluded that on Windows we would always encounter ENETDOWN where we
would expect ECONNREFUSED on POSIX systems, when connecting to unix sockets.
As reported in [1], we do encounter ECONNREFUSED on Windows if the
socket file doesn't exist, but the containing directory does and ENETDOWN if
neither exists. We should handle this case like we do on non-windows systems.

[1] git-for-windows#4762 (comment)

This fixes git-for-windows#5314

Helped-by: M Hickford <[email protected]>
Signed-off-by: Matthias Aßhauer <[email protected]>
@rimrul rimrul force-pushed the credential-cache-unknown-error branch from 87d0f06 to a1ba9f8 Compare December 28, 2024 12:22
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.

credential-cache error "fatal: unable to connect to cache daemon: Unknown error"
2 participants