Commit Graph

32685 Commits

Author SHA1 Message Date
Viktor Szakats
46ef34c053
GHA/windows: use default shell CI feature
It makes repeating a line in each step unnecessary.

Closes #14206
2024-07-19 01:32:05 +02:00
Viktor Szakats
1e75edd372
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

db135f8d72 #14119 macos: add workaround for gcc, non-c-ares, IPv6, compile error
Ref: e2db3c475f
Ref: f5c58d7fef

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: fd5530b7cb
gcc-13: cb7e4eca68
gcc-14: ff62a10886

That applied to Homebrew GCC (12.4.0):
b904223d98 (diff-89dd0b4176eca7fcc24b591943509bf8a8d6ea904d71e5dfcd6b78fed62fc574R44-R48)

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

e91fcbac7d #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`.

baa3270846 #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`.

ff784af461 #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.

e1f6192939 #14130 configure: fix `SystemConfiguration` detection

6. Differences between autotools and CMake compiler options

Fixed it by syncing compiler warning options.

59cadacfcc #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.

f43adc2c49 #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.

764fbabf6e #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.

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

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

d2ef6255f4 #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.

3765d75ce4 #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.

efc2c5184d #14124 tests: include current directory when running test Perl commands
c09db8b51b #14129 cmake: create `configurehelp.pm` like autotools does
67cc1e3400 #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.

fd0250869f #14179 #14176 IDN: fix ß with AppleIDN

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

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

Pending merge:
2024-07-19 01:21:31 +02:00
Daniel Stenberg
792a17d747
RELEASE-NOTES: synced 2024-07-19 00:04:04 +02:00
Stefan Eissing
be93299f10
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
2024-07-18 23:27:35 +02:00
Bhanu Prakash
c98f6fcde7
mbedtls: correct the error message for cert blob parsing failure
Closes #14224
2024-07-18 23:19:06 +02:00
Daniel Stenberg
8c1d9378ac
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
2024-07-18 18:04:09 +02:00
Stefan Eissing
d8696dc8c0
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
2024-07-18 15:13:30 +02:00
Daniel Stenberg
5eba0a4b37
tests/scripts: call it 'manpage' (single word)
Mostly in comments

Closes #14216
2024-07-18 15:12:09 +02:00
Alex Snast
f504db8928
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
2024-07-18 15:08:03 +02:00
Daniel Stenberg
c3c7992ac7
idn: make macidn fail before trying conversion if name too long
- double the max name length to 512 bytes

Closes #14215
2024-07-18 14:47:54 +02:00
z2_
686d54baf1
idn: tweak buffer use when converting with macidn
Closes #14215
2024-07-18 14:47:42 +02:00
Orgad Shaneh
0dbc4eb06e
lib: add failure reason on bind errors
Closes #14221
2024-07-18 14:47:00 +02:00
Stefan Eissing
35ed3f7a89
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
2024-07-18 14:45:40 +02:00
Viktor Szakats
1dd71312bf
runtests: fix newline glitch in FAIL details
Follow-up to bae5553599 #14174
2024-07-18 01:10:29 +02:00
Viktor Szakats
bae5553599
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
2024-07-16 11:56:34 +02:00
Tal Regev
dfbdcb93ae
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
2024-07-16 11:56:34 +02:00
Viktor Szakats
09cdf7e531
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
2024-07-16 11:46:26 +02:00
Viktor Szakats
c09db8b51b
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 efc2c5184d #14124
Cherry-picked from #14097
Closes #14129
2024-07-16 11:41:52 +02:00
Viktor Szakats
d2ef6255f4
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 082bb41311 #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
2024-07-16 11:33:52 +02:00
Viktor Szakats
d3595c74fa
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 082bb41311 #2545
Closes #14186
2024-07-16 11:33:52 +02:00
Viktor Szakats
58772b0e08
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 0e73b69b3d
Fixes #14173
Closes #14187
2024-07-16 02:13:48 +02:00
Viktor Szakats
c21c51db6a
GHA/windows: verify 1448 2046 2047 in IDN Unicode jobs
These IDN tests pass with Unicode and fail without.

