Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from curl:master #278

Open
wants to merge 1,301 commits into
base: master
Choose a base branch
from
Open

[pull] master from curl:master #278

wants to merge 1,301 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Apr 6, 2024

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

vszakats and others added 16 commits August 22, 2024 00:01
Stop #undefining macros that were not redefined or used in the code.

Closes #14631
also done in CURLOPT_PROGRESSFUNCTION.md

This changes the wording to say that 1 should be returned instad of
non-zero to return error from the callback. I did this to simplify, even
if other non-zero values still do the same thing I figure we might just
as well just leave out the others from the documentation.

Fixes #14627
Reported-by: Benjamin Riefenstahl Mecom
Closes #14637
Sources used `lib/curlx.h` with both `ENABLE_CURLX_PRINTF` set and unset
before including it.

In a cmake "unity" batch where the first included source had it unset,
the next sources did not get the macros requested with
`ENABLE_CURLX_PRINTF` because `lib/curl.x` had already been included
without them.

Fix it by by making the macros enabled permanently and globally for
internal sources, and dropping `ENABLE_CURLX_PRINTF`.

This came up while testing unity builds with smaller batches. The full,
default unity build where all `src` is bundled up in a single unit, was
not affected.

Fixes:
```
$ cmake -B build -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=15
$ make -C build
...
curl/src/tool_getparam.c: In function ‘getparameter’:
curl/src/tool_getparam.c:2409:11: error: implicit declaration of function ‘msnprintf’; did you mean ‘vsnprintf’? [-Wimplicit-function-declaration]
 2409 |           msnprintf(buffer, sizeof(buffer), "%" CURL_FORMAT_CURL_OFF_T "-",
      |           ^~~~~~~~~
      |           vsnprintf
curl/src/tool_getparam.c:2409:11: warning: nested extern declaration of ‘msnprintf’ [-Wnested-externs]
[...]
```

Reported-by: Daniel Stenberg
Bug: #14626 (comment)

Closes #14632
Add tweak for mingw-w64 when building tests/http/client programs to
avoid a bogus `-Wformat` warning when using mingw-w64 v7.0.0 or older.
The warning is bogus because these programs use curl's `printf()`
implementation that is guaranteed to support that format spec.

Add this for both CMake and autotools. (But only CMake is CI tested with
an old toolchain.)

Apply the workaround to `docs/examples`, and fix an example to use
curl's `printf()` with `CURL_FORMAT_CURL_OFF_T`.

Reintroduce curl `printf()` calls into `tests/http/client`, via #14625.
Also restore large number masks to a printf, changed earlier in #14382.

Follow-up to 232302f #14382
Ref: #14625 (comment)

Closes #14640
Reported-by: Hiroki Kurosawa
Closes #14642
Running the http pytest had to be done from tests directory or above,
because the repeat argument fixture was defined in tests/conftest.py.
However, the repeat argument is not needed because its functionality
can be provided by pytest-repeat as documented in the test's
README.md. So, removed the pytest_addoption function for the repeat
argument and the pytest_report_header function is moved to
tests/http/conftest.py.

TODO: Remove repeat argument from all tests. As a stopgap, a
one-element list is defined for it for now.

Closes #14611
Had multiple failures on test_17_09_ssl_min_max with --tlsv1 and
--tlsv1.3.

Closes #14621
SECURITY.md has a recently added section titled OpenSSF Scorecard
that actually documents OpenSSF Best Practices. Scorecard [0] is a
different OpenSSF project, that incorporates Best Practices, but is
distinct in its objectives and how it achieves them.
This change clarifies the terminology, and also removes any
implication that Gold Best Practices is an award rather than a self
certification programme.
As curl was a leader in implementing Best Practices some folk may be
more familiar with the earlier Core Infrastructure Initiative (CII)
naming, so a reference to that has been added.

[0] https://scorecard.dev/

Signed-off-by: Chris Swan <478926+cpswan@users.noreply.github.com>
Ref: #14319
Closes #14635
Also:
- move `then`s and an `in` inline.
- whitespace.

Closes #14628
A couple of seemingly random calls used them.
They were all mapped to `curl_m*printf()`.

Closes #14647
... in code that previously was not checksrc'ed

Closes #14625
This job unconditionally runs checksrc on ALL .c and .h files present in
git.

checksrc.pl: fixed to look for ".checksrc" in the same directory from
where it loads the file to check so that it an be invoked like this

Closes #14625
Allow interface.md to use more exclamation marks.

Closes #14645
gbrlmarn and others added 30 commits September 18, 2024 15:27
- perform torture tests with '-j2' for shorter runtime
- when waiting on test results overly long, log the tests
  waited for and eventually log the test log directories
  for easier analysis what is wrong in CI jobs.
- sockfilt.c: treat the windows errno 109 (ERROR_BROKEN_PIPE)
  as a socket closed by the client and do not exit.
- when verifying https server, do not in addition check
  the http server behind it also
- when tearing down the stunnel of a non-responsive https
  server, tear down the http server with it

Closes #14960
- drop `tasklist` call before `taskkill`.
  `taskkill` offers two ways to kill a `pid`:
  1. `-pid <pid>`
     If `<pid>` is missing it returns 128 and outputs:
     ```
     ERROR: The process "<pid>" not found.
     ```
  2. `-fi "PID eq <pid>"`
     If `<pid>` is missing, it returns 0 and outputs:
     ```
     INFO: No tasks running with the specified criteria.
     ```
  The curl runner script doesn't check the result of the call and both
  stdout and stderr are redirected to NUL.
  Meaning the `tasklist` calls pre-verifying if the PID exists are not
  necessary and we can drop them to put less strain on the runner
  environment.

- log a `taskkill` call missed earlier.
  Follow-up to e53523f #14859

- streamline `taskkill` calls by using the `-pid` option
  (was `-fi <filter-expression>`).

- make `taskkill` in `pidterm()` use `-t` to kill the process tree.

Ref: #11009
Closes #14959
- drop redundant internal variable `USE_ZLIB`, rely on `HAVE_LIBZ`.

- rename `optional_dependency()` -> `curl_dependency_option()`
  Make `grep 'option('` hit this option. Namespaced.
  It has a single use with `ZLIB`.

Closes #14918
No need to set them `ON` again.

Closes #14924
... as checksrc now finds and complains about these.

Closes #14921
Some of the `.in` files were listed in `EXTRA_DIST`. Delete them.

`.in` files (passed to `AC_CONFIG_FILES`) are added automatically
to the distro by autotools.

Closes #14821
Disable OpenSSL by default if any of these alterntive TLS backends were
explicitly selected.

Following the logic already in place for Schannel, Secure Transport,
mbedTLS and wolfSSL.

Closes #14828
`arc4random()` is no longer used if any TLS backend is active.
Limit feature detection to builds with no TLS backend.

Closes #14909
- move `EXTRA_DIST` to the top of file.
- move `checksrc` init next to use.
- use variable `HUGE` instead of repeating a literal.

Cherry-picked from #14815
Closes #14933
- cmake: drop `configure.os`.
  This also includes OS version, but thus far it's not important enough
  to include it.
- autotools: drop redundant, autotools-only `{target|host}.vendor`.
  (it's part of the triplet in `{target|host}`.)
- swap order to `*.cpu` -> `*.os` to match triplet-order.
- cmake: drop redundant `target`.
  It's manually filled and only in a (so far) few CI jobs. Let's revisit
  when this becomes useful.
- move `buildinfo.txt` to build root.
- dist: add `buildinfo.txt` to `DISTCLEANFILES`.
- autotools: detect human readable compiler version.
- autotools: replace `XXYY` `compiler.version` with "X.Y"-style.
  (also to match cmake.)
- autotools: use distinct `compiler_id` for Apple clang: `APPLECLANG`.
  To match cmake and also because the the "X.Y"-style version number
  is the Apple version, while `XXYY` was a value roughly translated to
  mainline llvm/clang version.
- show buildinfo at the end of the configure stage, when run in CI, or
  when `CURL_BUILDINFO` or `CURL_CI` env is set.

Follow-up to 1fdea16 #14802
Assisted-by: Dan Fandrich
Ref: #14802 (comment)
Closes #14822
It allows finding the ngtcp2 crypto interface library automatically when
using a custom `NGTCP2_LIBRARY`.

Before this patch the library location had to be added via
`CMAKE_LIBRARY_PATH` or by other means.

Also add empty lines for readability / uniformity.

Fixes https://github.com/curl/curl-for-win/blob/8b8909e1206de1dcca356a8dd33eb1e4ffeea7fd/curl.sh#L289
Closes #14905
Collect all ready runners from select() and process in a loop. This
assures fairness in processing among all runners.

Formerly, only the first ready runner in the list of all was processed,
leading to later runners being delayed in processing and reporting
overly long test durations.

Also, reduce the backend idle timeout for the h2/h3 test servers so that
process shutdowns take less time.

Closes #14967
Both are used by `./configure` internally, not by curl C code.
CMake adds `NEED_LBER_H` to `CURL_TEST_DEFINES`, which is used by
`curl_internal_test()`, but there is no LDAP-related test made with that
call.

Thus, stop detecting and publishing these from CMake.

`NEED_LBER_H` added in 7320e53.
`HAVE_LDAP_H` added in 4c5307b (initial CMake commit).

Closes #14690
… issues

Patch started out for working around compiler warnings in BearSSL latest
tarball release v0.6 (2018-08-14) and Apple clang 14 with CMake.

Then turned into patching CMake and `Makefile.mk` builds to use
`-isystem` instead `-I` when adding header directories for
dependencies. This avoids compiler warnings in dependency headers,
syncing behaviour with autotools.

Also:
- `Makefile.mk`: add support for BearSSL.
- delete warning suppression for mbedTLS headers. No longer necessary
  after this patch.
  Follow-up to 434db99 #12720

Silenced BearSSL warnings:
```
In file included from curl/lib/vtls/bearssl.c:28:
In file included from bearssl/inc/bearssl.h:127:
bearssl/inc/bearssl_hash.h:727:5: warning: 'BR_DOXYGEN_IGNORE' is not defined, evaluates to 0 [-Wundef]
    ^
bearssl/inc/bearssl_hash.h:745:5: warning: 'BR_DOXYGEN_IGNORE' is not defined, evaluates to 0 [-Wundef]
    ^
In file included from curl/lib/vtls/bearssl.c:28:
In file included from bearssl/inc/bearssl.h:136:
bearssl/inc/bearssl_ssl.h:1253:20: warning: implicit conversion loses integer precision: 'unsigned int' to 'uint16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
        cc->version_min = version_min;
                        ~ ^~~~~~~~~~~
bearssl/inc/bearssl_ssl.h:1254:20: warning: implicit conversion loses integer precision: 'unsigned int' to 'uint16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
        cc->version_max = version_max;
                        ~ ^~~~~~~~~~~
bearssl/inc/bearssl_ssl.h:1327:28: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
        ctx->protocol_names_num = num;
                                ~ ^~~
5 warnings generated.
```

(These warnings were fixed in BearSSL Git master in 2019 via
2893441f2efd4603ddd6d7f49011bdda096a4a87 and
ecdf89770ee82dfea6186fb4369cff3d06cd852e.)

Also these two cases, which are caused by an unidentified component
(outside curl) cranking up MSVC warnings in external headers to `/W4`
when ZLIB is deselected:
#14859 (comment)

mbedTLS 3.6.1:
```
C:\vcpkg\installed\x64-windows\include\psa\crypto_struct.h(254,13): error C2220: the following warning is treated as an error [D:\a\curl\curl\bld\lib\libcurl_object.vcxproj]
  (compiling source file 'CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c')
C:\vcpkg\installed\x64-windows\include\psa\crypto_struct.h(254,13): warning C4200: nonstandard extension used: zero-sized array in struct/union [D:\a\curl\curl\bld\lib\libcurl_object.vcxproj]
  (compiling source file 'CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c')
```
Ref: https://github.com/curl/curl/actions/runs/10842694205/job/30107466989?pr=14859#step:10:29

nghttp3 1.5.0:
```
C:\vcpkg\installed\x64-windows\include\nghttp3\nghttp3.h(2678,1): error C2220: the following warning is treated as an error [D:\a\curl\curl\bld\lib\libcurl_object.vcxproj]
  (compiling source file 'CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c')
  C:\vcpkg\installed\x64-windows\include\nghttp3\nghttp3.h(2678,1): warning C4324: 'nghttp3_pri': structure was padded due to alignment specifier [D:\a\curl\curl\bld\lib\libcurl_object.vcxproj]
  (compiling source file 'CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c')
```
Ref: https://github.com/curl/curl/actions/runs/10871875297/job/30166233862?pr=14859#step:10:28

Closes #14763
Rename internal macro to make its purpose more obvious.

After this patch `grep -i uwp` shows all the code related to UWP.

Ref: https://curl.se/mail/lib-2024-09/0014.html
Closes #14881
There shouldn't be anything displayed during a normal run, but only if
server debugging is enabled. Also, set log_file to a magic value to
disable it, otherwise impacket installs its own logger that messes with
what we want.

Closes #14950
- fix MSH3 static symbol clash.
- fix Quiche static symbol clash.
- fix local macro clash with BearSSL header.
- fix local macro clash with OmniOS system header.
  ```
  In file included from ../../lib/urldata.h:197,
                     from ../../lib/altsvc.c:32,
                     from libcurlall.c:2:
    ../../lib/cf-socket.h:55:25: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
       55 | #define sa_addr _sa_ex_u.addr
          |                         ^
    In file included from ../../lib/urldata.h:197,
                     from ../../lib/altsvc.c:32,
                     from libcurlall.c:2:
    ../../lib/cf-socket.h:55:25: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
       55 | #define sa_addr _sa_ex_u.addr
          |                         ^
  ```
  Ref: https://github.com/curl/curl/actions/runs/10738314933/job/29781644299?pr=14772#step:3:6115

Discovered while adding support for "unity" builds for autotools.

Required-by: #14922
Cherry-picked from #14815
Closes #14932
Makes building tests noticeably faster.

Apply changes/fixes/workarounds to make Unity work:
- rename test variables to avoid collisions or shadowing each other when
  combined into single units.
- add workaround to avoid applying `lib/memdebug.h` overrides to system
  headers declaring/defining `getaddrinfo()`/`freeaddrinfo()` for
  `tests/server/resolve.c`. This replaces a previous workaround that
  worked for that specific source.
- rename test macro `CTRL` clashing with Cygwin `sys/ioctl.h`.
- add include guard to `test.h`.

Also:
- exclude `tests/http/clients` which are all single-source. (like
  `docs/examples`.)

Build time improvements for tests:
- AppVeyor CI:
  - MSVC 2008, 2010: 1 minute faster (4m8s -> 2m56s, 3m19s -> 2m24s)
  - MSVC 2022 arm64: 3.5 minutes faster (10m18s -> 6m48s)
  before: https://ci.appveyor.com/project/curlorg/curl/builds/50522785
  after: https://ci.appveyor.com/project/curlorg/curl/builds/50522942
- GHA:
  - Cygwin: 1.5 minutes faster (3m13s -> 1m43s)
    before: https://github.com/curl/curl/actions/runs/10681535327/job/29605384398
    after: https://github.com/curl/curl/actions/runs/10680818726/job/29603130637
  - Windows:
    before: https://github.com/curl/curl/actions/runs/10680818713
    after: https://github.com/curl/curl/actions/runs/10683850187
    - MSYS2, mingw-w64: 1 minute faster
    - MSVC: 30 seconds faster (3m17s -> 2m48s)
  - macOS: double speed (39s -> 18s)
    before: https://github.com/curl/curl/actions/runs/10680818753/job/29603133447
    after: https://github.com/curl/curl/actions/runs/10683850174/job/29612914515
  - Linux: almost double speed (30/31s -> 18s)
    before: https://github.com/curl/curl/actions/runs/10681535311/job/29605387156
    after: https://github.com/curl/curl/actions/runs/10680818721/job/29603133976
  - non-native: no obvious effect.
    before: https://github.com/curl/curl/actions/runs/10680818722
    after: https://github.com/curl/curl/actions/runs/10683850187
  - Old Linux: Unity mode not supported by old CMake, no effect.

Closes #14765
Or no-HTTP, no-HSTS builds, also MSH3 builds.

CMake, VS2022, Debug, x64, no SSL, Static, Build-only:
```
C:\projects\curl\tests\unit\unit1660.c(46,1): error C2220: the following warning is treated as an error
C:\projects\curl\tests\unit\unit1660.c(46,1): warning C4702: unreachable code
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/50531210/job/cjewvo9agavthr3o#L216

Required-by: #14922
Cherry-picked from #14772
Closes #14971
Ubuntu has the `pkgconf` package installed by default that implements
the `pkg-config` command. Switch CI `apt` commands over to `pkgconf`
to avoid replacing it in every job run.

Avoids:
```
The following packages will be REMOVED:
  pkgconf r-base-dev
The following NEW packages will be installed:
  [...] pkg-config [...]
```
https://github.com/curl/curl/actions/runs/10949915766/job/30404126342?pr=14972#step:2:20

Closes #14974
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.