Re: [PATCH 2/3] http: prefer CURLOPT_SEEKFUNCTION to CURLOPT_IOCTLFUNCTION
- From
Jeff King <peff@peff.net>
- Date
- Jan 15, 2023, 23:17 UTC
- Message-ID
- <Y8SJoulYtKnfRgrO@coredump.intra.peff.net>
- In-Reply-To
- <xmqqilh7fp4s.fsf@gitster.g>
On Sun, Jan 15, 2023 at 01:45:39PM -0800, Junio C Hamano wrote:
Show 20 quoted lines
> Jeff King <peff@peff.net> writes:
>
> > The IOCTLFUNCTION option has been deprecated, and generates a compiler
> > warning in recent versions of curl. We can switch to using SEEKFUNCTION
> > instead. It was added in 2008 via curl 7.18.0; our INSTALL file already
> > indicates we require at least curl 7.19.4.
> > ...
> > + if (offset < 0 || offset >= buffer->buf.len) {
> > + error("curl seek would be outside of buffer");
> > + return CURL_SEEKFUNC_FAIL;
> > }
> > +
> > + buffer->posn = offset;
> > + return CURL_SEEKFUNC_OK;
> > }
>
> Now we depend on having at least cURL 7.19.5 because
> CURL_SEEKFUNC_{FAIL,OK} are not available before that version.
>
> cf. https://github.com/curl/curl/blob/master/docs/libcurl/symbols-in-versions#L127Ugh. I did not even check that, because why would anyone introduce the return values in a separate version! ;)
> Which is fine, as 7.19.5 is from May 2009 that is old enough. We > just need to update the place where you got the 7.19.4 above from.
OK, if we are all right with bumping the version, I can squash that in. The other option is to fall back to the obvious 0/1 for OK/FAIL, which is what curl does. But that feels awfully hacky, and it would only be used if you were at _exactly_ 7.19.4. So I prefer the bump if it's acceptable.
diff --git a/INSTALL b/INSTALL index 3344788397..d5694f8c47 100644 --- a/INSTALL +++ b/INSTALL @@ -139,7 +139,7 @@ Issues of note: not need that functionality, use NO_CURL to build without it. - Git requires version "7.19.4" or later of "libcurl" to build + Git requires version "7.19.5" or later of "libcurl" to build without NO_CURL. This version requirement may be bumped in the future. -Peff