]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
15 months agoGHA/windows: enable libssh in !ssl MSVC job 14233/head
Tal Regev [Fri, 19 Jul 2024 09:17:55 +0000 (12:17 +0300)] 
GHA/windows: enable libssh in !ssl MSVC job

Closes #14232

15 months agoGHA/windows: enable libidn2 in !ssl MSVC job
Tal Regev [Tue, 16 Jul 2024 17:10:26 +0000 (20:10 +0300)] 
GHA/windows: enable libidn2 in !ssl MSVC job

Closes #14200

15 months agoGHA/macos: improve, fix gcc/llvm, add new test matrix
Viktor Szakats [Wed, 17 Jul 2024 23:09:04 +0000 (01:09 +0200)] 
GHA/macos: improve, fix gcc/llvm, add new test matrix

This PR began as an attempt to drop GCC support, after repeated reports
on fallouts when trying to use it on macOS.

Then it transformed into a 3-week project turning up the issues causing
the fallouts, ending up including llvm and all available Xcode / macOS
SDK, macOS runner image, build tools and compiler vendors and versions.
Accumulating 400 sub-commits.

I developed and tested all fixes under this PR, then merged them as
separate patches.

This PR retained CI jobs updates, extensively reworking and extending
them: [1]

At first it seemed GCC and the Apple SDK is "naturally" growing more
incompatible, as Apple added further non-standard features to their
headers. This is partly true, but reality is more complicated.

Besides some issues local to curl, there were bugs in Apple SDK
headers, Homebrew GCC builds, feature missing in the old llvm version
pre-installed on GitHub CI runner images, and subtle incompatibilities
between GCC and llvm/clang when handling language extensions.

Resulting compiler errors seldom pointed to a useful direction, and
internet search was silent about these issues too. Thus, I had to peel
them off layer by layer, using trial and error, and by recognizing
patterns of failures accross 150-200 builds combinations. Exposing
configure logs, and curl_config.h in the CI logs helped too.

1. GCC header compatibility layer ("hack" as GCC calls it)

The toughest issue is GCC's built-in compatibility layer:
  https://github.com/gcc-mirror/gcc/tree/master/fixincludes

This patch layer is further patched by a "Darwin compatibility" project
applied on top by Homebrew GCC via:
  https://github.com/iains/gcc-12-branch
  https://github.com/iains/gcc-13-branch
  https://github.com/iains/gcc-14-branch

The hack layer is designed in a way that breaks more builds than it
fixes, esp. in context of GHA runners. The idea is to build GCC
specifically for the SDK for the target macOS version. The problem with
this approach is that the Xcode + SDK installed on the local/CI machine
often does not match with the SDK used on while building GCC on
Homebrew's build machines. In these cases the GCC compatibility layer
turns into an "uncompatibility" layer and consistently breaks builds.
curl cannot offer a fix for this, because the solution (I found) is to
patch the toolchain on the local machine. I implemented this for our CI
builds and curl-for-win. In other case the user must do this patching
manually, or choose a compatible GCC + Xcode/SDK combination.

An upstream fix doesn't seem trivial either, because the issue is
ingrained in the compatibility layer's design. Offering an `-fapplesdk`
(or recognizing `-target`) option and/or fixing them within the compiler
would seem like a more robust option, and also how mainline llvm solves
this.

Here's a table summarizing the GCC + SDK combinations and curl build
failures: [2]

More info: https://github.com/curl/curl/issues/10356#issuecomment-2222734103

db135f8d7207b20d531e7e2100a49f3e16bdcfab #14119 macos: add workaround for gcc, non-c-ares, IPv6, compile error
Ref: https://github.com/curl/curl-for-win/commit/e2db3c475f5981352e6e6a79854a255805b28deb
Ref: https://github.com/curl/curl-for-win/commit/f5c58d7fef78e972be33ca2355dcb42ba56622a6

2. Homebrew GCC's `availability` extension

A recent minor Homebrew GCC upgrade caused major breakage. The "Darwin
compatibility" patch applied to GCC implemented the `availability`
compiler attribute in GCC. Apple SDK detected this and enabled using
them, but as it turns out GCC accepts compiler attributes with slightly
different rules than llvm/clang, and how the Apple SDK uses them,
breaking builds.

Affected Homebrew GCC versions are: 12.4.0, 13.3.0 and 14.1.0.

Possibly tracked here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796
More info: https://github.com/llvm/llvm-project/issues/81767

Commit implementing the `availability` macro:
gcc-12: https://github.com/iains/gcc-12-branch/commit/fd5530b7cb0012bf4faeddd45e13054a1dfa6783
gcc-13: https://github.com/iains/gcc-13-branch/commit/cb7e4eca68cfc4763474e2eb0935a844458842a8
gcc-14: https://github.com/iains/gcc-14-branch/commit/ff62a108865a6403f5017380d7018250c1d3306f

That applied to Homebrew GCC (12.4.0):
https://github.com/Homebrew/homebrew-core/commit/b904223d9893f62bec2a8f7483bf5992747fc6c7#diff-89dd0b4176eca7fcc24b591943509bf8a8d6ea904d71e5dfcd6b78fed62fc574R44-R48

Ref: #13700
More info: https://github.com/curl/curl/pull/14091#issuecomment-2222703468

e91fcbac7d86292858718a0bfebad57978761af4 #14155 macos: undo `availability` macro enabled by Homebrew gcc

3. Proprietary Apple SDK macros

Apple SDK expects certain macros predefined by the compiler. Missing
them may causes odd issues. Mainline llvm is keeping up with Apple
clang, but it needs a fresh version, while the one installed on GitHub
runners is old (v15). I patched these in `lib/curl_setup.h`.

baa3270846b2a7307cbd0dd5c02c4e5f00e388dd #14134 build: fix llvm 16 or older + Xcode 15 or newer, and gcc

4. Apple SDK header bug

Without certain predefined macros, SDK headers can take a codepath where
it mis-defines its own `TARGET_OS_OSX` macro, which make it break its
own headers later. I patched it in `lib/curl_setup.h`.

ff784af461175584c73e7e2b65af00b1a5a6f67f #14159 build: fix llvm 17 and older + macOS SDK 14.4 and newer

5. `TargetConditionals.h` requires `sys/types.h`

Fixed in curl. It caused feature-detection failurs with autotools, and
could break builds in certain configurations.

e1f6192939c9c5ab2310b60bedf4c07d635193f6 #14130 configure: fix `SystemConfiguration` detection

6. Differences between autotools and CMake compiler options

Fixed it by syncing compiler warning options.

59cadacfcc1d39472245979cdbd614c7a9af6f0d #14128 build: sync warning options between autotools, cmake & compilers

7. Differences between autotools and CMake dependency detection

Fixed it by improving detection of libidn2, with some more fixes
pending for the next feature window.

f43adc2c4978f7f82a359e89186e58a31d17b0ad #14137 cmake: detect `libidn2` also via `pkg-config`
Ref: #14136 cmake: detect `nghttp2` via `pkg-config`, enable by default

8. libidn2 detection bug with CMake

Fixed the root cause and also the trigger in the CI config.

764fbabf6ed4c1d36c0ab2033ac8df52d9923cd7 #14175 cmake: fix builds with detected libidn2 lib but undetected header

9. Suppressed compiler warnings inside Apple-specific curl code

Fixed these warnings, which allowed to stop silencing them.

b05dc7eb3592305de9fa85640767f3dd2a8d4c93 #14122 sectransp: fix `HAVE_BUILTIN_AVAILABLE` checks to not emit warnings
5fa534b0dacdc120aaab0766047e0ecac37be4b3 #14162 sectransp: fix clang compiler warnings, stop silencing them

10. CMake mis-detecting a CA bundle path on macOS

d2ef6255f4a040397d2f40ab7cbf65a203201cd9 #14182 cmake: sync CA bundle/path detection with autotools

11. Failure to build tests with LibreSSL or wolfSSL with CMake

Fixed by dropping unnecessary includes, makign test builds dependent
on dependency headers.

3765d75ce47b66289f946382b649d0e99389dc77 #14172 cmake: fix building `unit1600` due to missing `ssl/openssl.h`

12. curl tests with CMake

curl's CMake was missing bits for running the C preprocessor accurately.
It made tests 1119 and 1167 fail. I implemented the missing bits.

efc2c5184d008fe2e5910fd03263e1ab0331d4e6 #14124 tests: include current directory when running test Perl commands
c09db8b51b88ee6ad55bd637dcb4b47678e30906 #14129 cmake: create `configurehelp.pm` like autotools does
67cc1e3400b77536a3ca529c986247e1ef985e6e #14125 test1119: adapt for `.md` input

13. GCC missing `__builtin_available()` support

curl source code assumes this is available to enable certain codepaths.
It's also intermixed with monotonic timer support.

14. Monotonic timer support with GCC

Detected by GCC, while it probably shouldn't be. llvm/clang detects it
depending on target OS version. I've been playing with this, but so far
without a conclusion or fix.

15. Runtime/test failures with GCC

I couldn't find the reason for most of this. A bunch of RTSP tests fail
with GCC. SecureTransport + HTTP/2 is failing a bunch of tests. With
OpenSSL it fails two of those. SecureTransport builds also fail one DoH
test.

16. Runtime/test failure in llvm/clang

AppleIDN support received a fix with two more remaining.

fd0250869f7837e4a48d7e6f54cc0801ad3820e8 #14179 #14176 IDN: fix ß with AppleIDN

17. Other issues found and fixed while working on this:

2c15aa5765900d4351e733671a1c8c3785beee1a        GHA/macos: delete misplaced `CFLAGS`, drop redundant CMake option
80fb7c0bef209735ab352bf4afa31193a7bc65f1 #14126 configure: limit `SystemConfiguration` test to non-c-ares, IPv6 builds
cfd6f43d6ca7e57670b422bab7bbf10221a2cf3e #14127 build: tidy up `__builtin_available` feature checks (Apple)
bae555359979016999a9425a2d489f219a78abdd #14174 runtests: show name and keywords for failed tests in summary
09cdf7e5315711dea4ce7dcf5d99a4d41e7f658b #14178 cmake: delete unused `HAVE_LIBSSH2`, `HAVE_LIBSOCKET` macros
d3595c74fab829f07ef44da1b7fc2f5668767020 #14186 configure: CA bundle/path detection fixes
58772b0e082eda333e0a5fc8fb0bc7f17a3cd99c #14187 runtests: set `SOURCE_DATE_EPOCH` to fix failing around midnight
18f1cd7a77c4beecfd977d43f55634eb593ac99e #14183 tests: sync feature names with `curl -V`
4c22d97be786ed801e050da6872dd3143d6d0a59 #14181 build: use `#error` instead of invalid syntax

Pending merges:

- #14185 runtests: fold test details for GitHub CI runs
- #14197 cmake: grab-bag of tidy-ups
- #14196 configure: limit `__builtin_available` test to Darwin

Summary:

In general GCC doesn't seem to be a good fit with curl and macOS for
now. These "lucky" combinations (GitHub Actions runner) will build out
of the box now: macos-14 + Xcode 15.0.1 + gcc-11, gcc-12, gcc-14. The
rest builds with the ugly workaround in place, but all this still leaves
some runtime issues.

More info and links in the commit messages and source code.

[1]: This PR:
- add info about target OS version requirements per feature, with OS
  names and release years.
- stop using `-Wno-deprecated-declarations` to suppress warnings.
- use `LDFLAGS=-w` to suppress 'object file was built for newer macOS
  version than being linked' warnings.
  (there were tens of thousands of them in some jobs)
- allow overriding Xcode version in all jobs.
- improve job names.
- abbreviate CMake as CM, autotools as AM for more compact job names.
- shorten job names by using `!` instead of `no-` and `non-`.
- bump parellel tests to 10 (from 5).
- drop using `--enable-maintainer-mode` `./configure` option.
- add gcc-12 no-ssl, autotools job with tests, ignore failing test
  results. (It's not yet clear why gcc-12 builds have different runtime
  results than clang/llvm ones.)
- add comments with OS names and release years next to version numbers,
  e.g. 10.15  # Catalina (2019)
- fix broken gcc-12 SecureTransport build.
- show compiler, Xcode, SDK, gcc hack SDK versions, Homebrew
  preinstalled packages and C compiler predefined macros for each job.
  Useful for debugging all the strange problems these builds might have.
- merge brew bundle and install steps.
- move step names to the top.
- dump configure log for both cmake and autotools also for successful
  builds. Useful for debugging.
- dump curl_config.h in short (sorted #defines) and full form.
- add support for the mainline llvm compiler.
- set sysroot for gcc and llvm.
- add timeout for cmake jobs.
- add new job matrix: combinations
  It supports building all possible compiler, runner image, Xcode/SDK
  combinations, with cmake and autotools, target OS versions and with or
  without SecureTransport. It's quick. GHA limits the maximum number of
  matrix jobs at 256.
  I used this as a test-rig to fix the macOS build fallouts with gcc and
  llvm.
  I settled with 16 jobs, trying to maximize fallout coverage.
- implement hack to make Homebrew gcc work with all available SDKs.
- add handy mini-table about Xcode / SDK versions, OS names, years for
  each GHA images, with the defaults.
- add tests for cmake jobs.
- make cmake config hack to link GnuTLS less intrusive.
- stop ignoring test 1452, seems fine now.
- fix to enable libpsl in autotools builds.
- enable libpsl in cmake builds.
- add an llvm job with tests (both autotools and cmake).
- delete similar macOS jobs from Circle CI. GHA is now arm64 too.

[2]: Homebrew GCC vs GHA runner images vs curl builds:
```
macOS      Xcode   gcc         gcc SDK hacks      Xcode SDK   SDK major Build Compile
           (*def)  (Homebrew)  (CommandLineTools)             versions        error
--------  -------- ----------  ------------------ ----------  --------- ----- ---------------------
macos-12   13.1    GCC 11.4.0  MacOSX12           MacOSX12.0
macos-12   13.2.1  GCC 11.4.0  MacOSX12           MacOSX12.1
macos-12   13.3.1  GCC 11.4.0  MacOSX12           MacOSX12.3
macos-12   13.4.1  GCC 11.4.0  MacOSX12           MacOSX12.3
macos-12   14.0.1  GCC 11.4.0  MacOSX12           MacOSX12.3
macos-12   14.1    GCC 11.4.0  MacOSX12           MacOSX13.0  MISMATCH  FAIL  /Applications/Xcode_14.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/object.h:275:1: error: expected ';' before 'extern'
macos-12  *14.2    GCC 11.4.0  MacOSX12           MacOSX13.1  MISMATCH  FAIL  /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/object.h:275:1: error: expected ';' before 'extern'
macos-13   14.1    GCC 11.4.0  MacOSX13           MacOSX13.0
macos-13   14.2    GCC 11.4.0  MacOSX13           MacOSX13.1
macos-13   14.3.1  GCC 11.4.0  MacOSX13           MacOSX13.3
macos-13  *15.0.1  GCC 11.4.0  MacOSX13           MacOSX14.0  MISMATCH  FAIL  /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/queue.h:103:1: error: unknown type name 'dispatch_queue_t'
macos-13   15.1    GCC 11.4.0  MacOSX13           MacOSX14.2  MISMATCH  FAIL  /Applications/Xcode_15.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/queue.h:103:1: error: unknown type name 'dispatch_queue_t'
macos-13   15.2    GCC 11.4.0  MacOSX13           MacOSX14.2  MISMATCH  FAIL  /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/queue.h:103:1: error: unknown type name 'dispatch_queue_t'
macos-14   14.3.1  GCC 11.4.0  MacOSX14           MacOSX13.3  MISMATCH  FAIL  /Users/runner/work/curl/curl/bld/lib/curl_config.h:792:19: error: two or more data types in declaration specifiers
macos-14  *15.0.1  GCC 11.4.0  MacOSX14           MacOSX14.0
macos-14   15.1    GCC 11.4.0  MacOSX14           MacOSX14.2
macos-14   15.2    GCC 11.4.0  MacOSX14           MacOSX14.2
macos-14   15.3    GCC 11.4.0  MacOSX14           MacOSX14.4
macos-14   15.4    GCC 11.4.0  MacOSX14           MacOSX14.5
macos-14   16.0    GCC 11.4.0  MacOSX14           MacOSX15.0  MISMATCH  FAIL  /opt/homebrew/Cellar/gcc@11/11.4.0/lib/gcc/11/gcc/aarch64-apple-darwin23/11/include-fixed/stdio.h:83:8: error: unknown type name 'FILE'
macos-12   13.1    GCC 12.4.0  MacOSX12           MacOSX12.0
macos-12   13.2.1  GCC 12.4.0  MacOSX12           MacOSX12.1
macos-12   13.3.1  GCC 12.4.0  MacOSX12           MacOSX12.3
macos-12   13.4.1  GCC 12.4.0  MacOSX12           MacOSX12.3
macos-12   14.0.1  GCC 12.4.0  MacOSX12           MacOSX12.3
macos-12   14.1    GCC 12.4.0  MacOSX12           MacOSX13.0  MISMATCH  FAIL  /Applications/Xcode_14.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/object.h:275:1: error: expected ';' before 'extern'
macos-12  *14.2    GCC 12.4.0  MacOSX12           MacOSX13.1  MISMATCH  FAIL  /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/object.h:275:1: error: expected ';' before 'extern'
macos-13   14.1    GCC 12.4.0  MacOSX13           MacOSX13.0
macos-13   14.2    GCC 12.4.0  MacOSX13           MacOSX13.1
macos-13   14.3.1  GCC 12.4.0  MacOSX13           MacOSX13.3
macos-13  *15.0.1  GCC 12.4.0  MacOSX13           MacOSX14.0  MISMATCH  FAIL  /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/queue.h:103:1: error: unknown type name 'dispatch_queue_t'
macos-13   15.1    GCC 12.4.0  MacOSX13           MacOSX14.2  MISMATCH  FAIL  /Applications/Xcode_15.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/queue.h:103:1: error: unknown type name 'dispatch_queue_t'
macos-13   15.2    GCC 12.4.0  MacOSX13           MacOSX14.2  MISMATCH  FAIL  /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/queue.h:103:1: error: unknown type name 'dispatch_queue_t'
macos-14   14.3.1  GCC 12.4.0  MacOSX14           MacOSX13.3  MISMATCH
macos-14  *15.0.1  GCC 12.4.0  MacOSX14           MacOSX14.0
macos-14   15.1    GCC 12.4.0  MacOSX14           MacOSX14.2
macos-14   15.2    GCC 12.4.0  MacOSX14           MacOSX14.2
macos-14   15.3    GCC 12.4.0  MacOSX14           MacOSX14.4
macos-14   15.4    GCC 12.4.0  MacOSX14           MacOSX14.5
macos-14   16.0    GCC 12.4.0  MacOSX14           MacOSX15.0  MISMATCH  FAIL  /opt/homebrew/Cellar/gcc@12/12.4.0/lib/gcc/12/gcc/aarch64-apple-darwin23/12/include-fixed/stdio.h:83:8: error: unknown type name 'FILE'
macos-12   13.1    GCC 13.3.0  MacOSX12           MacOSX12.0
macos-12   13.2.1  GCC 13.3.0  MacOSX12           MacOSX12.1
macos-12   13.3.1  GCC 13.3.0  MacOSX12           MacOSX12.3
macos-12   13.4.1  GCC 13.3.0  MacOSX12           MacOSX12.3
macos-12   14.0.1  GCC 13.3.0  MacOSX12           MacOSX12.3
macos-12   14.1    GCC 13.3.0  MacOSX12           MacOSX13.0  MISMATCH  FAIL  /Users/runner/work/curl/curl/bld/lib/curl_config.h:792:19: error: two or more data types in declaration specifiers
macos-12  *14.2    GCC 13.3.0  MacOSX12           MacOSX13.1  MISMATCH  FAIL  /Users/runner/work/curl/curl/bld/lib/curl_config.h:792:19: error: two or more data types in declaration specifiers
macos-13   14.1    GCC 13.3.0  MacOSX13           MacOSX13.0
macos-13   14.2    GCC 13.3.0  MacOSX13           MacOSX13.1
macos-13   14.3.1  GCC 13.3.0  MacOSX13           MacOSX13.3
macos-13  *15.0.1  GCC 13.3.0  MacOSX13           MacOSX14.0  MISMATCH  FAIL  /Users/runner/work/curl/curl/bld/lib/curl_config.h:792:19: error: two or more data types in declaration specifiers
macos-13   15.1    GCC 13.3.0  MacOSX13           MacOSX14.2  MISMATCH  FAIL  /Users/runner/work/curl/curl/bld/lib/curl_config.h:792:19: error: two or more data types in declaration specifiers
macos-13   15.2    GCC 13.3.0  MacOSX13           MacOSX14.2  MISMATCH  FAIL  /Users/runner/work/curl/curl/bld/lib/curl_config.h:792:19: error: two or more data types in declaration specifiers
macos-14   14.3.1  GCC 13.3.0  MacOSX14           MacOSX13.3  MISMATCH  FAIL  /Users/runner/work/curl/curl/bld/lib/curl_config.h:792:19: error: two or more data types in declaration specifiers
macos-14  *15.0.1  GCC 13.3.0  MacOSX14           MacOSX14.0            FAIL  /Users/runner/work/curl/curl/bld/lib/curl_config.h:792:19: error: two or more data types in declaration specifiers
macos-14   15.1    GCC 13.3.0  MacOSX14           MacOSX14.2            FAIL  /Users/runner/work/curl/curl/bld/lib/curl_config.h:792:19: error: two or more data types in declaration specifiers
macos-14   15.2    GCC 13.3.0  MacOSX14           MacOSX14.2            FAIL  /Users/runner/work/curl/curl/bld/lib/curl_config.h:792:19: error: two or more data types in declaration specifiers
macos-14   15.3    GCC 13.3.0  MacOSX14           MacOSX14.4
macos-14   15.4    GCC 13.3.0  MacOSX14           MacOSX14.5
macos-14   16.0    GCC 13.3.0  MacOSX14           MacOSX15.0  MISMATCH  FAIL  /opt/homebrew/Cellar/gcc@13/13.3.0/lib/gcc/13/gcc/aarch64-apple-darwin23/13/include-fixed/stdio.h:83:8: error: unknown type name 'FILE'
macos-12   13.1    GCC 14.1.0  MacOSX12           MacOSX12.0
macos-12   13.2.1  GCC 14.1.0  MacOSX12           MacOSX12.1
macos-12   13.3.1  GCC 14.1.0  MacOSX12           MacOSX12.3
macos-12   13.4.1  GCC 14.1.0  MacOSX12           MacOSX12.3
macos-12   14.0.1  GCC 14.1.0  MacOSX12           MacOSX12.3
macos-12   14.1    GCC 14.1.0  MacOSX12           MacOSX13.0  MISMATCH  FAIL  /Applications/Xcode_14.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/object.h:275:1: error: expected ';' before 'extern'
macos-12  *14.2    GCC 14.1.0  MacOSX12           MacOSX13.1  MISMATCH  FAIL  /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/os/object.h:275:1: error: expected ';' before 'extern'
macos-13   14.1    GCC 14.1.0  MacOSX13           MacOSX13.0
macos-13   14.2    GCC 14.1.0  MacOSX13           MacOSX13.1
macos-13   14.3.1  GCC 14.1.0  MacOSX13           MacOSX13.3
macos-13  *15.0.1  GCC 14.1.0  MacOSX13           MacOSX14.0  MISMATCH  FAIL  /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/queue.h:70:1: error: type defaults to 'int' in declaration of 'DISPATCH_DECL_FACTORY_CLASS_SWIFT' [-Wimplicit-int]
macos-13   15.1    GCC 14.1.0  MacOSX13           MacOSX14.2  MISMATCH  FAIL  /Applications/Xcode_15.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/queue.h:70:1: error: type defaults to 'int' in declaration of 'DISPATCH_DECL_FACTORY_CLASS_SWIFT' [-Wimplicit-int]
macos-13   15.2    GCC 14.1.0  MacOSX13           MacOSX14.2  MISMATCH  FAIL  /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/dispatch/queue.h:70:1: error: type defaults to 'int' in declaration of 'DISPATCH_DECL_FACTORY_CLASS_SWIFT' [-Wimplicit-int]
macos-14   14.3.1  GCC 14.1.0  MacOSX14           MacOSX13.3  MISMATCH
macos-14  *15.0.1  GCC 14.1.0  MacOSX14           MacOSX14.0
macos-14   15.1    GCC 14.1.0  MacOSX14           MacOSX14.2
macos-14   15.2    GCC 14.1.0  MacOSX14           MacOSX14.2
macos-14   15.3    GCC 14.1.0  MacOSX14           MacOSX14.4
macos-14   15.4    GCC 14.1.0  MacOSX14           MacOSX14.5
macos-14   16.0    GCC 14.1.0  MacOSX14           MacOSX15.0  MISMATCH  FAIL  /opt/homebrew/Cellar/gcc/14.1.0_1/lib/gcc/current/gcc/aarch64-apple-darwin23/14/include-fixed/stdio.h:83:8: error: unknown type name 'FILE'
```
Source: https://github.com/curl/curl/actions/runs/9883956647/job/27299564218

This commit fixes earlier commit
1e75edd372868048c9f805ac4ca6d2cb5a88ff5a, reverted in
41a7e0dcc9681afd91e066411bcee4f369c23366, where I cut the commit
message in half by accident. The patch itself is identical.

Closes #14097

15 months agoRevert "GHA/macos: improve, fix gcc/llvm, add new test matrix"
Viktor Szakats [Fri, 19 Jul 2024 10:33:41 +0000 (12:33 +0200)] 
Revert "GHA/macos: improve, fix gcc/llvm, add new test matrix"

This reverts commit 1e75edd372868048c9f805ac4ca6d2cb5a88ff5a.

Due to some parts of the commit message missing (my bad.)

15 months agoRevert "lib: send eos flag"
Daniel Stenberg [Thu, 18 Jul 2024 23:38:05 +0000 (01:38 +0200)] 
Revert "lib: send eos flag"

This reverts commit be93299f10ef0b2bf7fe5c82140120073831867a.

15 months agoGHA/windows: use default shell CI feature
Viktor Szakats [Tue, 16 Jul 2024 22:34:03 +0000 (00:34 +0200)] 
GHA/windows: use default shell CI feature

It makes repeating a line in each step unnecessary.

Closes #14206

15 months agoGHA/macos: improve, fix gcc/llvm, add new test matrix
Viktor Szakats [Wed, 17 Jul 2024 23:09:04 +0000 (01:09 +0200)] 
GHA/macos: improve, fix gcc/llvm, add new test matrix

This PR began as an attempt to drop GCC support, after repeated reports
on fallouts when trying to use it on macOS.

Then it transformed into a 3-week project turning up the issues causing
the fallouts, ending up including llvm and all available Xcode / macOS
SDK, macOS runner image, build tools and compiler vendors and versions.
Accumulating 400 sub-commits.

I developed and tested all fixes under this PR, then merged them as
separate patches.

This PR retained CI jobs updates, extensively reworking and extending
them: [1]

At first it seemed GCC and the Apple SDK is "naturally" growing more
incompatible, as Apple added further non-standard features to their
headers. This is partly true, but reality is more complicated.

Besides some issues local to curl, there were bugs in Apple SDK
headers, Homebrew GCC builds, feature missing in the old llvm version
pre-installed on GitHub CI runner images, and subtle incompatibilities
between GCC and llvm/clang when handling language extensions.

Resulting compiler errors seldom pointed to a useful direction, and
internet search was silent about these issues too. Thus, I had to peel
them off layer by layer, using trial and error, and by recognizing
patterns of failures accross 150-200 builds combinations. Exposing
configure logs, and curl_config.h in the CI logs helped too.

1. GCC header compatibility layer ("hack" as GCC calls it)

The toughest issue is GCC's built-in compatibility layer:
  https://github.com/gcc-mirror/gcc/tree/master/fixincludes

This patch layer is further patched by a "Darwin compatibility" project
applied on top by Homebrew GCC via:
  https://github.com/iains/gcc-12-branch
  https://github.com/iains/gcc-13-branch
  https://github.com/iains/gcc-14-branch

The hack layer is designed in a way that breaks more builds than it
fixes, esp. in context of GHA runners. The idea is to build GCC
specifically for the SDK for the target macOS version. The problem with
this approach is that the Xcode + SDK installed on the local/CI machine
often does not match with the SDK used on while building GCC on
Homebrew's build machines. In these cases the GCC compatibility layer
turns into an "uncompatibility" layer and consistently breaks builds.
curl cannot offer a fix for this, because the solution (I found) is to
patch the toolchain on the local machine. I implemented this for our CI
builds and curl-for-win. In other case the user must do this patching
manually, or choose a compatible GCC + Xcode/SDK combination.

An upstream fix doesn't seem trivial either, because the issue is
ingrained in the compatibility layer's design. Offering an `-fapplesdk`
(or recognizing `-target`) option and/or fixing them within the compiler
would seem like a more robust option, and also how mainline llvm solves
this.

Here's a table summarizing the GCC + SDK combinations and curl build
failures: [2]

More info: https://github.com/curl/curl/issues/10356#issuecomment-2222734103

db135f8d7207b20d531e7e2100a49f3e16bdcfab #14119 macos: add workaround for gcc, non-c-ares, IPv6, compile error
Ref: https://github.com/curl/curl-for-win/commit/e2db3c475f5981352e6e6a79854a255805b28deb
Ref: https://github.com/curl/curl-for-win/commit/f5c58d7fef78e972be33ca2355dcb42ba56622a6

2. Homebrew GCC's `availability` extension

A recent minor Homebrew GCC upgrade caused major breakage. The "Darwin
compatibility" patch applied to GCC implemented the `availability`
compiler attribute in GCC. Apple SDK detected this and enabled using
them, but as it turns out GCC accepts compiler attributes with slightly
different rules than llvm/clang, and how the Apple SDK uses them,
breaking builds.

Affected Homebrew GCC versions are: 12.4.0, 13.3.0 and 14.1.0.

Possibly tracked here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796
More info: https://github.com/llvm/llvm-project/issues/81767

Commit implementing the `availability` macro:
gcc-12: https://github.com/iains/gcc-12-branch/commit/fd5530b7cb0012bf4faeddd45e13054a1dfa6783
gcc-13: https://github.com/iains/gcc-13-branch/commit/cb7e4eca68cfc4763474e2eb0935a844458842a8
gcc-14: https://github.com/iains/gcc-14-branch/commit/ff62a108865a6403f5017380d7018250c1d3306f

That applied to Homebrew GCC (12.4.0):
https://github.com/Homebrew/homebrew-core/commit/b904223d9893f62bec2a8f7483bf5992747fc6c7#diff-89dd0b4176eca7fcc24b591943509bf8a8d6ea904d71e5dfcd6b78fed62fc574R44-R48

Ref: #13700
More info: https://github.com/curl/curl/pull/14091#issuecomment-2222703468

e91fcbac7d86292858718a0bfebad57978761af4 #14155 macos: undo `availability` macro enabled by Homebrew gcc

3. Proprietary Apple SDK macros

Apple SDK expects certain macros predefined by the compiler. Missing
them may causes odd issues. Mainline llvm is keeping up with Apple
clang, but it needs a fresh version, while the one installed on GitHub
runners is old (v15). I patched these in `lib/curl_setup.h`.

baa3270846b2a7307cbd0dd5c02c4e5f00e388dd #14134 build: fix llvm 16 or older + Xcode 15 or newer, and gcc

4. Apple SDK header bug

Without certain predefined macros, SDK headers can take a codepath where
it mis-defines its own `TARGET_OS_OSX` macro, which make it break its
own headers later. I patched it in `lib/curl_setup.h`.

ff784af461175584c73e7e2b65af00b1a5a6f67f #14159 build: fix llvm 17 and older + macOS SDK 14.4 and newer

5. `TargetConditionals.h` requires `sys/types.h`

Fixed in curl. It caused feature-detection failurs with autotools, and
could break builds in certain configurations.

e1f6192939c9c5ab2310b60bedf4c07d635193f6 #14130 configure: fix `SystemConfiguration` detection

6. Differences between autotools and CMake compiler options

Fixed it by syncing compiler warning options.

59cadacfcc1d39472245979cdbd614c7a9af6f0d #14128 build: sync warning options between autotools, cmake & compilers

7. Differences between autotools and CMake dependency detection

Fixed it by improving detection of libidn2, with some more fixes
pending for the next feature window.

f43adc2c4978f7f82a359e89186e58a31d17b0ad #14137 cmake: detect `libidn2` also via `pkg-config`
Ref: #14136 cmake: detect `nghttp2` via `pkg-config`, enable by default

8. libidn2 detection bug with CMake

Fixed the root cause and also the trigger in the CI config.

764fbabf6ed4c1d36c0ab2033ac8df52d9923cd7 #14175 cmake: fix builds with detected libidn2 lib but undetected header

9. Suppressed compiler warnings inside Apple-specific curl code

Fixed these warnings, which allowed to stop silencing them.

b05dc7eb3592305de9fa85640767f3dd2a8d4c93 #14122 sectransp: fix `HAVE_BUILTIN_AVAILABLE` checks to not emit warnings
5fa534b0dacdc120aaab0766047e0ecac37be4b3 #14162 sectransp: fix clang compiler warnings, stop silencing them

10. CMake mis-detecting a CA bundle path on macOS

d2ef6255f4a040397d2f40ab7cbf65a203201cd9 #14182 cmake: sync CA bundle/path detection with autotools

11. Failure to build tests with LibreSSL or wolfSSL with CMake

Fixed by dropping unnecessary includes, makign test builds dependent
on dependency headers.

3765d75ce47b66289f946382b649d0e99389dc77 #14172 cmake: fix building `unit1600` due to missing `ssl/openssl.h`

12. curl tests with CMake

curl's CMake was missing bits for running the C preprocessor accurately.
It made tests 1119 and 1167 fail. I implemented the missing bits.

efc2c5184d008fe2e5910fd03263e1ab0331d4e6 #14124 tests: include current directory when running test Perl commands
c09db8b51b88ee6ad55bd637dcb4b47678e30906 #14129 cmake: create `configurehelp.pm` like autotools does
67cc1e3400b77536a3ca529c986247e1ef985e6e #14125 test1119: adapt for `.md` input

13. GCC missing `__builtin_available()` support

curl source code assumes this is available to enable certain codepaths.
It's also intermixed with monotonic timer support.

14. Monotonic timer support with GCC

Detected by GCC, while it probably shouldn't be. llvm/clang detects it
depending on target OS version. I've been playing with this, but so far
without a conclusion or fix.

15. Runtime/test failures with GCC

I couldn't find the reason for most of this. A bunch of RTSP tests fail
with GCC. SecureTransport + HTTP/2 is failing a bunch of tests. With
OpenSSL it fails two of those. SecureTransport builds also fail one DoH
test.

16. Runtime/test failure in llvm/clang

AppleIDN support received a fix with two more remaining.

fd0250869f7837e4a48d7e6f54cc0801ad3820e8 #14179 #14176 IDN: fix ß with AppleIDN

17. Other issues found and fixed while working on this:

2c15aa5765900d4351e733671a1c8c3785beee1a        GHA/macos: delete misplaced `CFLAGS`, drop redundant CMake option
80fb7c0bef209735ab352bf4afa31193a7bc65f1 #14126 configure: limit `SystemConfiguration` test to non-c-ares, IPv6 builds
cfd6f43d6ca7e57670b422bab7bbf10221a2cf3e #14127 build: tidy up `__builtin_available` feature checks (Apple)
bae555359979016999a9425a2d489f219a78abdd #14174 runtests: show name and keywords for failed tests in summary
09cdf7e5315711dea4ce7dcf5d99a4d41e7f658b #14178 cmake: delete unused `HAVE_LIBSSH2`, `HAVE_LIBSOCKET` macros
d3595c74fab829f07ef44da1b7fc2f5668767020 #14186 configure: CA bundle/path detection fixes
58772b0e082eda333e0a5fc8fb0bc7f17a3cd99c #14187 runtests: set `SOURCE_DATE_EPOCH` to fix failing around midnight
18f1cd7a77c4beecfd977d43f55634eb593ac99e #14183 tests: sync feature names with `curl -V`
4c22d97be786ed801e050da6872dd3143d6d0a59 #14181 build: use `#error` instead of invalid syntax

Pending merge:

15 months agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 18 Jul 2024 22:04:04 +0000 (00:04 +0200)] 
RELEASE-NOTES: synced

15 months agolib: send eos flag
Stefan Eissing [Thu, 18 Jul 2024 09:29:37 +0000 (11:29 +0200)] 
lib: send eos flag

Adds a `bool eos` flag to send methods to indicate that the data is the
last chunk the invovled transfer wants to send to the server.

This will help protocol filters like HTTP/2 and 3 to forward the
stream's EOF flag and also allow to EAGAIN such calls when buffers are
not yet fully flushed.

Closes #14220

15 months agombedtls: correct the error message for cert blob parsing failure
Bhanu Prakash [Thu, 18 Jul 2024 12:47:26 +0000 (18:17 +0530)] 
mbedtls: correct the error message for cert blob parsing failure

Closes #14224

15 months agocurldown: make 'added-in:' a mandatory header field
Daniel Stenberg [Wed, 17 Jul 2024 22:51:50 +0000 (00:51 +0200)] 
curldown: make 'added-in:' a mandatory header field

- generate AVAILABILITY manpage sections automatically - for consistent
  wording

- allows us to double-check against other documumentation (symbols-in-versions
  etc)

- enables proper automation/scripting based on this data

- lots of them were wrong or missing in the manpages

- several of them repeated (sometimes mismatching) backend support info

Add test 1488 to verify "added-in" version numbers against
symbols-in-versions.

