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

Conditional directives for strerror_r don't work with musl #21

Closed
nightlark opened this issue Jun 17, 2019 · 4 comments
Closed

Conditional directives for strerror_r don't work with musl #21

nightlark opened this issue Jun 17, 2019 · 4 comments
Assignees
Labels
available on master Fix is done on master branch, issue closed on next release bug Something isn't working
Milestone

Comments

@nightlark
Copy link
Contributor

Describe the bug
Using musl instead of glibc results in the #else branch in systemErrorText getting used; musl follows the POSIX standard.

To Reproduce
Compiling a program using ghc::filesystem on Alpine Linux (uses musl as its libc by default) as part of a CI build is how I encountered this issue. Otherwise, setup another compiler to use musl instead of glibc.

Expected behavior
The variant of strerror_r that returns an int should be used.

Additional context
Line 208 of the log in https://cloud.drone.io/nightlark/HELICS-src/22/2/4 is where I first saw the problem.

@nightlark nightlark changed the title Conditional directives for strerror_r doesn't work with musl Conditional directives for strerror_r don't work with musl Jun 17, 2019
@gulrak gulrak added the bug Something isn't working label Jun 17, 2019
@gulrak gulrak self-assigned this Jun 17, 2019
@gulrak
Copy link
Owner

gulrak commented Jun 17, 2019

Well, musl has the XSI-compliant version of strerror_r wrapped with an irritating:

#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
 || defined(_BSD_SOURCE)

which doesn't seem match the man-file canonic test of (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE because of the _GNU_SOURCE difference.
I decided to use a different approach instead of keeping to try to find a perfect set of macro tests, as I guess there will be more distributions with unusual choices in this function. Android is also special in this regard.

Still need to run a few tests, but expect something on a feature branch soon, I plan to make a "bugfix" release on the weekend.

@nightlark
Copy link
Contributor Author

Yea, getting rid of the macro is the change I tried -- it took care of the compile errors with musl.

@gulrak
Copy link
Owner

gulrak commented Jun 17, 2019

Yeah, should be much more stable over the platforms, to simply dispatch. And all filesystem tests on the CI tested platforms are green, so I'll merge the change into master.

@gulrak gulrak added the available on master Fix is done on master branch, issue closed on next release label Jun 17, 2019
@gulrak
Copy link
Owner

gulrak commented Jun 23, 2019

Fix is now part of release v1.2.2.

@gulrak gulrak closed this as completed Jun 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
available on master Fix is done on master branch, issue closed on next release bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants