Repository navigation
Conversation
vszakats
marked this pull request as draft
November 21, 2025 19:16
Member
Author
|
Issues:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Member
Author
|
Fine, pytests broken (test_17_ssl_use, 20 variants failed) after Homebrew bumped wolfSSL to 5.8.4 (from previous release 5.8.2): https://github.com/wolfSSL/wolfssl/releases/tag/v5.8.4-stable → #19644 |
This was referenced Nov 21, 2025
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Nov 22, 2025
Cherry-picked from curl#19643
1 task done
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Nov 24, 2025
Cherry-picked from curl#19643
vszakats
added a commit
that referenced
this pull request
Nov 24, 2025
The safe (`_s`) variants of the Windows `open()` reject these flags, while the classic ones silently accepted them. Also: - also drop the now unused `stat()` call on Windows. - replace magic number with their equivalent Windows and Unix-specific `S_*` macros. Refs: https://learn.microsoft.com/cpp/c-runtime-library/reference/open-wopen https://learn.microsoft.com/cpp/c-runtime-library/reference/fstat-fstat32-fstat64-fstati64-fstat32i64-fstat64i32 Cherry-picked from #19643 Closes #19645
vszakats
added a commit
that referenced
this pull request
Nov 24, 2025
Ref: https://learn.microsoft.com/cpp/c-runtime-library/reference/open-wopen Ref: #19645 Cherry-picked from #19643 Closes #19647
vszakats
added a commit
that referenced
this pull request
Nov 24, 2025
…ision Windows CRTs have a `share.h`. Before this patch when trying to `#include <share.h>` it, the compiler picked up curl's internal `lib/share.h` instead. Rename it to avoid this issue. CRT `share.h` has constants necessary for using safe open CRT functions. Also rename `lib/share.c` to keep matching the header. Ref: https://learn.microsoft.com/cpp/c-runtime-library/sharing-constants Ref: 625f2c1 #16949 #16991 Cherry-picked from #19643 Closes #19676
vszakats
added a commit
that referenced
this pull request
Nov 25, 2025
Replace: - `open()` with `curlx_open()` (1 call). - `fopen()` with `curlx_fopen()`. - `fclose()` with `curlx_fclose()`. To centralize interacting with the CRT in preparation for using "safe" alternatives on Windows. This also adds long-filename and Unicode support for these operations on Windows. Keep using `open()` in the signal handler to avoid any issues with calling code not allowed in signal handlers. Cherry-picked from #19643 Closes #19679
https://learn.microsoft.com/cpp/c-runtime-library/reference/open-wopen https://learn.microsoft.com/cpp/c-runtime-library/reference/sopen-s-wsopen-s https://learn.microsoft.com/cpp/c-runtime-library/reference/freopen-wfreopen https://learn.microsoft.com/cpp/c-runtime-library/reference/fopen-wfopen https://learn.microsoft.com/cpp/c-runtime-library/reference/fopen-s-wfopen-s https://learn.microsoft.com/cpp/c-runtime-library/reference/freopen-s-wfreopen-s
vszakats
marked this pull request as ready for review
November 25, 2025 00:58
Member
Author
|
TL;DR the reason for the CI failures seen earlier in #19581 (comment) were:
These were addressed in this PR and a series of separate commits today. |
Member
Author
|
CRT functions flagged by
|
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Jan 5, 2026
vszakats
added a commit
that referenced
this pull request
Jan 6, 2026
Replacing `fopen_s()`/`_wfopen_s()`, to allow customizing share mode, and keep the sharing mode as was with `fopen()`/`_wopen()` earlier and as used in `_sopen_s()`/`_wsopen_s()`. The replaced functions used `_SH_SECURE` internally. Otherwise they are identical to the replacements. Ref: https://learn.microsoft.com/cpp/c-runtime-library/reference/fsopen-wfsopen Reported-by: Jay Satiro Fixes #20155 Ref: #20156 Follow-up to 1e7d0ba #19643 Closes #20186
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_wopen->_wsopen_s_open,open->_sopen_s_wfopen->_wfopen_sfopen->fopen_s_wfreopen->_wfreopen_sfreopen->freopen_sFor better error handling and for using the CRT functions recommended
via warnings suppressed by
_CRT_SECURE_NO_WARNINGS.Also:
freopen_s()prototype when building with mingw-w64 <5.https://sourceforge.net/p/mingw-w64/mingw-w64/ci/a5d824654cdc57f6eac1bb581b078986f3eb6856/
open()in the signal handler with_sopen_s()on Windows.
Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/open-wopen
https://learn.microsoft.com/cpp/c-runtime-library/reference/sopen-s-wsopen-s
https://learn.microsoft.com/cpp/c-runtime-library/reference/freopen-wfreopen
https://learn.microsoft.com/cpp/c-runtime-library/reference/fopen-wfopen
https://learn.microsoft.com/cpp/c-runtime-library/reference/fopen-s-wfopen-s
https://learn.microsoft.com/cpp/c-runtime-library/reference/freopen-s-wfreopen-s
freopen_swith mingw-w64 5+ only.lib/share.hto avoid collision with CRTshare.h. → lib: rename internal headershare.htocurl_share.hto avoid collision #19676#include <share.h>includeslib/share.hinstead ofshare.hfrom the CRT.Ref: lib: include files using known path #16991 that seemed fixing this issue reported in share.h conflicts with windows ucrt header #16949, but apparently this
use-case still hits it. Avoiding the name collision by renaming would be best?
fail, some others time out. → curl_fopen: do not pass invalid mode flags to
open()on Windows #19645Finalize the rough/quick fix, to try honoring
data->set.new_file_perms.Also split to separate PR. → file: do not pass invalid mode flags to
open()on upload (Windows) #19647Proposal: Bump required mingw-w64 version to 3.0 (from 1.0) #17984
open()on Windows #19645open()on upload (Windows) #19647open()(Windows) #19670open()mode flags #19671open()call withcurlx_open(). → tests/server: use curlx file open/close functions #19679fopen()call withcurlx_fopen(). → tests/server: use curlx file open/close functions #19679open()call with_svariant on Windows.