Closes #14217

15 months agodoh: fix cleanup
Stefan Eissing [Wed, 17 Jul 2024 12:46:47 +0000 (14:46 +0200)] 
doh: fix cleanup

When removing an easy handle that had DoH sub-easy handles going, those
were not removed from the multi handle. Their memory was reclaimed on
curl_easy_cleanup() of the owning handle, but multi still had them in
their list.

Add `Curl_doh_close()` and `Curl_doh_cleanup()` as common point for
handling the DoH resource management. Use the `multi` present in the doh
handles (if so), for removal, as the `data->multi` might already have
been NULLed at this time.

Reported-by: 罗朝辉
Fixes #14207
Closes #14212

15 months agotests/scripts: call it 'manpage' (single word)
Daniel Stenberg [Wed, 17 Jul 2024 22:11:28 +0000 (00:11 +0200)] 
tests/scripts: call it 'manpage' (single word)

Mostly in comments

Closes #14216

15 months agohttp/3: resume upload on ack if we have more data to send
Alex Snast [Wed, 17 Jul 2024 11:06:06 +0000 (14:06 +0300)] 
http/3: resume upload on ack if we have more data to send

Currently we're waiting for sendbuf_len_in_flight to hit zero before
resuming upload which means we're blocking and waiting for _all_ acks to
arrive before sending more data. This causes significant delays especially
when ack delay is used on the server side.

The fix addresses several issues in h3 over ngtcp2:
  - On ack we now call nghttp3_conn_resume_stream() when we have more
    data to send.
  - upload_left was incorrectly computed on CF_CTRL_DATA_DONE_SEND as
    we need to subtract the ammount of data we have in flight.
  - Remove upload_blocked_len as we Curl_bufq_write call will do the
    right thing when called from cf_ngtcp2_send.

Fixes #14198
Closes #14209

15 months agoidn: make macidn fail before trying conversion if name too long
Daniel Stenberg [Tue, 16 Jul 2024 16:40:13 +0000 (18:40 +0200)] 
idn: make macidn fail before trying conversion if name too long

- double the max name length to 512 bytes

Closes #14215

15 months agoidn: tweak buffer use when converting with macidn
z2_ [Wed, 17 Jul 2024 21:48:33 +0000 (23:48 +0200)] 
idn: tweak buffer use when converting with macidn

Closes #14215

15 months agolib: add failure reason on bind errors
Orgad Shaneh [Thu, 18 Jul 2024 09:52:31 +0000 (12:52 +0300)] 
lib: add failure reason on bind errors

Closes #14221

15 months agopytests: scorecard upload tests
Stefan Eissing [Wed, 17 Jul 2024 10:26:40 +0000 (12:26 +0200)] 
pytests: scorecard upload tests

- add upload tests to scorecard, invoke with
  > python3 tests/http/scorecard.py -u h1|h2|h3
- add a reverse proxy setup from Caddy to httpd for
  upload tests since Caddy does not have other PUT/POST handling
- add caddy tests in test_08 for POST/PUT
- increase read buffer in mod_curltest for larger reads

Closes #14208

15 months agoruntests: fix newline glitch in FAIL details
Viktor Szakats [Wed, 17 Jul 2024 22:53:19 +0000 (00:53 +0200)] 
runtests: fix newline glitch in FAIL details

Follow-up to bae555359979016999a9425a2d489f219a78abdd #14174

15 months agoruntests: show name and keywords for failed tests in summary
Viktor Szakats [Sat, 13 Jul 2024 08:49:08 +0000 (10:49 +0200)] 
runtests: show name and keywords for failed tests in summary

Useful to see what the numbers listed in the `TESTFAIL:` and `IGNORED:`
lines mean. Also list test keywords to help catching failure patterns.

Example:
```
FAIL 1034: 'HTTP over proxy with malformatted IDN host name' HTTP, HTTP GET, HTTP proxy, IDN, FAILURE, config file
FAIL 1035: 'HTTP over proxy with too long IDN host name' HTTP, HTTP GET, HTTP proxy, IDN, FAILURE

TESTFAIL: These test cases failed: 1034 1035
```

Closes #14174

15 months agoGHA/windows: add MSVC wolfSSL job with test
Tal Regev [Mon, 15 Jul 2024 18:29:17 +0000 (21:29 +0300)] 
GHA/windows: add MSVC wolfSSL job with test

Fix the file of wolfssl.c because of this warning/error:
```
curl\lib\vtls\wolfssl.c(1017,42): error C2220: the following warning is treated as an error [curl\bld\lib\libcurl_object.vcxproj]
curl\lib\vtls\wolfssl.c(1017,42): warning C4267: 'function': conversion from 'size_t' to 'unsigned long', possible loss of data [curl\bld\lib\libcurl_object.vcxproj]
```

`size_t` in MSVC is different. Change it to `unsigned long` because
`wolfSSL_ERR_error_string_n` last argument is defined as
`unsigned long`.

Closes #14193

15 months agocmake: delete unused `HAVE_LIBSSH2`, `HAVE_LIBSOCKET` macros
Viktor Szakats [Sat, 13 Jul 2024 16:47:54 +0000 (18:47 +0200)] 
cmake: delete unused `HAVE_LIBSSH2`, `HAVE_LIBSOCKET` macros

- `HAVE_LIBSSH2`: unused in source. Not defined in CMake.

- `HAVE_LIBSOCKET`: unused in source. Used internally in CMake.

autotools sets them implicitly, so add them to the flag comparison
ignore-list.

Closes #14178

15 months agocmake: create `configurehelp.pm` like autotools does
Viktor Szakats [Mon, 8 Jul 2024 16:32:34 +0000 (18:32 +0200)] 
cmake: create `configurehelp.pm` like autotools does

Required by tests 1119 and 1167 to run a C preprocessor.

Tested OK: https://github.com/curl/curl/actions/runs/9915343826

Besides Apple, it also supports any gcc and clang builds, and MSVC.
For other platforms, it defaults to `cpp` (like autotools).

Follow-up to efc2c5184d008fe2e5910fd03263e1ab0331d4e6 #14124
Cherry-picked from #14097
Closes #14129

15 months agocmake: sync CA bundle/path detection with autotools
Viktor Szakats [Sun, 14 Jul 2024 08:26:35 +0000 (10:26 +0200)] 
cmake: sync CA bundle/path detection with autotools

- skip the entire CA logic if no selected TLS backend support CA
  certs/bundles.
  Follow-up to 082bb41311a832ae1b83bb8fe1dfdefcf4e68ea5 #2545

- sync bundle path detection logic with `./configure`.

- fix to not auto-detect CA bundle/path on Windows.

- fix to reflect that BearSSL has CA bundle support.

- show the detected bundle path (as with the cert bundle).

- tidy up CMake syntax, fix typos in comments.

Closes #14182

15 months agoconfigure: CA bundle/path detection fixes
Viktor Szakats [Sun, 14 Jul 2024 11:43:22 +0000 (13:43 +0200)] 
configure: CA bundle/path detection fixes

- fix to not auto-detect CA bundle/path on Windows.

- two checks missed BearSSL, but they were only run for supported
  TLS backends anyway. Delete these redundant checks.

- fix typos in a comment nearby.

Follow-up to 082bb41311a832ae1b83bb8fe1dfdefcf4e68ea5 #2545
Closes #14186

15 months agoruntests: set `SOURCE_DATE_EPOCH` to fix failing around midnight
Viktor Szakats [Mon, 15 Jul 2024 00:48:05 +0000 (02:48 +0200)] 
runtests: set `SOURCE_DATE_EPOCH` to fix failing around midnight

To make sure that `managen` called by test 1706 uses the same date as
the test expects in the `%DATE` macro.

Before this patch when tests started running before UTC midnight and
reached test 1706 after, these dates were different and the test failed.

Follow-up to 0e73b69b3dd6d174226c60406d3c4266754d70f8
Fixes #14173
Closes #14187

15 months agoGHA/windows: verify 1448 2046 2047 in IDN Unicode jobs
Viktor Szakats [Mon, 15 Jul 2024 01:16:03 +0000 (03:16 +0200)] 
GHA/windows: verify 1448 2046 2047 in IDN Unicode jobs

These IDN tests pass with Unicode and fail without.

Follow-up to cb22cfca69bded45bf7f9c72c8e6764990490f11 #14077
Closes #14188

15 months agotests: sync feature names with `curl -V`
Viktor Szakats [Mon, 15 Jul 2024 22:41:32 +0000 (00:41 +0200)] 
tests: sync feature names with `curl -V`

