-
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
Fail to access https://github.com/* if portable version is unpacked in a network share. #3266
Comments
This looks broken. What does Probably something like That probably gets converted to |
It tells nothing (empty line): c:\Temp>y:\user\tmp\PortableGit-2.32.0-64-bit\bin\git config http.sslcainfo c:\Temp> |
I can reproduce (using my WSL setup to emulate a network drive, via A good workaround seems to be:
|
The error message "error setting certificate verify locations" does not actually come from Git, but from cURL: https://github.com/curl/curl/blob/8fa0a298c65548615a86a042b2661d637c532699/lib/vtls/openssl.c#L3087-L3090 However, we do not set the location of the certificate bundle explicitly, it is set implicitly by cURL itself. Or, to be more precise, by our version of it. And the problem seems to be that the first double-slash is turned into a single slash. Which makes me think that the culprit is here: https://github.com/git-for-windows/MINGW-packages/blob/dd2a97114e7f01807dd33fd163156c28e5a3e35a/mingw-w64-curl/0001-Make-cURL-relocatable.patch#L158-L163 I could imagine that the problem would be solved by replacing path_p = path; with path_p = path + !!*path; /* skip first character, if any, to handle UNC paths correctly */ |
The workaround works! |
I am testing a fix right now. It looks essentially like this: diff --git a/mingw-w64-curl/0001-Make-cURL-relocatable.patch b/mingw-w64-curl/0001-Make-cURL-relocatable.patch
index 3c5bfd935..71b82a2e8 100644
--- a/mingw-w64-curl/0001-Make-cURL-relocatable.patch
+++ b/mingw-w64-curl/0001-Make-cURL-relocatable.patch
@@ -26,10 +26,10 @@ Signed-off-by: Johannes Schindelin <[email protected]>
configure.ac | 1 +
lib/Makefile.inc | 2 +
lib/curl_config.h.in | 3 +
- lib/pathtools.c | 556 +++++++++++++++++++++++++++++++++++++++++++
+ lib/pathtools.c | 562 +++++++++++++++++++++++++++++++++++++++++++
lib/pathtools.h | 57 +++++
lib/url.c | 26 +-
- 6 files changed, 644 insertions(+), 1 deletion(-)
+ 6 files changed, 650 insertions(+), 1 deletion(-)
create mode 100644 lib/pathtools.c
create mode 100644 lib/pathtools.h
@@ -81,10 +81,10 @@ index 89a1d195a..8c8305754 100644
diff --git a/lib/pathtools.c b/lib/pathtools.c
new file mode 100644
-index 000000000..c09458e95
+index 000000000..53d0db00b
--- /dev/null
+++ b/lib/pathtools.c
-@@ -0,0 +1,556 @@
+@@ -0,0 +1,562 @@
+/*
+ .Some useful path tools.
+ .ASCII only for now.
@@ -156,7 +156,7 @@ index 000000000..c09458e95
+ *path_p = '/';
+ }
+ /* Replace any '//' with '/' */
-+ path_p = path;
++ path_p = path + !!*path; /* skip first character, if any, to handle UNC paths correctly */
+ while ((path_p = strstr (path_p, "//")) != NULL)
+ {
+ memmove (path_p, path_p + 1, path_size--);
@@ -277,6 +277,12 @@ index 000000000..c09458e95
+ char * result = path;
+ char * result_p;
+ char const ** toks;
++ if (path[0] == '/' && path[1] == '/') {
++ /* preserve UNC path */
++ path++;
++ in_size--;
++ result++;
++ }
+ sanitise_path(result);
+ result_p = result;
+ |
The code to make cURL relocatable simplifies/normalizes paths, e.g. reducing multiple forward slashes to a single one. This is okay in general, but at the beginning of the path, a double slash has a special meaning: it denotes a UNC path of the form //<host>/<path>. It would therefore be a mistake to reduce those first two slashes to a single one: otherwise it would refer to the absolute path relative to the current directory's drive. Let's preserve the double slashes. This fixes git-for-windows/git#3266 Signed-off-by: Johannes Schindelin <[email protected]>
The code to make cURL relocatable simplifies/normalizes paths, e.g. reducing multiple forward slashes to a single one. This is okay in general, but at the beginning of the path, a double slash has a special meaning: it denotes a UNC path of the form //<host>/<path>. It would therefore be a mistake to reduce those first two slashes to a single one: otherwise it would refer to the absolute path relative to the current directory's drive. Let's preserve the double slashes. Reported-in: git-for-windows/git#3266 Signed-off-by: Johannes Schindelin <[email protected]>
Remote HTTPS repositories [could not be accessed from within portable Git installed into a network share](git-for-windows/git#3266). This [has been fixed](git-for-windows/MINGW-packages#51). Signed-off-by: Johannes Schindelin <[email protected]>
The code to make cURL relocatable simplifies/normalizes paths, e.g. reducing multiple forward slashes to a single one. This is okay in general, but at the beginning of the path, a double slash has a special meaning: it denotes a UNC path of the form //<host>/<path>. It would therefore be a mistake to reduce those first two slashes to a single one: otherwise it would refer to the absolute path relative to the current directory's drive. Let's preserve the double slashes. Reported-in: git-for-windows/git#3266 Signed-off-by: Johannes Schindelin <[email protected]>
Setup
defaults?
to the issue you're seeing?
Unpacked into a network share. The same package unpacked in local drive works fine.
Details
CMD, bash
Minimal, Complete, and Verifiable example
this will help us understand the issue.
Success cloning
Cloning into 'git'...
fatal: unable to access 'https://github.com/git/git/': error setting certificate verify locations: CAfile: /fileserver/share/user/tmp/PortableGit-2.32.0-64-
bit/mingw64/ssl/certs/ca-bundle.crt CApath: none
URL to that repository to help us with testing?
Any repo with https:// URL
The text was updated successfully, but these errors were encountered: