Skip to content

🍒 [5.10] Check for strlcpy/strlcat #4949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

etcwilde
Copy link
Contributor

@etcwilde etcwilde commented May 5, 2024

Some newer builds of glibc have strlcpy and strlcat defined, resulting in build failures on newer Linux distros. Rather than try to hard-code whether or not each version of each platform has strlcat and strlcpy, this patch has CMake check to see if it's available after including string.h. If they are, then we should not redefine them.

This is a targeted change pulling the fix from the patch set merged in 5a1db79.

@etcwilde etcwilde requested review from shahmishal and al45tair May 5, 2024 03:52
@etcwilde
Copy link
Contributor Author

etcwilde commented May 5, 2024

@swift-ci please test

Copy link
Contributor

@al45tair al45tair left a comment

Choose a reason for hiding this comment

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

Not sure why it didn’t get through to the build. Missing part of the cherry pick maybe. It’s the right thing to do though.

@etcwilde
Copy link
Contributor Author

etcwilde commented May 7, 2024

@swift-ci please clean test Linux Platform

Some newer builds of glibc have strlcpy and strlcat defined, resulting
in build failures on newer Linux distros. Rather than try to hard-code
whether or not each version of each platform has strlcat and strlcpy,
this patch has CMake check to see if it's available after including
string.h. If they are, then we should not redefine them.

This is a targeted change pulling the fix from the patch set merged in
5a1db79.
@etcwilde etcwilde force-pushed the ewilde/5.10/strlcpy-strlcat-check branch from 9577acf to 8d1a679 Compare May 7, 2024 19:17
@etcwilde
Copy link
Contributor Author

etcwilde commented May 7, 2024

@swift-ci please test

@etcwilde
Copy link
Contributor Author

etcwilde commented May 7, 2024

TARGET_OS_MAC is always defined. It might be 0 or 1, but #ifndef doesn't work.... Bah!

@etcwilde
Copy link
Contributor Author

etcwilde commented May 7, 2024

@swift-ci please test Windows

@shahmishal shahmishal merged commit 1a538a2 into swiftlang:release/5.10 May 15, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants