-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[WIP] Detect unix socket support at runtime #4762
Conversation
d733052
to
d9dd162
Compare
it might be interesting to invent a third state for the Makefile variable that could be used to build it in an "dynamic/autodetect" mode. I presume the default Windows build would rather have this hardcoded to avoid the extra delays, but as older versions of Windows become less common it might be worth switching to the "autodetect" mode and that way "mostly" enable this code. |
I have thought about that, but decided it wasn't all that necessary.
testing
with the hardcoded error message and
with the dynamicly detected error message, so I don't think we need to worry about the delays too much.
Seeing as Cygwin 3.5 is supposed to be released in a few weeks, Git for Windows 2.44 is likely the last Version to support Windows 7 and Windows 8. That leaves only Windows 8.1 and some old non-updated Windows 10 versions. |
There is also that "opensource windows" that usually tracks windows server 2003, plus all the server versions that are also most likely to have longer lifetimes IMHO. not sure if the "service" trick would work realiably in all of them for the detection code, and regardless, I presume that cygwin would rather need a different codepath since the UNIX socket implementation there predates the native version, |
I don't think Git for Windows ever supported reactOS. And I think upstream Git doesn't build there either. Edit: It is seemingly possible to tweak Git for Windows 2.10.0 to work on ReactOS
As far as Microsoft is concerned they get the same 10 years as the desktop versions. As far as Git for Windows is concerned they go out whenever we drop support for their corresponding desktop version. So when I said Windows 8.1 I also meant Windows Server 2012 R2.
It's more or less what Microsoft recommends, but I think I can set up some test VMs for that as well.
AFAIK Cygwin Git (and MSYS2 Git) is already built without |
I've tested this on Windows Server 2019 and 2012R2 and both behave like their desktop counterpart. I've also checked against the list of Nano Server APIs that all functions should be available in docker containers. |
83bb240
to
acb4425
Compare
Windows 10 build 17063 introduced support for unix sockets to Windows. bb390b1 (git-compat-util: include declaration for unix sockets in windows, 2021-09-14) introduced a way to build git with unix socket support on Windows, but you still had to decide at build time which Windows version the compiled executable was supposed to run on. We can detect at runtime wether the operating system supports unix sockets and act accordingly for all supported Windows versions. Signed-off-by: Matthias Aßhauer <mha1993@live.de>
acb4425
to
d8e64ac
Compare
I can't say that I have. |
I compiled a small test program: #include <stdio.h>
#include <string.h>
#include <errno.h>
int main(void)
{
printf("EINTR: %s\n", strerror(EINTR));
printf("EBADF: %s\n", strerror(EBADF));
printf("EACCES: %s\n", strerror(EACCES));
printf("EFAULT: %s\n", strerror(EFAULT));
printf("EINVAL: %s\n", strerror(EINVAL));
printf("EMFILE: %s\n", strerror(EMFILE));
printf("EWOULDBLOCK: %s\n", strerror(EWOULDBLOCK));
printf("EINPROGRESS: %s\n", strerror(EINPROGRESS));
printf("EALREADY: %s\n", strerror(EALREADY));
printf("ENOTSOCK: %s\n", strerror(ENOTSOCK));
printf("EDESTADDRREQ: %s\n", strerror(EDESTADDRREQ));
printf("EMSGSIZE: %s\n", strerror(EMSGSIZE));
printf("EPROTOTYPE: %s\n", strerror(EPROTOTYPE));
printf("ENOPROTOOPT: %s\n", strerror(ENOPROTOOPT));
printf("EPROTONOSUPPORT: %s\n", strerror(EPROTONOSUPPORT));
printf("EOPNOTSUPP: %s\n", strerror(EOPNOTSUPP));
printf("EAFNOSUPPORT: %s\n", strerror(EAFNOSUPPORT));
printf("EADDRINUSE: %s\n", strerror(EADDRINUSE));
printf("EADDRNOTAVAIL: %s\n", strerror(EADDRNOTAVAIL));
printf("ENETDOWN: %s\n", strerror(ENETDOWN));
printf("ENETUNREACH: %s\n", strerror(ENETUNREACH));
printf("ENETRESET: %s\n", strerror(ENETRESET));
printf("ECONNABORTED: %s\n", strerror(ECONNABORTED));
printf("ECONNRESET: %s\n", strerror(ECONNRESET));
printf("ENOBUFS: %s\n", strerror(ENOBUFS));
printf("EISCONN: %s\n", strerror(EISCONN));
printf("ENOTCONN: %s\n", strerror(ENOTCONN));
printf("ETIMEDOUT: %s\n", strerror(ETIMEDOUT));
printf("ECONNREFUSED: %s\n", strerror(ECONNREFUSED));
printf("ELOOP: %s\n", strerror(ELOOP));
printf("ENAMETOOLONG: %s\n", strerror(ENAMETOOLONG));
printf("EHOSTUNREACH: %s\n", strerror(EHOSTUNREACH));
printf("ENOTEMPTY: %s\n", strerror(ENOTEMPTY));
printf("EIO: %s\n", strerror(EIO));
return 0;
} This is the output:
Unfortunately that narrows down the list of errors it could be less than I would have liked. |
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 sometimes encounter ECONNREFUSED on Windows aswell, though. we should handle these cases like we do on non-windows systems. [1] git-for-windows#4762 (comment) This fixes git-for-windows#5314 Helped-by: M Hickford <mirth.hickford@gmail.com> Signed-off-by: Matthias Aßhauer <mha1993@live.de>
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 sometimes encounter ECONNREFUSED on Windows aswell, though. we should handle these cases like we do on non-windows systems. [1] git-for-windows#4762 (comment) This fixes git-for-windows#5314 Helped-by: M Hickford <mirth.hickford@gmail.com> Signed-off-by: Matthias Aßhauer <mha1993@live.de>
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 sometimes encounter ECONNREFUSED on Windows aswell, though. we should handle these cases like we do on non-windows systems. [1] git-for-windows#4762 (comment) This fixes git-for-windows#5314 Helped-by: M Hickford <mirth.hickford@gmail.com> Signed-off-by: Matthias Aßhauer <mha1993@live.de>
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 sometimes encounter ECONNREFUSED on Windows aswell, though. we should handle these cases like we do on non-windows systems. [1] git-for-windows#4762 (comment) This fixes git-for-windows#5314 Helped-by: M Hickford <mirth.hickford@gmail.com> Signed-off-by: Matthias Aßhauer <mha1993@live.de>
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 sometimes encounter ECONNREFUSED on Windows aswell, though. we should handle these cases like we do on non-windows systems. [1] git-for-windows#4762 (comment) This fixes git-for-windows#5314 Helped-by: M Hickford <mirth.hickford@gmail.com> Signed-off-by: Matthias Aßhauer <mha1993@live.de>
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 <mirth.hickford@gmail.com> Signed-off-by: Matthias Aßhauer <mha1993@live.de>
I still need to teach
t0301
to skip based on the runtime check and probably clean this up a little.Once this PR is finished, this fixes #3892