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

update-git-for-windows seems to be broken on 2.45.2.vfs.0.0 #655

Closed
tiagomacarios opened this issue Jun 5, 2024 · 10 comments · Fixed by git-for-windows/MINGW-packages#122

Comments

@tiagomacarios
Copy link
Member

z:\o2\src>git --version
git version 2.45.2.vfs.0.0

z:\o2\src>git update-git-for-windows -y
curl: (43) A libcurl function was given a bad argument

z:\o2\src>git --version
git version 2.45.0.vfs.0.0

z:\o2\src>git update-git-for-windows -y
Git 2.45.0.vfs.0.0 (64-bit)
Up to date

@dscho
Copy link
Member

dscho commented Jun 6, 2024

This seems to be caused by a bug in cURL where it does not handle the --write-out option correctly:

$ sh -x $(which git-update-git-for-windows)
+ use_recently_seen=no
+ test --test-version-compare '!=' ''
+ update_git_for_windows
[...]
+ echo 'Update 2.45.2.windows.1 is available'
Update 2.45.2.windows.1 is available
++ http_get https://api.github.com/repos/git-for-windows/git/releases/latest
++ url=https://api.github.com/repos/git-for-windows/git/releases/latest
+++ mktemp -t gfw-httpget-XXXXXXXX.txt
++ output=/tmp/gfw-httpget-ruMLqjGG.txt
+++ curl --silent --show-error --output /tmp/gfw-httpget-ruMLqjGG.txt --write-out '%{http_code}' https://api.github.com/repos/git-for-windows/git/releases/latest
curl: (43) A libcurl function was given a bad argument
++ code=000
++ return 43
+ releases=
+ return

If I remove the --write-out '%{http_code}' option, the command succeeds (but of course the HTTP code is no longer reported).

curl/curl#13845 looks closely related, and I am currently building cURL v8.8.0 with curl/curl@9aa1d41 applied on top, to see whether this fixes the bug.

@dscho
Copy link
Member

dscho commented Jun 6, 2024

I am currently building cURL v8.8.0 with curl/curl@9aa1d41 applied on top, to see whether this fixes the bug.

Sadly, it does not address the bug.

@dscho
Copy link
Member

dscho commented Jun 6, 2024

I am currently building cURL v8.8.0 with curl/curl@9aa1d41 applied on top, to see whether this fixes the bug.

Sadly, it does not address the bug.

Aha! I managed to test with the original DLL the entire time because I failed to realize that the custom build I ran in place would pick up /mingw64/bin/libcurl-4.dll instead. Once I overwrite that with the just-built binary, it does fix the bug!

dscho added a commit to dscho/MINGW-packages that referenced this issue Jun 6, 2024
The `git update-git-for-windows` command is a Unix Shell script that
relies heavily on `curl`; For example, it calls:

  curl --silent --show-error --output /tmp/gfw-httpget-ruMLqjGG.txt \
    --write-out '%{http_code}' \
    https://api.github.com/repos/git-for-windows/git/releases/latest

This worked well until cURL v8.8.0 was integrated. With the Secure
Channel backend, the invocation would fail with this error message:

  curl: (43) A libcurl function was given a bad argument

The same issue had been reported for a different SSL backend:
curl/curl#13845. Conveniently, all we have to
do is to Backport the fix from the PR that addressed that ticket to
address the bug at hand.

This fixes microsoft/git#655.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho added a commit to dscho/MINGW-packages that referenced this issue Jun 6, 2024
The `git update-git-for-windows` command is a Unix Shell script that
relies heavily on `curl`; For example, it calls:

  curl --silent --show-error --output /tmp/gfw-httpget-ruMLqjGG.txt \
    --write-out '%{http_code}' \
    https://api.github.com/repos/git-for-windows/git/releases/latest

This worked well until cURL v8.8.0 was integrated. With the Secure
Channel backend, the invocation would fail with this error message:

  curl: (43) A libcurl function was given a bad argument

The same issue had been reported for a different SSL backend:
curl/curl#13845. Conveniently, all we have to
do is to Backport the fix from the PR that addressed that ticket to
address the bug at hand.

This fixes microsoft/git#655.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@derrickstolee
Copy link
Collaborator

Reopening until new release bits can be generated.

@derrickstolee derrickstolee reopened this Jun 6, 2024
@dscho
Copy link
Member

dscho commented Jun 6, 2024

Reopening until new release bits can be generated.

They are generated as we speak ;-)

@derrickstolee
Copy link
Collaborator

NORTHAMERICA+dstolee@stoleedesk2023 MINGW64 ~
$ git update-microsoft-git
curl: (43) A libcurl function was given a bad argument

NORTHAMERICA+dstolee@stoleedesk2023 MINGW64 ~
$ git version
git version 2.45.2.vfs.0.1

Doesn't seem to have stuck.

@dscho
Copy link
Member

dscho commented Jun 6, 2024

Doesn't seem to have stuck.

Indeed. I had to kicked off another sync run in git-sdk-64 that updated curl to the -2 version, and then I re-ran the windows_pkg job. The release workflow run is now completing, and I will test it immediately once it's done.

@dscho
Copy link
Member

dscho commented Jun 6, 2024

Now, that's better:

image

There's room for improvement (Portable Git should decline to run update-git-for-windows, for example), but the bug is gone.

@derrickstolee
Copy link
Collaborator

I confirmed this worked for me, too. In my opinion, this issue can be closed when 2.45.2.vfs.0.1 is available as a pre-release, to match the exposure of 2.45.2.vfs.0.0.

@dscho
Copy link
Member

dscho commented Jun 6, 2024

Published!

@dscho dscho closed this as completed Jun 6, 2024
ammyk9 pushed a commit to ammyk9/MINGW-packages that referenced this issue Aug 8, 2024
The `git update-git-for-windows` command is a Unix Shell script that
relies heavily on `curl`; For example, it calls:

  curl --silent --show-error --output /tmp/gfw-httpget-ruMLqjGG.txt \
    --write-out '%{http_code}' \
    https://api.github.com/repos/git-for-windows/git/releases/latest

This worked well until cURL v8.8.0 was integrated. With the Secure
Channel backend, the invocation would fail with this error message:

  curl: (43) A libcurl function was given a bad argument

The same issue had been reported for a different SSL backend:
curl/curl#13845. Conveniently, all we have to
do is to Backport the fix from the PR that addressed that ticket to
address the bug at hand.

This fixes microsoft/git#655.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
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 a pull request may close this issue.

3 participants