Skip to content

Added #ifdef CURLDEBUG into curl_mem_undef.h - #18501

Closed
andrewkirillov-ibm wants to merge 3 commits into
curl:masterfrom
andrewkirillov-ibm:aix-accept
Closed

andrewkirillov-ibm wants to merge 3 commits into
curl:masterfrom
andrewkirillov-ibm:aix-accept

Conversation

@andrewkirillov-ibm

Copy link
Copy Markdown
Contributor

Fixes #18500

@bagder

bagder commented Sep 9, 2025

Copy link
Copy Markdown
Member

This fixes a non-debug build, but still makes a debug-build fail, right?

@andrewkirillov-ibm

Copy link
Copy Markdown
Contributor Author

Non debug build is fixed indeed. Debug build, I would imaging, is in the same state as it used to be on AIX (not sure how often it is done on this platform), as even before accept would be undefined, just in a different way.

@vszakats

vszakats commented Sep 9, 2025

Copy link
Copy Markdown
Member

non-CURLDEBUG builds should keep undef-ing these symbols, to reset them after a curl_memory.h include:

strdup
malloc
calloc
realloc
free
_tcsdup

@vszakats vszakats left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This header is meant to undo the system symbol overrides done via curl_memory.h and memdebug.h.

@andrewkirillov-ibm

Copy link
Copy Markdown
Contributor Author

Yes, debug build gets broken on AIX, but on a different file:

  CC       libcurl_la-memdebug.lo
memdebug.c:374:27: error: use of undeclared identifier 'accept'; did you mean 'naccept'?
  curl_socket_t sockfd = (accept)(s, addr, addrlen);
                          ^~~~~~
                          naccept
/usr/include/sys/socket.h:639:9: note: 'naccept' declared here
int     accept(int, struct sockaddr *__restrict__, socklen_t *__restrict__);
        ^
/usr/include/sys/socket.h:168:25: note: expanded from macro 'accept'
#define accept          naccept

@vszakats

vszakats commented Sep 9, 2025

Copy link
Copy Markdown
Member

Maybe introducing CURL_ACCEPT() for this symbol would solve this cleanly.

It's called 3-4 times in total in the core codebase. (some more in servers)

@andrewkirillov-ibm

Copy link
Copy Markdown
Contributor Author

I did update the pull request.

@bagder Thinking more about the original question, I seem to remember debug build on AIX was broken about this time a year ago too. But I did not have time to get to the bottom of it at that time. Definitely it would be nice to have non-debug build back again.

Comment thread lib/curl_mem_undef.h

#ifdef _WIN32
#undef _tcsdup
#endif

@vszakats vszakats Sep 9, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The symbols above should always be undefined for a "clean slate".

They are overridden for both CURLDEBUG and non-CURLDEBUG builds.

Ref: https://github.com/curl/curl/pull/18502/files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did another round of reshuffling.

@vszakats

vszakats commented Sep 9, 2025

Copy link
Copy Markdown
Member

@andrewkirillov-ibm Does this patch work for you?: #18502

@andrewkirillov-ibm

Copy link
Copy Markdown
Contributor Author

Merging your branch, testing ...

@andrewkirillov-ibm

Copy link
Copy Markdown
Contributor Author

@vszakats I cloned your branch and gave it a go - non-debug build is fine on AIX.

Will check debug one too, but I can imagine it should be fine.

@vszakats vszakats mentioned this pull request Sep 9, 2025
2 tasks done
@vszakats

vszakats commented Sep 9, 2025

Copy link
Copy Markdown
Member

@andrewkirillov-ibm Would you mind running the tests with a fix reduced to CURL_ACCEPT(), w/o touching curl_mem_undef.h?:
https://github.com/curl/curl/pull/18502/commits/8b04f051baa9c2c2f75640528f81352632d6b5f9.diff

I think that mod is not necessary to fix this. it'd be nice to keep the patch minimal so close to the release.

@andrewkirillov-ibm

Copy link
Copy Markdown
Contributor Author

@vszakats Just did AIX build with the patch applied - works good.

@vszakats vszakats closed this in 9863599 Sep 9, 2025
@vszakats

vszakats commented Sep 9, 2025

Copy link
Copy Markdown
Member

@andrewkirillov-ibm: Thanks for your report and tests. I merged #18502.
If you experience any issues, let me know.

@andrewkirillov-ibm
andrewkirillov-ibm deleted the aix-accept branch November 3, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

AIX build is broken

3 participants