Some feature names used in tests had minor differences compared to
the well-known ones from `curl -V`. This patch syncs them to make test
results easier to grok.

Closes #14183

15 months agosendf: fix CRLF conversion of input
Stefan Eissing [Fri, 12 Jul 2024 12:07:29 +0000 (14:07 +0200)] 
sendf: fix CRLF conversion of input

When CRLF line end conversion was enabled (--crlf), input after the last
newline in the upload buffer was not sent, if the buffer contained a
newline.

Reported-by: vuonganh1993 on github
Fixes #14165
Closes #14169

15 months agotest2600: disable on win32
Stefan Eissing [Mon, 15 Jul 2024 09:56:51 +0000 (11:56 +0200)] 
test2600: disable on win32

- disbable this test on WIN32 platforms. It uses the file describtor '1'
  as valid socket without events. Not portable.
- reduce trace output somewhat on other runs

Fixes #14177
Reported-by: Viktor Szakats
Closes #14191

15 months agosmtp: for starttls, do full upgrade
Stefan Eissing [Mon, 15 Jul 2024 09:33:58 +0000 (11:33 +0200)] 
smtp: for starttls, do full upgrade

- make sure the TLS handshake after a successful STARTTLS command is
  fully done before further sending/receiving on the connection.

Reported-by: tomy2105 on github
Fixes #14166
Closes #14190

15 months agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 14 Jul 2024 21:22:11 +0000 (23:22 +0200)] 
RELEASE-NOTES: synced

15 months agobuild: use `#error` instead of invalid syntax
Viktor Szakats [Sat, 13 Jul 2024 19:45:23 +0000 (21:45 +0200)] 
build: use `#error` instead of invalid syntax

It reduces configure log noise.

Follow-up to 20c1b2d75ee38189ffa75d21ed04108e1e0630ae #13287
Closes #14181

15 months agolibcurl-docs: make option lists alpha-sorted
Daniel Stenberg [Thu, 11 Jul 2024 13:54:25 +0000 (15:54 +0200)] 
libcurl-docs: make option lists alpha-sorted

The man pages for curl_easy_getinfo, curl_easy_setopt and
curl_multi_setopt now feature the lists of options alphabetically
sorted. Test 1139 verify that they are.

The curl_multi_setopt page also got brief explanations of the listed
options.

Closes #14156

15 months agoIDN: fix ß with AppleIDN
MonkeybreadSoftware [Sat, 13 Jul 2024 20:14:01 +0000 (22:14 +0200)] 
IDN: fix ß with AppleIDN

Add flags UIDNA_NONTRANSITIONAL_TO_ASCII and
UIDNA_NONTRANSITIONAL_TO_UNICODE to encode ß correctly.

It fixes test 165.

Reported-by: Viktor Szakats
Bug: #14176
Closes #14179

15 months agocmake: fix builds with detected libidn2 lib but undetected header
Viktor Szakats [Sat, 13 Jul 2024 11:06:33 +0000 (13:06 +0200)] 
cmake: fix builds with detected libidn2 lib but undetected header

It caused IDN to appear in `curl-config`, `libidn2` referenced from
`libcurl.pc`, fail to fallback to `pkg-config` detection. But libidn2
not actually used.

It came up in macOS CI builds after enabling cmake build tests. It
remained hidden for a while due to setting `-DUSE_APPLE_IDN=ON`.

(The half-detection of Homebrew libidn2 was the result of configuring
with `-DCMAKE_EXE_LINKER_FLAGS=-L$(brew --prefix)/lib`, to fix
linking GnuTLS that needs the `nettle` lib from the brew prefix.)

```
FAIL 1014: [Compare curl --version with curl-config --features] curl-config
```
Ref: https://github.com/curl/curl/actions/runs/9919357748/job/27405080722

Cherry-picked from #14097
Closes #14175

15 months agocmake: fix building `unit1600` due to missing `ssl/openssl.h`
Viktor Szakats [Fri, 12 Jul 2024 21:31:21 +0000 (23:31 +0200)] 
cmake: fix building `unit1600` due to missing `ssl/openssl.h`

In specific builds configs, cmake failed to build test `unit1600`,
due missing an OpenSSL (or wolfSSL) header.

The test code relies on `lib/curl_ntlm_core.h`, which in turn included
TLS library headers. But, dependency header directories are not setup
in cmake for tests, because they should not normally be needed.

The issue was hidden in most builds because TLS headers are usually
found under the system prefix. One counterexample is macOS + Homebrew
LibreSSL builds, where OpenSSL is purposefully unlinked from there to
avoid a mixup with LibreSSL that resides under its own prefix. It was
also hidden in autotools, possibly because it sets up header directories
globally, tests included.

The actual bug however is that `lib/curl_ntlm_core.h` should not include
TLS headers. None of its internal users need it, and `curl_ntlm_core.c`
included them already directly.

Fix it by deleting the TLS header includes from this internal header.

