git/list[1] front-page[2] threads[3] people[4] search[5] about
 

tests broken with curl-8.7.0

From
Jeff King <peff@peff.net>
Date
Mar 30, 2024, 00:02 UTC
Message-ID
<20240330000212.GA1261238@coredump.intra.peff.net>

I noticed some http-related failures in the test suite on my Debian unstable system, which recently got an upgraded curl package. It looks like it's related to cases where we use the remote-curl helper in "connect" mode (i.e., protocol v2) and the http buffer is small (requiring us to stream the data to curl). Besides just running t5551, an easy reproduction is:

  [this works]
  $ git ls-remote https://git.kernel.org/pub/scm/git/git.git | wc -l
  1867
  [this doesn't]
  $ git -c http.postbuffer=65536 ls-remote https://git.kernel.org/pub/scm/git/git.git
  fatal: expected flush after ref listing

The error message comes from ls-remote itself, which was expecting a FLUSH packet from the remote. Instead it gets the RESPONSE_END from remote-curl (remember that in connect mode, remote-curl is just ferrying bytes back and forth between ls-remote and the server).

It works with older versions of libcurl, but not 8.7.0 (or 8.7.1). Bisecting in libcurl points to 9369c30cd (lib: Curl_read/Curl_write clarifications, 2024-02-15).

Running with GIT_TRACE_CURL=1 shows weirdness on the POST we send to issue the ls-refs command. With older curl, I see this:

  => Send header: POST /pub/scm/git/git.git/git-upload-pack HTTP/1.1
  => Send header: Host: git.kernel.org
  => Send header: User-Agent: git/2.44.0.789.g252ee96bc5.dirty
  => Send header: Accept-Encoding: deflate, gzip
  => Send header: Content-Type: application/x-git-upload-pack-request
  => Send header: Accept: application/x-git-upload-pack-result
  => Send header: Git-Protocol: version=2
  => Send header: Transfer-Encoding: chunked
  => Send header:
  => Send data: 14..0014command=ls-refs...
  => Send data: 2a..002aagent=git/2.44.0.789.g252ee96bc5.dirty..
  [and so on until...]
  == Info: Signaling end of chunked upload via terminating chunk.
But with the broken version, I get:
  => Send header: POST /pub/scm/git/git.git/git-upload-pack HTTP/1.1
  => Send header: Host: git.kernel.org
  => Send header: User-Agent: git/2.44.0.789.g252ee96bc5.dirty
  => Send header: Accept-Encoding: deflate, gzip, br, zstd
  => Send header: Content-Type: application/x-git-upload-pack-request
  => Send header: Accept: application/x-git-upload-pack-result
  => Send header: Git-Protocol: version=2
  => Send header: Transfer-Encoding: chunked
  => Send header:
  => Send data, 0000000014 bytes (0x0000000e)
  => Send data: 4..0014..0....
  == Info: upload completely sent off: 14 bytes

So we only get the first 4 bytes, and then we quit (the double mention of 14 is confusing, but I think it is both the size of the pkt-line ("command=ls-refs\n") but also the length of the 4-byte string when framed with chunked transfer-encoding). Those 4 bytes are the first thing returned by rpc_out(), which we use as our CURLOPT_READFUNCTION.

It's possible that we're doing something wrong with our read/write function callbacks. But I don't see how; we say "here's 4 bytes", but then we never get called again. It's like curl is giving up on trying to read the post input early for some reason.

I'm not sure how to dig further. That commit is pretty big and scary. I did check that the tip of master in curl.git is still affected (I'd hoped maybe the 0-length write fixes in b30d694a027 would be related, but that's not it).

Ideas?
-Peff
Next: Daniel Stenberg
Message 1 of 15 in “tests broken with curl-8.7.0”
  1. Jeff KingMar 30, 2024
  2. Daniel StenbergMar 30, 2024
  3. 0/2 git+curl 8.7.0 workaroundJeff King, Apr 2, 2024
  4. 1/2 http: reset POSTFIELDSIZE when clearing curl handleJeff King, Apr 2, 2024
  5. Junio C HamanoApr 2, 2024
  6. Jeff KingApr 3, 2024
  7. Patrick SteinhardtApr 3, 2024
  8. Patrick SteinhardtApr 3, 2024
  9. Jeff KingApr 3, 2024
  10. 2/2 INSTALL: bump libcurl version to 7.21.3Jeff King, Apr 2, 2024
  11. rsbecker@nexbridge.comApr 2, 2024
  12. Jeff KingApr 2, 2024
  13. 3/2 remote-curl: add Transfer-Encoding header only for older curlJeff King, Apr 5, 2024
  14. Daniel StenbergApr 5, 2024
  15. Junio C HamanoApr 5, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.