Files
jak-project/third-party/curl/tests/data/test506
T
Alexander J. Semenuk 5d5e35fb9b fix: Windows toolchain compatibility (curl 8.21 re-vendor, endless reconfigure loop) (#4355)
## Problem

Windows builds break with a current local toolchain (Scoop LLVM 22.1.8,
CMake 4.4.0, VS 2026), in two independent ways:

1. The build stops at curl's deliberate guard: `#error "no non-blocking
method was found/used/set"` in `third-party/curl/lib/nonblock.c`.
2. From the second configure onward, `cmake --build` re-runs CMake in an
endless loop (observed 42 consecutive reconfigure cycles in a single
build). Likely the same mechanism behind the "endlessly building" VS
2026 note in `docs/setup/dev/vs.md`.

## Root cause

1. `third-party/curl/CMake/CurlTests.c` passes `int *` to
`ioctlsocket()`, whose third parameter is `u_long *`. Clang 22 promotes
`-Wincompatible-pointer-types` to a hard error in C, so the
`HAVE_IOCTLSOCKET_FIONBIO` try_compile silently fails and
`curl_config.h` never defines it. Upstream CI does not see this because
the windows-2022 runner image ships an older LLVM. GCC 14 promotes the
same warning to a hard error, which is very likely the `CurlTests.c.obj`
failure reported from MSYS2 in open-goal/jak-project#3551. Upstream curl
hit the identical problem with GCC 14 and fixed the probe in curl 8.8.0
(curl/curl#13578).
2. The root CMakeLists copies the build tree's `compile_commands.json`
into `<src>/build/` for clangd using `configure_file()`, which registers
its input as a configure dependency. CMake rewrites
`compile_commands.json` late in every generation, after
`CTestTestfile.cmake` and `cmake_install.cmake` (outputs of the same
Ninja regen rule), so once the dependency is registered the rule is
deterministically dirty and every `ninja` invocation re-runs CMake. A
pristine first configure is safe (the file does not exist yet, so the
`if(EXISTS ...)` guard skips the copy), which is why the loop looks
machine- or IDE-specific.

## Fix

1. Per review, re-vendor `third-party/curl` at the `curl-8_21_0` tag
(previously `curl-8_3_0`), which carries the upstream probe fix plus two
years of upstream development; `vendor.yaml` updated to match.
Adjustments the version jump forced:
- curl 8.15 removed the native macOS Secure Transport backend
(`CURL_USE_SECTRANSP`), so macOS now builds curl against OpenSSL like
Linux. The two macOS workflows install Homebrew `openssl@3` and export
`OPENSSL_ROOT_DIR` (keg-only), and the macOS setup docs gained the same
two lines.
- `CURL_BROTLI` / `CURL_ZSTD` switched to AUTO-detection in curl 8.10;
pinned OFF to keep the previous no-compression behavior and avoid
silently linking whatever the CI images happen to have.
- curl's new top-level `BUILD_EXAMPLES` cache option (default ON) leaked
into discord-rpc's identically named option and broke configure at a
nonexistent `examples/send-presence` directory; pinned OFF ahead of the
third-party subdirectories.

The diff is dominated by the mechanical tag-tree swap under
`third-party/curl` (linguist-vendored, collapsed in review). The
hand-written changes are `CMakeLists.txt`, the two macOS workflows,
`docs/setup/system/macos.md`, and `vendor.yaml`.
2. Swap `configure_file()` for `file(COPY ...)`: the same clangd copy
with no configure dependency registered. (`file(COPY_FILE ...
ONLY_IF_DIFFERENT)` would be cleaner still but requires CMake 3.21,
above the declared `cmake_minimum_required(VERSION 3.10)`.)

## Test plan

- [x] Fresh `cmake --preset Release-windows-clang` (LLVM 22, no cache
seeding) completes and logs `Enabled SSL backends: Schannel`; the
FIONBIO probe passes without the previous `#error`
- [x] Full Windows Release build from scratch in the branch worktree
(all 1422 targets)
- [x] goalc-test suite: 1509 passed, 0 failed
- [x] Second consecutive configure with `compile_commands.json` present:
the regen rule in `build.ninja` has no `compile_commands.json` input;
`<src>/build/compile_commands.json` is still refreshed for clangd
- [x] Repeated `ninja` invocations after a full build no longer re-run
CMake
- [x] macOS Intel and ARM CI green (first exercise of the OpenSSL
backend switch)

---

I work off a self-hosted forge, so this GitHub account is quiet; the
configure logs and ninja dirty-node traces from the investigation are
available if anyone wants the raw data.

(AI-assisted)
2026-07-27 19:19:18 -04:00

257 lines
7.4 KiB
XML
Vendored
Generated

<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
<info>
<keywords>
HTTP
HTTP GET
cookies
shared cookies
</keywords>
</info>
# Server-side
<reply>
<data1>
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Type: text/html
Set-Cookie: test1=one; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
Set-Cookie: test2=two; domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
Set-Cookie: test3=three; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
Content-Length: 29
run 1: set cookie 1, 2 and 3
</data1>
<data2>
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:01 GMT
Server: test-server/fake
Content-Type: text/html
Set-Cookie: test4=four; domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
Set-Cookie: test5=five; domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
Content-Length: 26
run 2: set cookie 4 and 5
</data2>
<data3>
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:02 GMT
Server: test-server/fake
Content-Type: text/html
Funny-head: yesyes
Set-Cookie: test4=overwritten4; domain=host.foo.com; expires=Sat May 5 GMT 11:56:27 2035
Set-Cookie: test1=overwritten1; domain=foo.com; expires=Thu Mar 3 GMT 11:56:27 2033
Set-Cookie: test6=six; domain=.www.host.foo.com; expires=Thu Mar 3 GMT 11:56:27 2033
Set-Cookie: test6=six_more; expires=Thu Mar 3 GMT 11:56:27 2033
Content-Type: text/html
Content-Length: 73
run 3: overwrite cookie 1 and 4, set cookie 6 with and without tailmatch
</data3>
</reply>
# Client-side
<client>
<server>
http
</server>
# do not run this with the threaded-resolver or c-ares since the events might
# trigger in a different order!
<features>
!threaded-resolver
!c-ares
</features>
<name>
HTTP with shared cookie list (and dns cache)
</name>
# Explicitly set the time zone to a known good one, in case the user is
# using one of the 'right' zones that take into account leap seconds
# which causes the cookie expiry times to be different.
<setenv>
TZ=GMT
</setenv>
<tool>
lib%TESTNUMBER
</tool>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER %LOGDIR/jar%TESTNUMBER
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<stdout>
GLOBAL_INIT
SHARE_INIT
CURLSHOPT_LOCKFUNC
CURLSHOPT_UNLOCKFUNC
CURLSHOPT_USERDATA
CURL_LOCK_DATA_COOKIE
CURL_LOCK_DATA_DNS
CURLOPT_SHARE
lock: share [Pigs in space]: 0
unlock: share [Pigs in space]: 1
CURLOPT_COOKIELIST injected_and_clobbered
lock: cookie [Pigs in space]: 0
unlock: cookie [Pigs in space]: 1
CURLOPT_COOKIELIST ALL
lock: cookie [Pigs in space]: 2
unlock: cookie [Pigs in space]: 3
CURLOPT_COOKIELIST session
lock: cookie [Pigs in space]: 4
unlock: cookie [Pigs in space]: 5
CURLOPT_COOKIELIST injected
lock: cookie [Pigs in space]: 6
unlock: cookie [Pigs in space]: 7
CURLOPT_COOKIELIST SESS
lock: cookie [Pigs in space]: 8
unlock: cookie [Pigs in space]: 9
CLEANUP
lock: cookie [Pigs in space]: 10
unlock: cookie [Pigs in space]: 11
lock: share [Pigs in space]: 2
unlock: share [Pigs in space]: 3
*** run 1
CURLOPT_SHARE
lock: share [Pigs in space]: 4
unlock: share [Pigs in space]: 5
PERFORM
lock: cookie [Pigs in space]: 12
unlock: cookie [Pigs in space]: 13
lock: cookie [Pigs in space]: 14
unlock: cookie [Pigs in space]: 15
lock: dns [Pigs in space]: 0
unlock: dns [Pigs in space]: 1
lock: dns [Pigs in space]: 2
unlock: dns [Pigs in space]: 3
lock: dns [Pigs in space]: 4
unlock: dns [Pigs in space]: 5
lock: cookie [Pigs in space]: 16
unlock: cookie [Pigs in space]: 17
lock: cookie [Pigs in space]: 18
unlock: cookie [Pigs in space]: 19
lock: cookie [Pigs in space]: 20
unlock: cookie [Pigs in space]: 21
lock: cookie [Pigs in space]: 22
unlock: cookie [Pigs in space]: 23
run 1: set cookie 1, 2 and 3
lock: dns [Pigs in space]: 6
unlock: dns [Pigs in space]: 7
CLEANUP
lock: cookie [Pigs in space]: 24
unlock: cookie [Pigs in space]: 25
lock: share [Pigs in space]: 6
unlock: share [Pigs in space]: 7
*** run 2
CURLOPT_SHARE
lock: share [Pigs in space]: 8
unlock: share [Pigs in space]: 9
PERFORM
lock: cookie [Pigs in space]: 26
unlock: cookie [Pigs in space]: 27
lock: cookie [Pigs in space]: 28
unlock: cookie [Pigs in space]: 29
lock: dns [Pigs in space]: 8
unlock: dns [Pigs in space]: 9
lock: dns [Pigs in space]: 10
unlock: dns [Pigs in space]: 11
lock: cookie [Pigs in space]: 30
unlock: cookie [Pigs in space]: 31
lock: cookie [Pigs in space]: 32
unlock: cookie [Pigs in space]: 33
lock: cookie [Pigs in space]: 34
unlock: cookie [Pigs in space]: 35
run 2: set cookie 4 and 5
lock: dns [Pigs in space]: 12
unlock: dns [Pigs in space]: 13
CLEANUP
lock: cookie [Pigs in space]: 36
unlock: cookie [Pigs in space]: 37
lock: share [Pigs in space]: 10
unlock: share [Pigs in space]: 11
*** run 3
CURLOPT_SHARE
lock: share [Pigs in space]: 12
unlock: share [Pigs in space]: 13
CURLOPT_COOKIEJAR
CURLOPT_COOKIELIST FLUSH
lock: cookie [Pigs in space]: 38
unlock: cookie [Pigs in space]: 39
PERFORM
lock: cookie [Pigs in space]: 40
unlock: cookie [Pigs in space]: 41
lock: dns [Pigs in space]: 14
unlock: dns [Pigs in space]: 15
lock: dns [Pigs in space]: 16
unlock: dns [Pigs in space]: 17
lock: cookie [Pigs in space]: 42
unlock: cookie [Pigs in space]: 43
lock: cookie [Pigs in space]: 44
unlock: cookie [Pigs in space]: 45
lock: cookie [Pigs in space]: 46
unlock: cookie [Pigs in space]: 47
lock: cookie [Pigs in space]: 48
unlock: cookie [Pigs in space]: 49
lock: cookie [Pigs in space]: 50
unlock: cookie [Pigs in space]: 51
run 3: overwrite cookie 1 and 4, set cookie 6 with and without tailmatch
lock: dns [Pigs in space]: 18
unlock: dns [Pigs in space]: 19
CLEANUP
lock: cookie [Pigs in space]: 52
unlock: cookie [Pigs in space]: 53
lock: share [Pigs in space]: 14
unlock: share [Pigs in space]: 15
CURLOPT_SHARE
lock: share [Pigs in space]: 16
unlock: share [Pigs in space]: 17
CURLOPT_COOKIELIST ALL
lock: cookie [Pigs in space]: 54
unlock: cookie [Pigs in space]: 55
CURLOPT_COOKIEJAR
CURLOPT_COOKIELIST RELOAD
lock: cookie [Pigs in space]: 56
unlock: cookie [Pigs in space]: 57
lock: cookie [Pigs in space]: 58
unlock: cookie [Pigs in space]: 59
loaded cookies:
-----------------
www.host.foo.com FALSE / FALSE %days[400] test6 six_more
.www.host.foo.com TRUE / FALSE %days[400] test6 six
.host.foo.com TRUE / FALSE %days[400] test5 five
.host.foo.com TRUE / FALSE %days[400] test4 overwritten4
.foo.com TRUE / FALSE %days[400] test3 three
.host.foo.com TRUE / FALSE %days[400] test2 two
.foo.com TRUE / FALSE %days[400] test1 overwritten1
.host.foo.com TRUE / FALSE %days[400] injected yes
-----------------
try SHARE_CLEANUP...
SHARE_CLEANUP failed, correct
CLEANUP
lock: cookie [Pigs in space]: 60
unlock: cookie [Pigs in space]: 61
lock: share [Pigs in space]: 18
unlock: share [Pigs in space]: 19
SHARE_CLEANUP
lock: share [Pigs in space]: 20
unlock: share [Pigs in space]: 21
GLOBAL_CLEANUP
</stdout>
<file name="%LOGDIR/jar%TESTNUMBER" mode="text">
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
www.host.foo.com FALSE / FALSE %days[400] test6 six_more
.www.host.foo.com TRUE / FALSE %days[400] test6 six
.host.foo.com TRUE / FALSE %days[400] test5 five
.host.foo.com TRUE / FALSE %days[400] test4 overwritten4
.foo.com TRUE / FALSE %days[400] test3 three
.host.foo.com TRUE / FALSE %days[400] test2 two
.foo.com TRUE / FALSE %days[400] test1 overwritten1
.host.foo.com TRUE / FALSE %days[400] injected yes
</file>
</verify>
</testcase>