Follow-up to cb22cfca69 #14077
Closes #14188
2024-07-16 00:47:22 +02:00
Viktor Szakats
18f1cd7a77
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
2024-07-16 00:44:55 +02:00
Stefan Eissing
9e5b11c659
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
2024-07-15 23:47:33 +02:00
Stefan Eissing
6f0a8bd43c
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
2024-07-15 23:24:11 +02:00
Stefan Eissing
f4b8b976b4
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
2024-07-15 23:11:21 +02:00
Daniel Stenberg
50a7602b78
RELEASE-NOTES: synced 2024-07-14 23:22:11 +02:00
Viktor Szakats
4c22d97be7
build: use #error instead of invalid syntax
It reduces configure log noise.

Follow-up to 20c1b2d75e #13287
Closes #14181
2024-07-14 14:03:00 +02:00
Daniel Stenberg
8dab7465a5
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
2024-07-14 13:44:24 +02:00
MonkeybreadSoftware
fd0250869f
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
2024-07-14 09:53:40 +02:00
Viktor Szakats
764fbabf6e
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
2024-07-14 09:42:34 +02:00
Viktor Szakats
3765d75ce4
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 48eb71ade4 #10322
Cherry-picked from #14097
Closes #14172
2024-07-13 12:00:14 +02:00
Viktor Szakats
5fa534b0da
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: 8d7172d20a

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 59cadacfcc #14128
Follow-up to af271ce9b9 #1722
Follow-up to 2b7ce3f56d #1706
Cherry-picked from #14097
Closes #14162
2024-07-13 12:00:13 +02:00
Viktor Szakats
2a7c8b27fd
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
2024-07-13 04:03:05 +02:00
Viktor Szakats
1448218b84
GHA/windows: re-add gsasl to MSVC jobs
Now that the package reached the CI runner image.

Follow-up to f99c08dba4 #14090
Follow-up to e26cbe20cb #13979

Closes #14170
2024-07-12 17:03:24 +02:00
Viktor Szakats
6343034dd1
tidy-up: adjust casing of project names
Mostly TLS/SSH project name.

Closes #14160
2024-07-12 13:56:16 +02:00
Daniel Stenberg
f94aa3d97f
ISSUE_TEMPLATE/docs: correct the field identifiers 2024-07-12 12:22:15 +02:00
Stephen Farrell
6a5bb68556
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
2024-07-12 12:16:56 +02:00
Daniel Stenberg
91530abc1e
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
2024-07-12 12:16:06 +02:00
Viktor Szakats
2e930c3336
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
2024-07-12 01:35:10 +02:00
Viktor Szakats
ff784af461
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
6e1f19168b
https://github.com/llvm/llvm-project/pull/82833
e5ed7b6e2f

Cherry-picked from #14097
Closes #14159
2024-07-12 00:36:25 +02:00
Viktor Szakats
e91fcbac7d
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: fd5530b7cb
gcc-13: cb7e4eca68
gcc-14: ff62a10886

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
  8433baadec
  https://discourse.llvm.org/t/changing-attribute-ast-printing-location-for-gcc-compatibility/73215
  https://reviews.llvm.org/D159362

Follow-up to db135f8d72 #14119
Ref: https://github.com/curl/curl/pull/14091#issuecomment-2222703468
Fixes #13700
Cherry-picked from #14097
Closes #14155
2024-07-12 00:32:39 +02:00
Daniel Stenberg
682c357f7f
ISSUE_TEMPLATE/docs: add a separate GitHub issue template for documentation
As such problems don't really fit the code related template

Closes #14161
2024-07-11 23:56:20 +02:00
Dan Fandrich
1263bf6964 DISTROS: add AlmaLinux package source link 2024-07-11 12:52:58 -07:00
Viktor Szakats
a98298487d
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 0b81eccd22
2024-07-11 21:40:33 +02:00
Daniel Stenberg
16f56583e5
libcurl-easy.md: now *more* than 300 options
it previously said "almost 300".

Also cleaned up the language somewhat.

Closes #14153
2024-07-11 16:02:41 +02:00
Martin Peck
b7f2c66d7d
MANUAL.md: wrap two example urls that overrun styling
Closes #14149
2024-07-10 23:39:39 +02:00
renovate[bot]
bf251cc0d2
GHA: update wolfSSL and mod_h2
- wolfSSL/wolfssl to v5.7.2
- icing/mod_h2 to v2.0.29

Closes #14131
Closes #14148
2024-07-10 16:27:21 +02:00
Dominik Piątkowski
95776c9ab5
docs: start markdown headers with capital letter where applicable
Closes #14115
2024-07-10 16:24:25 +02:00
CMD
c2e427cc93
hostip: skip error check for infallible function call
Closes #14147
2024-07-10 16:14:06 +02:00