Skip to content

Unix.link: include errno.h, correctly set feature test macro#1862

Merged
gasche merged 1 commit intoocaml:trunkfrom
madroach:link_symlink
Jun 26, 2018
Merged

Unix.link: include errno.h, correctly set feature test macro#1862
gasche merged 1 commit intoocaml:trunkfrom
madroach:link_symlink

Conversation

@madroach
Copy link
Contributor

In #1061 builds on FreeBSD and MacOS broke.
The break is caused by wrong use of feature test macros. It turns out those feature test macros are not used for testing for features, but to request them.
Therefore in this fix I first #define _XOPEN_SOURCE 700 instead of testing for it.
Then I test for availablility of linkat by looking at the AT_SYMLINK_FOLLOW macro, which was introduced in POSIX IEEE Std 1003.1-2008 for linkat.

@gasche
Copy link
Member

gasche commented Jun 26, 2018

I started a precheck build for this branch, https://ci.inria.fr/ocaml/job/precheck/120/. I think this should be merged if it passes.

(For documentation on what precheck is and how to use it, see CONTRIBUTING.md#precheck)

/* */
/**************************************************************************/

/* Needed te get linkat exposed in compliant OS.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: "te" instead of "to".

@gasche
Copy link
Member

gasche commented Jun 26, 2018

(Not all tests are done but the freebsd-64 build just passed, which is good indication that the new feature test seems to work.)

Which is needed for the case without support for linkat as reported by Gabriel Scherer.
Also set _XOPEN_SOURCE == 700 instead of testing for it.
Test for availablility of linkat by looking at AT_SYMLINK_FOLLOW, which is, according to
introduced in POSIX IEEE Std 1003.1-2008 for linkat.
@madroach
Copy link
Contributor Author

... or it indicates that the errno.h is now included correctly.
Would you mind testing whether Unix.link ~follow:true raises ENOSYS on FreeBSD (it shouldn't)

Copy link
Member

@gasche gasche left a comment

Choose a reason for hiding this comment

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

For some reasons the OSX builds have not finished, but this already fixes the build on FreeBSD (and the rest still builds) so I'm happy to accept and merge -- cannot hurt.

@gasche gasche merged commit cb38dbd into ocaml:trunk Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants