Skip to content
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

Adjust logic for compat shims. #11

Merged
merged 1 commit into from
Jul 26, 2019
Merged

Adjust logic for compat shims. #11

merged 1 commit into from
Jul 26, 2019

Conversation

the-maldridge
Copy link
Contributor

@the-maldridge the-maldridge commented Jul 24, 2019

This PR adjusts the logic that chooses when the compat shims get built. The immediate use case is to permit the use of libnss_cache with the excellent musl C library on Linux. I've made what I believe to be the minimal set of changes that will work here, but there is a hazy line around the patch I have to replace the use of sys/param.h on Linux.

A special thanks to @Vaelatern for assisting with debugging while working on this PR.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@the-maldridge
Copy link
Contributor Author

With great difficulty, I have signed the CLA. I'd consider it a bug that I can't change which of my identities is being used to sign the CLA like I can with almost any other Google property...

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@jaqx0r
Copy link
Contributor

jaqx0r commented Jul 26, 2019

Thanks for jumping through those administrative hoops ,and thanks for the contribution!

@jaqx0r jaqx0r merged commit 321bad8 into google:master Jul 26, 2019
@the-maldridge
Copy link
Contributor Author

Any time! I must admit though I think there may be a bug in my PR. I've observed an intermittent hang in NSS queries this afternoon which happens on around 1% of the fleet I manage. At this time I am unsure if the hang is in libnss-cache or in musl-nscd (the compat layer for NSS on musl). If the bug is in libnss-cache, it is certainly in the value I patched in for ALIGNBYTES on Linux.

I'm also in conversation with the devs over in #musl, and I'll update this PR with a comment once I track down where the bug is once and for all.

@jaqx0r
Copy link
Contributor

jaqx0r commented Jul 26, 2019 via email

@jaqx0r
Copy link
Contributor

jaqx0r commented Jul 26, 2019

With great difficulty, I have signed the CLA. I'd consider it a bug that I can't change which of my identities is being used to sign the CLA like I can with almost any other Google property...

Can you give me some more information about this? E.g. describe the sequence of actions that occurred and what went wrong, please.

@the-maldridge
Copy link
Contributor Author

Sure, I'm normally signed in with at least 6 Google identities on Chrome. On most Google properties, there is a selector in the upper right hand corner where the I can switch what account is being used as the identity for the page. On the site for the CLA, only one ID was selected and no mechanism that I could find was provided to switch. I had to open a private browsing window and sign in just the one identity, then go through the CLA signing flow to get it to attach to the right context (I try to keep it relatively clean what's attached to each ID since some are for other organizations).

Feel free to email me at the email listed on my GitHub account and I can provide more detailed information.

@jaqx0r
Copy link
Contributor

jaqx0r commented Jul 26, 2019

Great, thanks for the info. I've escalated the report and will let you know if we need more info.

@the-maldridge
Copy link
Contributor Author

@jaqx0r The bug was isolated to another library. Here is the issue for the problem I was observing: pikhq/musl-nscd#8. Feel free to cut a release here at your convenience, I will update downstream packages for Void once you have done so.

@jaqx0r
Copy link
Contributor

jaqx0r commented Jul 28, 2019 via email

// defined above that guard the rest of the compat layer. On Linux we
// don't pull in param.h as it is very obsolete.
#include <stdint.h>
#define ALIGNBYTES _Alignof(max_align_t)
Copy link
Contributor

Choose a reason for hiding this comment

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

This type requires C11 which isn't a real problem but the symbols might not be visible depending on the system. What do you think about removing the ifdefs and param.h include altogether and doing this:

#define ALIGNBYTES (sizeof(uintptr_t) - 1)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had considered the C11 issue when drafting this patch but thought it shouldn't be an issue on FreeBSD or most modern *nix's. I'm all for removing param.h dependencies, so if you are confident that changing from the _Alignof won't affect any currently working target I'd say go ahead and send the PR.

@the-maldridge the-maldridge deleted the musl branch July 30, 2019 21:59
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.

4 participants