On Fri, Sep 10, 2021 at 01:04:25PM +0200, Ævar Arnfjörð Bjarmason wrote: > Version 1 of this had a really bad bug where we'd effectively make all > supported curl versions act like 7.19.4, i.e. the oldest supported > version except for a couple of our supported features. This is because > most of the things checked with the "ifdef" checks are enum fields, > not macros. So basically the "devil's advocate" Jeff King pointed out > in [2] was already the case. Oops! Oops. :) Well, I'm glad I mentioned it, then (I really was just playing devil's advocate). It does seem a little scary that we'd compile without all of these features and not even notice it. I guess it's hard to test for those features when we don't know for sure that our libcurl supports them. We could perhaps make the tests optional, but how do we set up the prereqs? Version checks based on "curl --version" or even "pkg-config --modversion libcurl" seems error-prone. The curl binary might not match the library we used, or the user might have given us a specific libcurl to use rather than the pkg-config version. We could teach Git to tell us which features it thinks curl supports, but that's depending on the very thing we're trying to test. We could have Git output the LIBCURL_VERSION_NUM it saw at build time, but then we're just implementing the same "if version > X, we have this feature" logic now in the test suite. So I dunno. I do not have any clever solution that would have caught this automatically without creating an even bigger maintenance headache. (Though for other reasons, it might be nice to report the curl version from "git version --build-options". This is a bit tricky because we avoid linking at libcurl at all in the main binary. Definitely orthogonal to your series, anyway). > This means that anyone on an older distro with backported features > will need to -DGIT_CURL_HAVE_* if their version of curl supports some > of these via a backport, not ideal, but an acceptable trade-off. If we > cared about this we could have some "detect-curl" script similar to my > proposed "detect-compiler"[3] (or another homegrown autoconf > replacement). I think that's acceptable. This should be rare, and they can always set CFLAGS appropriately. -Peff