Skip to content

tlshd: Define TLSHD_ACCESSPERMS instead of using ALLPERMS to fix musl build #88

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alistair23
Copy link

@alistair23 alistair23 commented Apr 9, 2025

ALLPERMS exists in glibc, but not on musl, so we manually define TLSHD_ACCESSPERMS and use that instaed. This fixes building on musl systems.

Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Apr 9, 2025
@chucklever
Copy link
Member

First: yes, we want tlshd to build on musl-based systems. Thanks for the patch. Since ktls-utils is under the "oracle" project, you are required to sign the OCA before we can pull patches you contribute.

Two thoughts:

  1. Is this something that autoconf should figure out and handle for us?
  2. Is there a library-portable version of "ALLPERMS" that can be used to mask the stat(2) result? A quick Google search did not reveal anything, but I didn't try very hard.

@chucklever
Copy link
Member

  1. Is this something that autoconf should figure out and handle for us?
  2. Is there a library-portable version of "ALLPERMS" that can be used to mask the stat(2) result? A quick Google search did not reveal anything, but I didn't try very hard.

OK, this is uglier than I thought it would be. No standard seems to define a mask for examining the permission bits in the stat::st_mode field.

It might seem like a nit, but I'd like to avoid conditional compilation. Looks like the TLSHD_*_MODE macros ignore the sticky bits, so all we care about for now is 0777. Just add this at line 120:

#define TLSHD_ACCESSPERMS   (S_IRWXU|S_IRWXG|S_IRWXO)

And then replace ALLPERMS with TLSHD_ACCESSPERMS at line 152.

… build

ALLPERMS exists in glibc, but not on musl, so we manually define
TLSHD_ACCESSPERMS and use that instaed. This fixes building on musl systems.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
@alistair23 alistair23 changed the title tlshd: Define ALLPERMS if it doesn't exist to fix musl build tlshd: Define TLSHD_ACCESSPERMS instead of using ALLPERMS to fix musl build Apr 13, 2025
@alistair23
Copy link
Author

I don't think autoconf would handle this (at least not easily) and I don't see any portable version either. A number of other projects just manually define ALLPERMS if one doesn't exist so it seems to be the best option.

I have updated the PR to use a new TLSHD_ACCESSPERMS macro and reworded the commit and PR messages to reflect that.

I'm just waiting on approval to sign the CLA, I'll update when it is signed

@chucklever
Copy link
Member

I have updated the PR to use a new TLSHD_ACCESSPERMS macro and reworded the commit and PR messages to reflect that.

Awesome, thanks!

I'm just waiting on approval to sign the CLA, I'll update when it is signed

I would like to include this fix in ktls-utils-1.0, which I'm planning to release as soon as you can sign the OCA.

Sidebar: If you know of a YAML workflow sample I can use, I can include a GitHub Action in this repo that can do a test-build on a MUSL-based platform on every PR. Just a thought.

@alistair23
Copy link
Author

alistair23 commented Apr 21, 2025

Awesome, thanks!

Just got approved on my side, so hopefully the CLA is signed? I'm not sure how to check.

I have another fix (#90) I'll send now as well.

Sidebar: If you know of a YAML workflow sample I can use, I can include a GitHub Action in this repo that can do a test-build on a MUSL-based platform on every PR. Just a thought.

I don't unfortunately. I'm testing with OpenEmbedded which probably isn't what you want in your CI

@chucklever
Copy link
Member

Awesome, thanks!

Just got approved on my side, so hopefully the CLA is signed? I'm not sure how to check.

Check by sending another PR. Looks like you did that, and the OCA bot still says “No Cigar”.

So, “signed on my side” means WD has a blanket contributor’s agreement with Oracle, maybe? If so we will have to wait until all that gets flushed through.

Sidebar: If you know of a YAML workflow sample I can use, I can include a GitHub Action in this repo that can do a test-build on a MUSL-based platform on every PR. Just a thought.

I don't unfortunately. I'm testing with OpenEmbedded which probably isn't what you want in your CI

I’ll ask around. It’s not a requirement, but it would be great to have something to cover that gap.

@chucklever
Copy link
Member

Just got approved on my side, so hopefully the CLA is signed? I'm not sure how to check.

If you have approval, you will need to sign the OCA yourself. I'm told WD does not have a company contributor's agreement with us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Required At least one contributor does not have an approved Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants