feat(libcurl): implement curl_strequal and curl_strnequal #14337

Merged
danielhorngt merged 2 commits from upstream-pr/14337 into main 2026-11-06 22:29:32 +00:00
danielhorngt commented 2026-11-01 09:59:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by danielhorngt on 2026-11-01T09:59:57Z.


What

Implements curl_strequal (NID CDG6wR08Ntw) and curl_strnequal (NID OJiHNjSOguc) in libcurl, which threw until now. The signatures follow curl's public API and the matching follows strcase.c:

  • Only ASCII letters fold, whatever the locale. Other bytes compare exactly.
  • Both return 1 for a match and 0 otherwise.
  • curl_strnequal compares at most max bytes, and returns 1 when max is 0.

A null argument throws through NotImplemented_nid_no_patch. The module's curl version is unknown and curl differs: 7.73 dereferences the pointer, while 8.10 treats two nulls as equal. The debt entry records this.

libcurl gains a CMakeLists.txt so it can register a test. It builds the same single source as the default rule.

Tested

Windows 11, WinLibs GCC 15.2.0, Release, at this PR's commit. No title or homebrew was run; I found no title that calls these exports. The logic is plain byte comparison with no platform-specific code.

  • ctest -R '^guest_curl_strings$': passes. The cases cover case folding, length differences, the bytes next to the letter ranges (@, `, [, {), non-ASCII bytes, max of 0, max stopping before a mismatch and max past the terminator. The null path is not tested, because it is a deliberately unsupported path.
  • ctest -R '^public_headers|curl': 66 of 66 pass.
  • cmake --build build --target libs: passes.
  • Negative controls: removing the max == 0 return failed the test, and so did widening the folded range to include `. Both were reverted. These ran before the null checks were removed; the checks that caught them are unchanged.
  • check_conventions.py --base upstream/main passes, and pr_overlap.py --branch feat/curl-strequal reports no overlap with open pull requests.

Not run: the full test suite, Linux, macOS, or any comparison with a console.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5106309385 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14337). Originally posted by [danielhorngt](https://github.com/danielhorngt) on 2026-11-01T09:59:57Z. --- ### What Implements `curl_strequal` (NID `CDG6wR08Ntw`) and `curl_strnequal` (NID `OJiHNjSOguc`) in libcurl, which threw until now. The signatures follow curl's public API and the matching follows [strcase.c](https://github.com/curl/curl/blob/curl-7_73_0/lib/strcase.c): - Only ASCII letters fold, whatever the locale. Other bytes compare exactly. - Both return 1 for a match and 0 otherwise. - `curl_strnequal` compares at most `max` bytes, and returns 1 when `max` is 0. A null argument throws through `NotImplemented_nid_no_patch`. The module's curl version is unknown and curl differs: 7.73 dereferences the pointer, while 8.10 treats two nulls as equal. The debt entry records this. libcurl gains a `CMakeLists.txt` so it can register a test. It builds the same single source as the default rule. ### Tested Windows 11, WinLibs GCC 15.2.0, Release, at this PR's commit. No title or homebrew was run; I found no title that calls these exports. The logic is plain byte comparison with no platform-specific code. - `ctest -R '^guest_curl_strings$'`: passes. The cases cover case folding, length differences, the bytes next to the letter ranges (`@`, `` ` ``, `[`, `{`), non-ASCII bytes, `max` of 0, `max` stopping before a mismatch and `max` past the terminator. The null path is not tested, because it is a deliberately unsupported path. - `ctest -R '^public_headers|curl'`: 66 of 66 pass. - `cmake --build build --target libs`: passes. - Negative controls: removing the `max == 0` return failed the test, and so did widening the folded range to include `` ` ``. Both were reverted. These ran before the null checks were removed; the checks that caught them are unchanged. - `check_conventions.py --base upstream/main` passes, and `pr_overlap.py --branch feat/curl-strequal` reports no overlap with open pull requests. Not run: the full test suite, Linux, macOS, or any comparison with a console. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
CnRJay commented 2026-11-01 19:47:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:47:00Z.

Review: COMMENTED


Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (Unblocks: none is allowed), and it contained no code review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729914085 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14337#pullrequestreview-5729914085). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:47:00Z. **Review:** COMMENTED --- Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (`Unblocks: none` is allowed), and it contained no code review.
MarcZX10 commented 2026-11-02 06:13:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T06:13:14Z.

Review: COMMENTED


Reviewed — no blocking findings

curl_strequal and curl_strnequal now compare strings case-insensitively for ASCII letters only, and they stop at NUL. A null argument throws, as the debt entry says. The new guest test passed on the Windows runner, and the test's expected values match the code as read.

What I ran

  • Head d26099a97dfc5a4c6967e09b11b1ed7d9b1ded25; base 26fa1212b82f76dd49cf12d65e445d6ff3e0844c. 5 files, +94/-9: libcurl/Export.cpp (the two functions, plus a RawUpper helper), libcurl/CMakeLists.txt (new: the library and the guest test), libcurl/include/InventoryExports.hpp (two declarations get parameters), core/libs/tests/GuestCurlStrings.cpp (new, 49 lines), and docs/dev/debt/libcurl.md (a new section for the two functions, and two NIDs moved out of the table).
  • Read the full production diff, the CMake file, the test in full, and the debt diff. The CMake directory is built on Windows, which shows it is included by a parent file.
  • Hosted: the Windows CTest run passed guest_curl_strings (Test #2709, passed, 0.02 s). The run reports 100% of 2583.
  • Read-only checks from the trusted main checkout: diff check, conventions and PR template, and the stack check all passed. ABI audit passed: 85 symbols, no findings.
  • No MarcZX10 review at this head.

Results

Check Result Note
Diff check passed
Conventions and PR template passed conventions check from the main checkout; an earlier run was cancelled and the later run succeeded
Mergeability and dependencies passed stack check passed
ABI audit (main-checkout tool) passed 85 symbols, no findings
curl_strequal and curl_strnequal logic passed by reading ASCII-only folding through RawUpper; both loops stop at NUL; max == 0 returns 1
Test expectations match the code passed by reading every expectation in GuestCurlStrings.cpp follows from the code as read
guest_curl_strings (hosted, Windows) passed Test #2709, 0.02 s
curl version behaviour in the debt entry (7.73 dereferences a null, 8.10 treats two nulls as equal) not verified the curl sources at those tags were not read
Debt count (85 to 83 NIDs) not verified not recounted; two names moved to the new section
Build and runtime tests (Linux) not run Linux is skipped on pull requests
Negative controls not run no local build
Hosted CI passed windows passed (2583/2583); report, conventions and library-portability succeeded; linux, relinkers and write-watch skipped
Read-only check output

Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: passed (85 symbols). Stack check: passed. Hosted: gh api repos/boykopovar/AnyPS5/commits/d26099a97dfc5a4c6967e09b11b1ed7d9b1ded25/check-runs, and the Windows job log.

Negative control

Not run here. A negative control needs a local build, and code from this head is not run here.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

  • The curl version behaviour cited in the debt entry (null handling in curl 7.73 and 8.10), against the curl sources.
  • The 85-to-83 NID count in the debt entry.
  • Linux behaviour.

To get this to a good state

  • Nothing to change.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732708535 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14337#pullrequestreview-5732708535). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T06:13:14Z. **Review:** COMMENTED --- # Reviewed — no blocking findings `curl_strequal` and `curl_strnequal` now compare strings case-insensitively for ASCII letters only, and they stop at NUL. A null argument throws, as the debt entry says. The new guest test passed on the Windows runner, and the test's expected values match the code as read. ## What I ran - Head `d26099a97dfc5a4c6967e09b11b1ed7d9b1ded25`; base `26fa1212b82f76dd49cf12d65e445d6ff3e0844c`. 5 files, +94/-9: `libcurl/Export.cpp` (the two functions, plus a `RawUpper` helper), `libcurl/CMakeLists.txt` (new: the library and the guest test), `libcurl/include/InventoryExports.hpp` (two declarations get parameters), `core/libs/tests/GuestCurlStrings.cpp` (new, 49 lines), and `docs/dev/debt/libcurl.md` (a new section for the two functions, and two NIDs moved out of the table). - Read the full production diff, the CMake file, the test in full, and the debt diff. The CMake directory is built on Windows, which shows it is included by a parent file. - Hosted: the Windows CTest run passed `guest_curl_strings` (`Test #2709`, passed, 0.02 s). The run reports 100% of 2583. - Read-only checks from the trusted main checkout: diff check, conventions and PR template, and the stack check all passed. ABI audit passed: 85 symbols, no findings. - No MarcZX10 review at this head. ## Results | Check | Result | Note | | --- | --- | --- | | Diff check | passed | | | Conventions and PR template | passed | conventions check from the main checkout; an earlier run was cancelled and the later run succeeded | | Mergeability and dependencies | passed | stack check passed | | ABI audit (main-checkout tool) | passed | 85 symbols, no findings | | `curl_strequal` and `curl_strnequal` logic | passed by reading | ASCII-only folding through `RawUpper`; both loops stop at NUL; `max == 0` returns 1 | | Test expectations match the code | passed by reading | every expectation in `GuestCurlStrings.cpp` follows from the code as read | | `guest_curl_strings` (hosted, Windows) | passed | `Test #2709`, 0.02 s | | curl version behaviour in the debt entry (7.73 dereferences a null, 8.10 treats two nulls as equal) | not verified | the curl sources at those tags were not read | | Debt count (85 to 83 NIDs) | not verified | not recounted; two names moved to the new section | | Build and runtime tests (Linux) | not run | Linux is skipped on pull requests | | Negative controls | not run | no local build | | Hosted CI | passed | windows passed (2583/2583); report, conventions and library-portability succeeded; linux, relinkers and write-watch skipped | <details><summary>Read-only check output</summary> Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: passed (85 symbols). Stack check: passed. Hosted: `gh api repos/boykopovar/AnyPS5/commits/d26099a97dfc5a4c6967e09b11b1ed7d9b1ded25/check-runs`, and the Windows job log. </details> ## Negative control Not run here. A negative control needs a local build, and code from this head is not run here. ## Findings **Blocking** None. **Non-blocking** None. ## Sources - Production: https://github.com/boykopovar/AnyPS5/blob/d26099a97dfc5a4c6967e09b11b1ed7d9b1ded25/core/libs/prx/libcurl/Export.cpp - Test: https://github.com/boykopovar/AnyPS5/blob/d26099a97dfc5a4c6967e09b11b1ed7d9b1ded25/core/libs/tests/GuestCurlStrings.cpp - CMake: https://github.com/boykopovar/AnyPS5/blob/d26099a97dfc5a4c6967e09b11b1ed7d9b1ded25/core/libs/prx/libcurl/CMakeLists.txt - Debt entry: https://github.com/boykopovar/AnyPS5/blob/d26099a97dfc5a4c6967e09b11b1ed7d9b1ded25/docs/dev/debt/libcurl.md - Windows job log: check-run `windows` on d26099a97dfc5a4c6967e09b11b1ed7d9b1ded25 ## Not verified - The curl version behaviour cited in the debt entry (null handling in curl 7.73 and 8.10), against the curl sources. - The 85-to-83 NID count in the debt entry. - Linux behaviour. ## To get this to a good state - Nothing to change.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!14337
No description provided.