Fixes:
```
In file included from curl/tests/unit/unit1600.c:27:
curl/lib/curl_ntlm_core.h:32:12: fatal error: 'openssl/ssl.h' file not found
#  include <openssl/ssl.h>
           ^~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/9912684737/job/27388041520#step:12:1694

Follow-up to 48eb71ade41d4b37f416b643063cab846ac027a2 #10322
Cherry-picked from #14097
Closes #14172

15 months agosectransp: fix clang compiler warnings, stop silencing them
Viktor Szakats [Sat, 6 Jul 2024 12:59:57 +0000 (14:59 +0200)] 
sectransp: fix clang compiler warnings, stop silencing them

Fix `-Wpointer-bool-conversion` warnings with the method suggested by
both Apple clang and mainline llvm. This was already tried and dropped
in #1705 (in year 2017), but the issue reported there no longer
replicates.

Verified with Apple clang 14, llvm 15, llvm 18 and gcc 11, 14 that the
generated objects are bit by bit identical before and after this patch.

Also:
- stop silencing `-Wtautological-pointer-compare`. This warning don't
  seem to be appearing anymore (with or without this patch), at least
  with the tested compilers and SDKs (clang 13.1.6-16.0.0beta, llvm 15,
  18, gcc 11, 14) and minimum macOS target of 10.8. Older targets fail
  to build curl with SecureTransport.

- silence `-Wunreachable-code` for clang only. Previously I applied it
  also to GCC, by mistake.
  Ref: https://github.com/curl/curl/pull/12331/commits/8d7172d20a48ebc6c1b1d94a76e2c5fb19dd9bfa

Apple clang `-Wpointer-bool-conversion`:
```
curl/lib/vtls/sectransp.c:1103:6: error: address of function 'SSLCreateContext' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
  if(SSLCreateContext) {  /* use the newer API if available */
  ~~ ^~~~~~~~~~~~~~~~
curl/lib/vtls/sectransp.c:1103:6: note: prefix with the address-of operator to silence this warning
  if(SSLCreateContext) {  /* use the newer API if available */
     ^
     &
```
Ref: https://github.com/curl/curl/actions/runs/9819538439/job/27113201384#step:8:382

llvm `-Wpointer-bool-conversion`:
```
curl/lib/vtls/sectransp.c:2663:8: error: address of function 'SSLCreateContext' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
    if(SSLCreateContext)
    ~~ ^~~~~~~~~~~~~~~~
curl/lib/vtls/sectransp.c:2663:8: note: prefix with the address-of operator to silence this warning
    if(SSLCreateContext)
       ^
       &
```
Ref: https://github.com/curl/curl/actions/runs/9819538439/job/27113200291#step:8:417

gcc still needs `-Waddress` suppressed to avoid these:
```
curl/lib/vtls/n/sectransp.c: In function 'getsubject':
curl/lib/vtls/n/sectransp.c:379:6: warning: the address of 'SecCertificateCopyLongDescription' will always evaluate as 'true' [-Waddress]
  379 |   if(&SecCertificateCopyLongDescription)
      |      ^
[...]
```

Follow-up to 59cadacfcc1d39472245979cdbd614c7a9af6f0d #14128
Follow-up to af271ce9b9717ba289417e9cbb7f278c2a12f959 #1722
Follow-up to 2b7ce3f56dfede107113c6de7d0ca457109d3eda #1706
Cherry-picked from #14097
Closes #14162

15 months agoCI/circleci: config tidy-ups, bump up test parallelism
Viktor Szakats [Fri, 12 Jul 2024 17:23:43 +0000 (19:23 +0200)] 
CI/circleci: config tidy-ups, bump up test parallelism

- bump parallel test for Linux jobs.
Credit-to: Dan Fandrich
  Cherry-picked from #11510
- bump parallel test for macOS jobs.
- drop no longer necessary `-Wno-vla` option.
- fold long lines.
- drop `--enable-maintainer-mode` `./configure` option.
- replace a hard-coded prefix with `brew --prefix`.
- update documentation link.
- move `--enable-debug` in front.
- tidy up quotes.

Closes #14171

15 months agoGHA/windows: re-add gsasl to MSVC jobs
Viktor Szakats [Fri, 12 Jul 2024 14:06:21 +0000 (16:06 +0200)] 
GHA/windows: re-add gsasl to MSVC jobs

Now that the package reached the CI runner image.

Follow-up to f99c08dba40307c07341013ff5f71fa8e3464ffc #14090
Follow-up to e26cbe20cbedbea0ca743dd33880517309315cb2 #13979

Closes #14170

15 months agotidy-up: adjust casing of project names
Viktor Szakats [Fri, 12 Jul 2024 11:55:26 +0000 (13:55 +0200)] 
tidy-up: adjust casing of project names

Mostly TLS/SSH project name.

Closes #14160

15 months agoISSUE_TEMPLATE/docs: correct the field identifiers
Daniel Stenberg [Fri, 12 Jul 2024 10:22:15 +0000 (12:22 +0200)] 
ISSUE_TEMPLATE/docs: correct the field identifiers

15 months agodoh: fix leak and zero-length HTTPS RR crash
Stephen Farrell [Wed, 10 Jul 2024 22:43:32 +0000 (23:43 +0100)] 
doh: fix leak and zero-length HTTPS RR crash

This PR fixes a leak and a crash that can happen when curl encounters
bad HTTPS RR values in DNS. We're starting to do better testing of that
kind of thing and e.g. have published bad HTTPS RR values at
dodgy.test.defo.ie.

Closes #14151

15 months agocurl_global_init.md: polish the thread-safe wording
Daniel Stenberg [Thu, 11 Jul 2024 15:41:39 +0000 (17:41 +0200)] 
curl_global_init.md: polish the thread-safe wording

Since this has been thread-safe for two years now, few users actually
are hurt by the previous unsafe ways.

Closes #14158

15 months agoGHA: FreeBSD 14.1, actions bump
Viktor Szakats [Thu, 11 Jul 2024 23:10:44 +0000 (01:10 +0200)] 
GHA: FreeBSD 14.1, actions bump

- bump FreeBSD to 14.1

- update cross-platform-actions/action action to v0.25.0

Closes #14157
Closes #14164

15 months agobuild: fix llvm 17 and older + macOS SDK 14.4 and newer
Viktor Szakats [Thu, 11 Jul 2024 17:35:29 +0000 (19:35 +0200)] 
build: fix llvm 17 and older + macOS SDK 14.4 and newer

Fixup faulty target macro initialization in macOS SDK since v14.4 (as of
15.0 beta). The SDK target detection in `TargetConditionals.h` correctly
detects macOS, but fails to set the macro's old name `TARGET_OS_OSX`,
then continues to set it to a default value of 0. Other parts of the SDK
still rely on the old name, and with this inconsistency our builds fail
due to missing declarations. It happens when using mainline llvm older
than v18. Later versions fixed it by predefining these target macros,
avoiding the faulty dynamic detection. gcc is not affected (for now)
because it lacks the necessary dynamic detection features, so the SDK
falls back to a codepath that sets both the old and new macro to 1.

Also move the `TargetConditionals.h` include to the top of to make sure
including it also for c-ares builds, combined with SecureTransport or
other curl features that may call use an Apple SDK.

Before this patch, affected build combinations (e.g. in GHA runners,
llvm@15 + Xcode 15.3, 15.4, 16.0 with their default SDKs +
SecureTransport) fail with:
```
  error: use of undeclared identifier 'noErr'
    or 'SecCertificateCopyLongDescription'
    or 'SecItemImportExportKeyParameters'
    or 'SecExternalFormat'
    or 'SecExternalItemType'
    or 'SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION'
```

Example:
```
curl/lib/vtls/sectransp.c:311:18: error: use of undeclared identifier 'noErr'
  OSStatus rtn = noErr;
                 ^
curl/lib/vtls/sectransp.c:379:7: error: use of undeclared identifier 'SecCertificateCopyLongDescription'
  if(&SecCertificateCopyLongDescription)
      ^
curl/lib/vtls/sectransp.c:381:7: error: call to undeclared function 'SecCertificateCopyLongDescription'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
      SecCertificateCopyLongDescription(NULL, cert, NULL);
      ^
curl/lib/vtls/sectransp.c:380:25: error: incompatible integer to pointer conversion assigning to 'CFStringRef' (aka 'const struct __CFString *') from 'int' [-Wint-conversion]
    server_cert_summary =
                        ^
[...]
```
Ref: https://github.com/curl/curl/actions/runs/9893867519/job/27330135969#step:10:22

llvm v18 patches implementing the predefined macros:
https://github.com/llvm/llvm-project/pull/74676
https://github.com/llvm/llvm-project/commit/6e1f19168bca7e3bd4eefda50ba03eac8441dbbf
https://github.com/llvm/llvm-project/pull/82833
https://github.com/llvm/llvm-project/commit/e5ed7b6e2fd368b722b6359556cd0125881e7638

Cherry-picked from #14097
Closes #14159

15 months agomacos: undo `availability` macro enabled by Homebrew gcc
Viktor Szakats [Tue, 9 Jul 2024 18:48:11 +0000 (20:48 +0200)] 
macos: undo `availability` macro enabled by Homebrew gcc

Homebrew gcc builds starting with 12.4.0, 13.3.0 and 14.1.0 enabled
the `availability` attribute.

This broke builds because the way the Apple SDK uses attributes (when
available) are incompatible with how gcc accepts them. Causing these
errors:
```
  error: attributes should be specified before the declarator in a function definition
  error: expected ',' or '}' before
```

Upstream commits implementing the `availability` macro:
gcc-12: https://github.com/iains/gcc-12-branch/commit/fd5530b7cb0012bf4faeddd45e13054a1dfa6783
gcc-13: https://github.com/iains/gcc-13-branch/commit/cb7e4eca68cfc4763474e2eb0935a844458842a8
gcc-14: https://github.com/iains/gcc-14-branch/commit/ff62a108865a6403f5017380d7018250c1d3306f

The project above is a Darwin gcc compatibility pack, that is applied
to Homebrew gcc builds.

This patch works by redefining the `availability` macro to an invalid
value, making `__has_attribute(availability)` checks fail, stopping
Apple SDK from inserting the incompatible attributes.

It also replaces the previous, local workaround for `lib/macos.c`.

Example with gcc 12.4.0 with macOS SDK 14.0 (Xcode 15.0.1):
```
In file included from <path-to-sdk>/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:54,
                 from <path-to-sdk>/MacOSX14.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:30,
                 from /Users/runner/work/curl/curl/lib/macos.c:33,
                 from /Users/runner/work/curl/curl/build/lib/CMakeFiles/libcurl_shared.dir/Unity/unity_0_c.c:244:
<path-to-sdk>/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:126:1: error: attributes should be specified before the declarator in a function definition
  126 | CF_INLINE CFOptionFlags CFUserNotificationCheckBoxChecked(CFIndex i) API_AVAILABLE(macos(10.0)) API_UNAVAILABLE(ios, watchos, tvos) {return ((CFOptionFlags)(1UL << (8 + i)));}
      | ^~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/9787982387/job/27025351601?pr=14096#step:7:18

The gcc vs. llvm/clang incompatibility possibly tracked here upstream:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796
More info:
  https://github.com/llvm/llvm-project/issues/81767
  https://github.com/gcc-mirror/gcc/commit/8433baadec88e5f31fa141b6d78094e91256079d
  https://discourse.llvm.org/t/changing-attribute-ast-printing-location-for-gcc-compatibility/73215
  https://reviews.llvm.org/D159362

Follow-up to db135f8d7207b20d531e7e2100a49f3e16bdcfab #14119
Ref: https://github.com/curl/curl/pull/14091#issuecomment-2222703468
Fixes #13700
Cherry-picked from #14097
Closes #14155

15 months agoISSUE_TEMPLATE/docs: add a separate GitHub issue template for documentation
Daniel Stenberg [Thu, 11 Jul 2024 21:23:54 +0000 (23:23 +0200)] 
ISSUE_TEMPLATE/docs: add a separate GitHub issue template for documentation

As such problems don't really fit the code related template

Closes #14161

15 months agoDISTROS: add AlmaLinux package source link
Dan Fandrich [Thu, 11 Jul 2024 19:52:06 +0000 (12:52 -0700)] 
DISTROS: add AlmaLinux package source link

15 months agoGHA/windows: ignore FTP test results for old-mingw-w64 [ci skip]
Viktor Szakats [Thu, 11 Jul 2024 19:39:13 +0000 (21:39 +0200)] 
GHA/windows: ignore FTP test results for old-mingw-w64 [ci skip]

Missed from previous commit. They are flaky here as well.

Follow-up to 0b81eccd22fb915aa6b679c0fd23a8a89332dc9e

15 months agolibcurl-easy.md: now *more* than 300 options
Daniel Stenberg [Thu, 11 Jul 2024 11:58:32 +0000 (13:58 +0200)] 
libcurl-easy.md: now *more* than 300 options

it previously said "almost 300".

Also cleaned up the language somewhat.

Closes #14153

15 months agoMANUAL.md: wrap two example urls that overrun styling
Martin Peck [Wed, 10 Jul 2024 14:58:28 +0000 (15:58 +0100)] 
MANUAL.md: wrap two example urls that overrun styling

Closes #14149

15 months agoGHA: update wolfSSL and mod_h2
renovate[bot] [Mon, 8 Jul 2024 21:13:49 +0000 (21:13 +0000)] 
GHA: update wolfSSL and mod_h2

- wolfSSL/wolfssl to v5.7.2
- icing/mod_h2 to v2.0.29

Closes #14131
Closes #14148

15 months agodocs: start markdown headers with capital letter where applicable
Dominik Piątkowski [Sun, 7 Jul 2024 15:39:33 +0000 (17:39 +0200)] 
docs: start markdown headers with capital letter where applicable

Closes #14115

15 months agohostip: skip error check for infallible function call
CMD [Wed, 10 Jul 2024 10:16:29 +0000 (13:16 +0300)] 
hostip: skip error check for infallible function call

Closes #14147

15 months agocf-socket: remove two "useless" assignments
Daniel Stenberg [Wed, 10 Jul 2024 09:40:29 +0000 (11:40 +0200)] 
cf-socket: remove two "useless" assignments

'nread' is already -1, no need to assign it again

Pointed out by CodeSonar

Closes #14145

15 months agocmake: detect `libidn2` also via `pkg-config`
Viktor Szakats [Tue, 9 Jul 2024 10:11:16 +0000 (12:11 +0200)] 
cmake: detect `libidn2` also via `pkg-config`

Also:
- GHA/non-native: install `pkg-config` to detect libidn2 with cmake
  on NetBSD and FreeBSD.
- GHA/non-native: tidy-up `curl --version` command if here.

Cherry-picked from #14097
Closes #14137

15 months agobuild: fix llvm 16 or older + Xcode 15 or newer, and gcc
Viktor Szakats [Tue, 9 Jul 2024 01:32:08 +0000 (03:32 +0200)] 
build: fix llvm 16 or older + Xcode 15 or newer, and gcc

Xcode v15 (2023) or newer requires the built-in macro
`__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__`. This macro is missing from
mainline llvm versions released earlier. llvm v17 introduced it here:
https://github.com/llvm/llvm-project/commit/c8e2dd8c6f490b68e41fe663b44535a8a21dfeab

This patch defines the missing macro when the necessary conditions
align, by using the value via the macro's old name.

The issue affected SecureTransport builds: The SecureTransport code,
`lib/md4.c` and `lib/md5.c`.

Existing gcc versions (as of v14) also don't define this macro, so apply
the patch to it as well. Even though gcc is incompatible in other ways,
so this isn't fixing an actual curl build case that I could find yet.

GHA macOS runner images have llvm v15 pre-installed, which broke builds
when building with an affected Xcode:
```
curl/lib/md4.c:80:14: error: '__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__' is not defined, evaluates to 0 [-Werror,-Wundef]
            (__MAC_OS_X_VERSION_MIN_REQUIRED < 101500)) || \
             ^
/Applications/Xcode_15.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/AvailabilityInternal.h:40:53: note: expanded from macro '__MAC_OS_X_VERSION_MIN_REQUIRED'
            #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__
                                                    ^
In file included from curl/build/lib/CMakeFiles/libcurl_shared.dir/Unity/unity_0_c.c:250:
curl/lib/md5.c:75:14: error: '__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__' is not defined, evaluates to 0 [-Werror,-Wundef]
            (__MAC_OS_X_VERSION_MIN_REQUIRED < 101500)) || \
             ^
/Applications/Xcode_15.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/AvailabilityInternal.h:40:53: note: expanded from macro '__MAC_OS_X_VERSION_MIN_REQUIRED'
            #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__
                                                    ^
2 errors generated.
```
Ref: https://github.com/curl/curl/actions/runs/9811974634/job/27095218578#step:4:20

Cherry-picked from #14097
Closes #14134

15 months agobuild: tidy up `__builtin_available` feature checks (Apple)
Viktor Szakats [Sat, 6 Jul 2024 01:57:51 +0000 (03:57 +0200)] 
build: tidy up `__builtin_available` feature checks (Apple)

- sync detection snippet between autotools and cmake
  It wasn't causing issues, but it's useful to avoid unnecessary
  differences while debugging.

- cmake: limit check to `APPLE`.

Ref: b05dc7eb3592305de9fa85640767f3dd2a8d4c93 #14122
Cherry-picked from #14097
Closes #14127

15 months agoconfigure: limit `SystemConfiguration` test to non-c-ares, IPv6 builds
Viktor Szakats [Sat, 6 Jul 2024 21:47:50 +0000 (23:47 +0200)] 
configure: limit `SystemConfiguration` test to non-c-ares, IPv6 builds

The framework this check detects is necessary for the function
`SCDynamicStoreCopyProxies()` used in `lib/macos.c`. Non-c-ares,
IPv6-enabled builds touch this codepath.

Limit the feature check for builds that actually need it.

It brings this in sync with CMake which already worked this way.

Cherry-picked from #14097
Closes #14126

15 months agoconfigure: fix `SystemConfiguration` detection
Viktor Szakats [Sat, 6 Jul 2024 21:47:50 +0000 (23:47 +0200)] 
configure: fix `SystemConfiguration` detection

Before this patch, `SystemConfiguration` detection failed due to this
error when compiling the detection snippet:
```
/Applications/Xcode_15.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/TargetConditionals.h:140:50: error: missing binary operator before token "("
  140 | #if !defined(__has_extension) || !__has_extension(define_target_os_macros)
      |                                                  ^
```
Ref: https://github.com/curl/curl/actions/runs/9821817534/job/27117929218#step:6:1079

It occured with gcc-11 when combined with macOS SDK 14.4 and 14.5
(default SDKs in Xcode 15.3 and 15.4 respectively). It did not happen
with earlier releases.

Despite the failure in `./configure`, `lib/macos.c` compiled with
Apple's `TargetConditionals.h` just fine.

Turns out that including the `sys/types.h` header before the SDK
header fixes the error and makes the detection snippet compile.

Cherry-picked from #14097
Closes #14130

15 months agobuild: sync warning options between autotools, cmake & compilers
Viktor Szakats [Sat, 6 Jul 2024 14:00:03 +0000 (16:00 +0200)] 
build: sync warning options between autotools, cmake & compilers

- cmake: enable Apple-specific `-Werror=partial-availability` to match
  autotools.

- autotools: enable `-pedantic-errors` with llvm/clang to match gcc and
  CMake.

- autotools: enable `-Werror-implicit-function-declaration` for
  llvm/clang to match gcc.

- cmake: enable `-Werror-implicit-function-declaration` to match
  autotools.

- move `-Wpointer-bool-conversion` from autotools to the local file
  (`sectransp.c`) it was meant to apply. This way it applies to all
  build methods.

- autotoos: show `CURL_CFLAG_EXTRAS` in the `./configure` summary.
  (it may contain `-Werror` and/or `-pedentic-errors`.)

Cherry-picked from #14097
Closes #14128

15 months agoCI: simplify running curl with DLLs
Viktor Szakats [Tue, 9 Jul 2024 23:50:00 +0000 (01:50 +0200)] 
CI: simplify running curl with DLLs

- update `PATH` instead of copying DLLs around.
- drop redundant `export` from `export PATH`.
- delete ending pathseps.

Closes #14143

16 months agowolfssl: use larger error buffer when formatting errors
Alex Snast [Sun, 7 Jul 2024 09:18:28 +0000 (12:18 +0300)] 
wolfssl: use larger error buffer when formatting errors

Currently we're using WOLFSSL_MAX_ERROR_SZ to define the error buffer
size, this value is user defined which means it can be overwritten with
-DWOLFSSL_MAX_ERROR_SZ=512 when building wolfssl and this overwrite is
not exported to the users of wolfssl.

Instead of relying on WOLFSSL_MAX_ERROR_SZ we'll just use a 256 bytes
error buffer and use wolfSSL_ERR_error_string_n to fill it thus dropping
the dependency on WOLFSSL_MAX_ERROR_SZ altogether.

Closes #14114

16 months agoCI: bump FreeBSD Python packages
Viktor Szakats [Tue, 9 Jul 2024 20:43:56 +0000 (22:43 +0200)] 
CI: bump FreeBSD Python packages

Closes #14141

16 months agoGHA/curl-for-win: don't run if only another CI was changed
Viktor Szakats [Tue, 9 Jul 2024 20:56:12 +0000 (22:56 +0200)] 
GHA/curl-for-win: don't run if only another CI was changed

Closes #14142

16 months agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 9 Jul 2024 21:19:02 +0000 (23:19 +0200)] 
RELEASE-NOTES: synced

16 months agovtls: replace addsessionid with set_sessionid
Stefan Eissing [Mon, 8 Jul 2024 10:11:30 +0000 (12:11 +0200)] 
vtls: replace addsessionid with set_sessionid

- deduplicate the code in many tls backends that check
  for an existing id and delete it before adding the new one
- rename ssl_primary_config's `sessionid` bool to `cache_session`

Closes #14121

16 months agotest1175: scan libcurl-errors.md, not the generated .3 version
Daniel Stenberg [Mon, 8 Jul 2024 21:37:55 +0000 (23:37 +0200)] 
test1175: scan libcurl-errors.md, not the generated .3 version

Closes #14133

16 months agotest1139: scan .md files instead of .3 ones
Daniel Stenberg [Mon, 8 Jul 2024 21:33:10 +0000 (23:33 +0200)] 
test1139: scan .md files instead of .3 ones

As they are the canonical sources.

It still uses the curl.1 for command line option info.

Closes #14132

16 months agocf-socket: remove obsolete recvbuf
Stefan Eissing [Tue, 9 Jul 2024 10:36:13 +0000 (12:36 +0200)] 
cf-socket: remove obsolete recvbuf

- recvbuf was never enabled, remove all its code
- remove `fdsave`ing the socket as that is not longer needed

Closes #14138

16 months agotest1119: adapt for `.md` input
Viktor Szakats [Sun, 7 Jul 2024 01:15:56 +0000 (03:15 +0200)] 
test1119: adapt for `.md` input

Replace logic dealing with `.3` files to handle the Markdown syntax.

Follow-up to eefcc1bda4bccd800f5a56a0fe17a2f44a96e88b #12730
Cherry-picked from #14097
Closes #14125

16 months agotests: include current directory when running test Perl commands
Viktor Szakats [Sun, 7 Jul 2024 12:30:57 +0000 (14:30 +0200)] 
tests: include current directory when running test Perl commands

Necessary to find generated files in the out-of-tree build directory.
E.g. `tests/configurehelp.pm`, for tests 1119 and 1167.

Before this patch macOS autotools builds were failing these two tests
due to falling back to the default preprocessor (`cpp`) instead of
the actual one configured. Then `cpp` failing to compile Apple SDK
headers referenced by curl headers.

Cherry-picked from #14097
Closes #14124

16 months agoconfigure: sort feature list, lowercase protocols, use backticks
Viktor Szakats [Sun, 7 Jul 2024 17:32:09 +0000 (19:32 +0200)] 
configure: sort feature list, lowercase protocols, use backticks

- sort features case-insensitively to match `curl -V` and cmake.
  `sort -f` is POSIX, but check if it's available anyway.

- make protocols lowercase to match `curl -V` and cmake.

- replace two outlier `$()` with backticks.

Closes #14117

16 months agovariable.md: make example use expand
Yedaya Katsman [Sun, 7 Jul 2024 18:31:20 +0000 (21:31 +0300)] 
variable.md: make example use expand

I used double quotes since it seemed required for powershell, so this
example works in both (ba)sh and powershell as well as cmd.exe.

Closes #14118

16 months agoGIT-INFO.md: remove version requirements
Andy Reitz [Fri, 5 Jul 2024 23:42:17 +0000 (18:42 -0500)] 
GIT-INFO.md: remove version requirements

Keep them in docs/INTERNALS.md

Bump lowest perl to 5.8

Closes #14112

16 months agosectransp: fix `HAVE_BUILTIN_AVAILABLE` checks to not emit warnings
Viktor Szakats [Sat, 6 Jul 2024 01:23:08 +0000 (03:23 +0200)] 
sectransp: fix `HAVE_BUILTIN_AVAILABLE` checks to not emit warnings

`HAVE_BUILTIN_AVAILABLE` is a curl macro set via autotools and cmake.
Like other `HAVE_`s it signals availability if defined.

SecureTransport code was specifically looking for the value 1, which
triggered compiler warnings when the feature was not present.

Replace the existing workaround of locally suppressing the compiler
warning with using `defined()`.

autotools:
```
767 | #if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~
../../lib/vtls/sectransp.c: In function 'sectransp_connect_step1':
../../lib/vtls/sectransp.c:1140:52: error: "HAVE_BUILTIN_AVAILABLE" is not defined, evaluates to 0 [-Werror=undef]
 1140 | #if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~
../../lib/vtls/sectransp.c:1240:52: error: "HAVE_BUILTIN_AVAILABLE" is not defined, evaluates to 0 [-Werror=undef]
 1240 | #if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~
../../lib/vtls/sectransp.c: In function 'sectransp_connect_step2':
```
Ref: https://github.com/curl/curl/actions/runs/9815428701/job/27104448045#step:6:499

cmake gcc:
```
 1140 | #if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~
/Users/runner/work/curl/curl/lib/vtls/sectransp.c:1240:52: error: "HAVE_BUILTIN_AVAILABLE" is not defined, evaluates to 0 [-Werror=undef]
 1240 | #if (CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~
/Users/runner/work/curl/curl/lib/vtls/sectransp.c: In function 'sectransp_connect_step2':
/Users/runner/work/curl/curl/lib/vtls/sectransp.c:2231:51: error: "HAVE_BUILTIN_AVAILABLE" is not defined, evaluates to 0 [-Werror=undef]
 2231 | #if(CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11) && HAVE_BUILTIN_AVAILABLE == 1
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/9815428701/job/27104445425#step:8:355

Cherry-picked from #14097
Closes #14122

16 months agoexamples: suppress deprecation warnings locally
Viktor Szakats [Mon, 8 Jul 2024 14:02:21 +0000 (16:02 +0200)] 
examples: suppress deprecation warnings locally

Simplify making clean builds by silencing deprecation warnings inside
the example code where these may occur.

Drop related build tweaks/comments from GHA jobs.

Example warning:
```
curl/docs/examples/postit2-formadd.c:65:16: error: 'CURLFORM_COPYNAME' is deprecated: since 7.56.0. Use curl_mime_name() [-Werror=deprecated-declarations]
   65 |                CURLFORM_COPYNAME, "sendfile",
      |                ^~~~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/9841099503/job/27166970904#step:10:829

Closes #14123

16 months agoGHA/macos: bump parallel tests to -j5
Viktor Szakats [Sat, 6 Jul 2024 12:09:57 +0000 (14:09 +0200)] 
GHA/macos: bump parallel tests to -j5

Credit-to: Dan Fandrich
Cherry-picked from #11510 #14097

16 months agoGHA/windows: usability improvements
Viktor Szakats [Sun, 7 Jul 2024 15:23:51 +0000 (17:23 +0200)] 
GHA/windows: usability improvements

- move `curl --version` into separate step.

- move configure log to separate step. Run on success, too.

- add step with `curl_config.h` dump (full and brief/sorted).

- make `autoreconf` a separate step.

- add each job configuration a short name.

- shorten job names.
  Dedupe/drop redundant info, introduce abbreviations:
  AM = autotools, CM = CMake, U = Unicode, R = Release, not -> `!`, etc.
  Instead of mentioning `debug`, mentioned when it's not.

- simplify `PATH` forming for MSVC jobs.
  It's sufficient to add the release binary directory of vcpkg, the debug one
  is redundant.
  Follow-up to e26cbe20cbedbea0ca743dd33880517309315cb2 #13979

- other minor tidy-ups.

Closes #14116

16 months agoGHA/macos: delete misplaced `CFLAGS`, drop redundant CMake option
Viktor Szakats [Fri, 5 Jul 2024 00:25:27 +0000 (02:25 +0200)] 
GHA/macos: delete misplaced `CFLAGS`, drop redundant CMake option

With macOS there is a long-term struggle with deprecation warnings.
In curl they occur with LDAP, SecureTransport and in docs/examples.

There are three ways to fix them:
- by CFLAGS `-Wno-deprecated-declarations` as a workaround.
- by CFLAGS `-mmacosx-version-min` set to a version where the the
 feature was not deprecated.
- by CMake option `-DCMAKE_OSX_DEPLOYMENT_TARGET=`.

In GHA CMake jobs, all three were used, and `-mmacosx-version-min` was
set in a bogus way. Delete that bogus option, and delete the lone,
redundant CMake option too.

In a future commit I might replace the suppression option to properly
setting the target OS.

Follow-up to dfdd978f7c60224dffe2aac25b436dc0a5cd0186 #13491
Cherry-picked from #14097

16 months agomacos: add workaround for gcc, non-c-ares, IPv6, compile error
Viktor Szakats [Thu, 4 Jul 2024 03:26:21 +0000 (05:26 +0200)] 
macos: add workaround for gcc, non-c-ares, IPv6, compile error

Apple macOS SDK 13.0 and later are increasingly incompatible with gcc,
which started causing CI errors with the 20240701.9 revision of the
`macos-latest` (= `macos-14-arm64`) runner image.

This error is happening inside an Apple SDK header. We use the header
for calling a function in a resolver-related hack, in non-c-ares, IPv6
builds. You can avoid the problem by using c-ares or disabling IPv6
(or using clang, llvm, or a compatible gcc + SDK combination).

This patch fixes affected builds by declaring the ncessary framework
function manually, and not including the problematic header.

This workaround is ugly, doesn't cover all combinations, and fragile.

Other options are to disable this resolver-related hack for GCC, or to
replace it with a solution that doesn't rely on Apple SDK.

If you are aware of a stable fix or workaround, let us know.

gcc 12.4.0 + macOS SDK 14.0 (Xcode 15.0.1) error example:
```
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:54,
                 from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:30,
                 from /Users/runner/work/curl/curl/lib/macos.c:33,
                 from /Users/runner/work/curl/curl/build/lib/CMakeFiles/libcurl_shared.dir/Unity/unity_0_c.c:244:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:126:1: error: attributes should be specified before the declarator in a function definition
  126 | CF_INLINE CFOptionFlags CFUserNotificationCheckBoxChecked(CFIndex i) API_AVAILABLE(macos(10.0)) API_UNAVAILABLE(ios, watchos, tvos) {return ((CFOptionFlags)(1UL << (8 + i)));}
      | ^~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:127:1: error: attributes should be specified before the declarator in a function definition
  127 | CF_INLINE CFOptionFlags CFUserNotificationSecureTextField(CFIndex i) API_AVAILABLE(macos(10.0)) API_UNAVAILABLE(ios, watchos, tvos) {return ((CFOptionFlags)(1UL << (16 + i)));}
      | ^~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h:128:1: error: attributes should be specified before the declarator in a function definition
  128 | CF_INLINE CFOptionFlags CFUserNotificationPopUpSelection(CFIndex n) API_AVAILABLE(macos(10.0)) API_UNAVAILABLE(ios, watchos, tvos) {return ((CFOptionFlags)(n << 24));}
      | ^~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/9787982387/job/27025351601?pr=14096#step:7:18

The exact conditions are fuzzy. Oddly enough gcc 12.3.0 and the SDK
same as above are _compatible_:
https://github.com/curl/curl/actions/runs/9791701214/job/27036037162

Also notice that similar errors can also happen in SecureTransport
builds, due to the SDK headers required.

Ref: https://github.com/curl/curl/pull/14097#issuecomment-2208639046
Ref: https://github.com/curl/curl/pull/14091#issuecomment-2205870854
Cherry-picked from #14097
Closes #14119

16 months agocmake: feature casing fix and tidy-ups
Viktor Szakats [Sun, 7 Jul 2024 17:29:08 +0000 (19:29 +0200)] 
cmake: feature casing fix and tidy-ups

- fix casing of a feature (`Unicode`) in the feature list.
- sort TLS backends case-insensitively.
- sync feature/protocol list heading with `curl -V` and autotools.

Closes #14120

16 months agoGHA: ignore FTP test result in Windows jobs
Viktor Szakats [Sun, 7 Jul 2024 15:25:42 +0000 (17:25 +0200)] 
GHA: ignore FTP test result in Windows jobs

They are flaky.

E.g.:
- old-mingw-w64 7.3.0: 2001, 2039, 2083
- msvc: 1501, 593 (multiple)

Ref: https://github.com/curl/curl/pull/13599#issuecomment-2119372376
Cherry-picked from #14116

16 months agoGHA: improve vcpkg cache, add BoringSSL ECH and LibreSSL MSVC jobs
Viktor Szakats [Sun, 7 Jul 2024 13:39:31 +0000 (15:39 +0200)] 
GHA: improve vcpkg cache, add BoringSSL ECH and LibreSSL MSVC jobs

- cache on a per-package basis.
  Replace manual caching with a built-in solution. It shares cached
  package builds between jobs, e.g. libssh2 only builds once
  per platform (instead of once per job). Individual packages are built
  as needed (not the whole per-job tree). It also fixes the duplicate
  cache entry issues.
  Ref: https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache
  Follow-up to e26cbe20cbedbea0ca743dd33880517309315cb2 #13979
  Follow-up to cb22cfca69bded45bf7f9c72c8e6764990490f11 #14077

- add BoringSSL job with ECH enabled. The first such job in the curl CI.

- add LibreSSL job.

- use vcpkg pre-installed on the runner image, instead of rolling our
  own. This is quicker, simpler and more robust.
  Follow-up to e26cbe20cbedbea0ca743dd33880517309315cb2 #13979

- show pre-installed vcpkg and ports version.

- drop `gsasl` dependency till it reaches the pre-installed vcpkg ports.

- re-add `find .` to see the binaries generated.

- simplify setting up `PATH`.

- exclude failing tests for any job enabling WinIDN.

- drop collecting and uploading log archives. We already dump CMake
  logs, and our build doesn't use Ninja. Rest of files weren't generated
  by the curl build. We don't aim to debug vcpkg package builds.

Closes #14090

16 months agoGHA: add MSVC UWP job, expand jobs with more options
Tal Regev [Fri, 21 Jun 2024 13:12:07 +0000 (16:12 +0300)] 
GHA: add MSVC UWP job, expand jobs with more options

- add new dependencies: brotli, libpsl (requires libicu2) and gsasl.

- enable WinIDN in a job. Exclude failing tests.

- add UWP job and fix the build logic to support it.

- increase timeouts to build the new dependencies.

Assisted-by: Viktor Szakats
Closes #14077

16 months agotests: fix sshd UserKnownHostsFile path for MinGW/Cygwin
Dan Fandrich [Sun, 7 Jul 2024 05:04:53 +0000 (22:04 -0700)] 
tests: fix sshd UserKnownHostsFile path for MinGW/Cygwin

This is the same thing as the previous commit fd194f46 but on the next
line.

Follow-up to 70d2fca2

Ref: #10818

16 months agotests: fix sshd IdentityFile path for MinGW/Cygwin
Dan Fandrich [Sat, 6 Jul 2024 08:16:06 +0000 (01:16 -0700)] 
tests: fix sshd IdentityFile path for MinGW/Cygwin

This was missed during some refactoring more than a year ago and is
causing a warning "Use of uninitialized value $path in pattern match".

Follow-up to 70d2fca2

Ref: #10818
Closes #14113

16 months agobuild: add Debug, TrackMemory, ECH to feature list
Viktor Szakats [Thu, 4 Jul 2024 03:04:35 +0000 (05:04 +0200)] 
build: add Debug, TrackMemory, ECH to feature list

Also:

- remove stray `ECH` and `HTTPSRR` from cmake protocol list.

- stop excluding `Debug` and `TrackMemory` in `test1013.pl`.

- configure: delete `CURL_CHECK_CURLDEBUG` check.
  Ref: 065047dc62cba3efde597fa5420d112fc2f4c500
  This check was effectively doing nothing, except disabling
 `--enable-curldebug` in `curl-config` for
 Cygwin/MSYS/cegcc/OS2/AIX targets with c-ares enabled.

Closes #14096

16 months agoCI: bump the libc6 on the linux-old build
Dan Fandrich [Sat, 6 Jul 2024 03:19:44 +0000 (20:19 -0700)] 
CI: bump the libc6 on the linux-old build

This contains some security fixes for nscd.

16 months agoreuse: fix typo in comment
Viktor Szakats [Sat, 6 Jul 2024 00:39:14 +0000 (02:39 +0200)] 
reuse: fix typo in comment

Follow-up to 9104bad82004d908e1fe66a425f8ca78f975045d #14107

16 months agoCI: Fix typo in comment
Dan Fandrich [Fri, 5 Jul 2024 17:02:53 +0000 (10:02 -0700)] 
CI: Fix typo in comment

16 months agocurl: follow-up to fix categories in --help
Dan Fandrich [Fri, 28 Jun 2024 21:41:29 +0000 (14:41 -0700)] 
curl: follow-up to fix categories in --help

The commit 6483813b was missing changes necessitated by 2abfc75 that
causes a crash. Also, use ARRAYSIZE() for cleaner code.

Follow-up to 6483813b

Ref #14055

16 months agocurl: list categories in --help
Dan Fandrich [Fri, 28 Jun 2024 21:41:29 +0000 (14:41 -0700)] 
curl: list categories in --help

This eliminates the need to run an extra help subcommand to get the
possible categories, reducing the friction in getting relevant help. The
help wording was also slightly tweaked for grammatical accuracy.

Closes #14055

16 months agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 5 Jul 2024 21:06:24 +0000 (23:06 +0200)] 
RELEASE-NOTES: synced

16 months agoGHA: update actions/upload-artifact and actions/download-artifact
renovate[bot] [Fri, 5 Jul 2024 17:52:52 +0000 (17:52 +0000)] 
GHA: update actions/upload-artifact and actions/download-artifact

update actions/upload-artifact digest to 0b2256b
update actions/download-artifact digest to fa0a91b

Closes #14111
Closes #14110

16 months agoreuse: switch to REUSE 3.2 and REUSE.toml
Max Mehl [Fri, 5 Jul 2024 12:09:32 +0000 (14:09 +0200)] 
reuse: switch to REUSE 3.2 and REUSE.toml

- remove scripts/copyright.pl

Closes #14107

16 months agocurl: move more options to deprecated category
Yedaya Katsman [Fri, 5 Jul 2024 15:14:58 +0000 (18:14 +0300)] 
curl: move more options to deprecated category

--no-npn, --sslv2, --sslv3

Closes #14109

16 months agomulti: pollset assertion only when IP connected
Stefan Eissing [Fri, 5 Jul 2024 12:09:22 +0000 (14:09 +0200)] 
multi: pollset assertion only when IP connected

Give warning for an empty pollset only when the connection has at least
IP connectivity. There are cases where the connect in QUIC makes another
attempt on a timeout and no socket will be available during that.

Closes #14108

16 months agocmdline-opts: category cleanup 14101/head
Daniel Stenberg [Thu, 4 Jul 2024 11:38:18 +0000 (13:38 +0200)] 
cmdline-opts: category cleanup

Option cleanups:

 --get is not upload
 --form* are post
 - added several options into ldap, smtp, imap and pop3
 - shortened the category descriptions in the list

category curl fixes:

 --create-dirs removed from 'curl'
 --ftp-create-dirs removed from 'curl'
 --netrc moved to 'auth' from 'curl'
 --netrc-file moved to 'auth' from 'curl'
 --netrc-optional moved to 'auth' from 'curl'
 --no-buffer moved to 'output' from 'curl'
 --no-clobber removed from 'curl'
 --output removed from 'curl'
 --output-dir removed from 'curl'
 --remove-on-error removed from 'curl'

Add a "global" category:

- Made all "global" options set this category

Add a "deprecated" category:

- Moved the deprecated options to it (maybe they should not be in any
 category long term)

Add a 'timeout' category

- Put a number of appropriate options in it

Add an 'ldap' category

- Put the LDAP related option in there

Remove categories "ECH" and "ipfs"

- They should not be categories. Had only one single option each.

Remove category "misc"

- It should not be a category as it is impossible to know when to browse
  it.

--use-ascii moved to ftp and output
--xattr moved to output
--service-name moved to auth

Managen fixes:

- errors if an option is given a category name that is not already setup
  for in code

- verifies that options set `scope: global` also is put in category
  `global´

Closes #14101