Repository navigation
Conversation
|
Thinking it's time to delete the OpenBSD CI job. 7.8 made tests flaky, had to revert to 7.7, now 7.7 also broke at package install. |
|
Snags, some may be big:
|
How does that change anything? The sources are already built separately, right?
That sounds like a bad idea and counter the whole premise of the curlx functions.
I'm not sure I understand this. What sections need different setups?
libtests should use the standard one since they are libcurl-using applications. Right? |
|
I plan to merge this preferably today to avoid merge conflicts with |
61df11c to
15fd09e
Compare
Cherry-picked from curl#19626
Cherry-picked from curl#19626
|
My reply from a week ago, where instead of replying to, I accidentally
My basis was that mappings are set once per lib.
Just a brainstorm idea, and probably not a good one!
The issue is that curlx/base64 and curlx/dynbuf both have a local With the new system, I had to figure out a way to implement these
It was my assumption, yes, based on how it worked so far. This exception |
|
The PR passed after fixing what turned out to be a prosaic issue. With this done, mappings before this patch remained, with one Then I had a second look and made a simpification, which also made TL;DR at the current state, this patch selects libcurl allocators edit: GitHub's JS-laden web UI is no longer capable of displaying a diff |
|
@vszakats there are 7 |
|
Also, these mallocs are not covered by the memdebug functions? |
|
The comment on top explains why: Lines 25 to 28 in 193cb00 |
|
I saw that but what makes these so special? Why do they cause recursion? It's not like they are mallocs calling malloc. |
|
These were raw allocators all along. They are used in low-level Windows-specific wrappers I think they are fine. They also caused many weeks of pain in the past till figuring this stuff |
Before this patch curl used the C preprocessor to override standard
memory allocation symbols: malloc, calloc, strdup, realloc, free.
The goal of these is to replace them with curl's debug wrappers in
CURLDEBUGbuilds, another was to replace them with the wrapperscalling user-defined allocators in libcurl. This solution needed a bunch
of workarounds to avoid breaking external headers: it relied on include
order to do the overriding last. For "unity" builds it needed to reset
overrides before external includes. Also in test apps, which are always
built as single source files. It also needed the
(symbol)trickto avoid overrides in some places. This would still not fix cases where
the standard symbols were macros. It was also fragile and difficult
to figure out which was the actual function behind an alloc or free call
in a specific piece of code. This in turn caused bugs where the wrong
allocator was accidentally called.
To avoid these problems, this patch replaces this solution with
curlx_-prefixed allocator macros, and mapping them once to eitherthe libcurl wrappers, the debug wrappers or the standard ones, matching
the rest of the code in libtests.
This concludes the long journey to avoid redefining standard functions
in the curl codebase.
Note: I did not update
packages/OS400/*.csources. They did not#includecurl_setup.h,curl_memory.hormemdebug.h, meaningthe overrides were never applied to them. This may or may not have been
correct. For now I suppressed the direct use of standard allocators
via a local
.checksrc. Probably they (except forcurlcl.c) should beupdated to include
curl_setup.hand use thecurlx_macros.This patch changes mappings in two places:
lib/curl_threads.cin libtests: Before this patch it mapped tolibcurl allocators. After, it maps to standard allocators, like
the rest of libtests code.
units: before this patch it mapped to standard allocators. After, itmaps to libcurl allocators.
Also:
curl_memory.handmemdebug.hincludes,and delete the now unnecessary headers.
Curl_tcsdupmacro tocurlx_tcsdupand define like the otherallocators.
curlx_strdup()to_strdup()on Windows (was:strdup()).To fix warnings silenced via
_CRT_NONSTDC_NO_DEPRECATE.curlx_convert_*()to_strdup()on Windows(was:
strdup()).strdupname for the local replacement._strdup()on Windows (was:strdup()).SNPRINTF.Follow-up to b12da22 #18866
Follow-up to db98daa #18844
Follow-up to 4deea93 #18814
Follow-up to 9678ff5 #18776
Follow-up to 10bac43 #18774
Follow-up to 20142f5 #18634
Follow-up to bf7375e #18503
Follow-up to 9863599 #18502
Follow-up to 3bb5e58 #17827
raw diff: https://patch-diff.githubusercontent.com/raw/curl/curl/pull/19626.diff
curlx_ones_strdupfor_WIN32(fwrite)→fwritein one place. (unrelated tidy-up)CURL_STANDARD_ALLOCmacro and set it in src, libtests, tunit, unit to match existing builds.strdupimplementation totool_strdupto avoid tripping checksrc and make it clear it's a local implementation with an explicit mapping overCurl_strdupwhich is the same thing in libcurl.meaning the overrides did not apply to it. This may have been incorrect.
For now I just suppressed the issue via
.checksrc.BUILDING_LIBCURLmore to enable overrides, and disable for test/units, the rest needs it disabled anyway.strduplocal implementations into curlx. [→ FUTURE PR]memdup0implementations into curlx. [→ FUTURE PR](func)style hacks with the real functions with a per-line checksrc exceptioncurl_free->curlx_free, a 1-to-1 wrapper, not useful and hinders readabilityTricky, they look the same, but their mappings may be different!
(fwrite)change) → curl_setup.h: drop superfluous parenthesis fromCurl_safefreemacro #19734 memdebug: replace(fwrite)withfwrite#19735 unit1653: replace local macro withCurl_safefree()#19736CLONE_STRINGandDUPmacros [they are subtly different, skip]which should most like just need to be closed without action at this point.
-DCMAKE_C_FLAGS=-DCURL_DISABLE_TYPECHECKwas the solution. It fixed CodeQL builds.and the idea of trying to build tests in non-unity-style,
which may be easier now there is no need to carefully
watch the order of includes.