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

Fix Libdl changes #28953

Merged
merged 3 commits into from
Sep 1, 2018
Merged

Fix Libdl changes #28953

merged 3 commits into from
Sep 1, 2018

Conversation

staticfloat
Copy link
Sponsor Member

Forgot to include this in #28888.

NEWS.md Outdated
------------------------

* The `Libdl` module's methods `dlopen()` and `dlsym()` have been updated
to return `nothing` as the indicator of a nonexistant symbol or library.
Copy link
Contributor

Choose a reason for hiding this comment

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

sp: nonexistent

NEWS.md Outdated
------------------------

* The `Libdl` module's methods `dlopen()` and `dlsym()` have been updated
to return `nothing` as the indicator of a nonexistent symbol or library.
Copy link
Member

Choose a reason for hiding this comment

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

This gives the impression that the default behavior changed. Instead, it just gained a keyword.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

The behavior did change; if the library is not found, nothing is returned instead of C_NULL.

Copy link
Member

Choose a reason for hiding this comment

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

Didn't it used to throw an error?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Oh, you're right, I should be talking about dlopen_e() and dlsym_e() here. Those are the ones that changed.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, actually, I missed that that happened. Those functions are exported and checking their output for NULL is their primary use case. I think we need to change that back and have the _e variants return C_NULL in the failure case.

@staticfloat
Copy link
Sponsor Member Author

staticfloat commented Aug 30, 2018 via email

@Keno
Copy link
Member

Keno commented Aug 30, 2018

That completely defeats the purpose of the PR. The entire point of the PR
is to start returning nothing from dlsym_e(), because C_NULL is a valid
response from dlsym.

Well, it's fine to add the behavior for the dlsym function (no _e) with the new keyword argument. It's probably not fine to change the behavior of the existing exported function unless we're doing a major version bump of the stdlib.

@staticfloat
Copy link
Sponsor Member Author

staticfloat commented Aug 30, 2018 via email

@Keno
Copy link
Member

Keno commented Aug 30, 2018

The answer is simple. Definedlsym_e(args...) = something(dlsym(args..; throw_errors=false), C_NULL) for compatibility, deprecate it and tell people to use the keyword argument API, which is fine, since that never had a non-error failure return. That's what I thought we were doing. I missed the behavior change for dlsym_e.

@timholy
Copy link
Sponsor Member

timholy commented Aug 30, 2018

I am guessing this is the source of JuliaGraphics/Cairo.jl#253?

@staticfloat staticfloat changed the title Update NEWS.md for Libdl.{dlopen,dlsym} changes Fix Libdl changes Aug 30, 2018
@staticfloat
Copy link
Sponsor Member Author

The answer is simple.

Indeed it is. Thanks for spelling it out for me, I didn't think of untying the behavior of dlsym and dlsym_e like that. :)

@Keno
Copy link
Member

Keno commented Aug 31, 2018

Need to change the tests back probably. LGTM otherwise.

------------------------

* The `Libdl` module's methods `dlopen()` and `dlsym()` have gained a
`throw_error` keyword argument, replacing the now-deprecated `dlopen_e()`
Copy link
Member

Choose a reason for hiding this comment

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

Slightly off topic but it seems like this keyword could have been more concisely called error or throw; throw_error feels unpleasantly long. Is it too late to change that?

Copy link
Member

Choose a reason for hiding this comment

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

No, it's not, but let's get this merged to fix the regression. We can change the keyword name anytime before the release of 1.1.

Copy link
Member

Choose a reason for hiding this comment

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

Right, I don't mean it should be changed in this PR, just a more general remark.

@Keno Keno merged commit d9d2b9c into master Sep 1, 2018
@ararslan ararslan deleted the sf/libdl_news branch September 1, 2018 18:59
vtjnash added a commit that referenced this pull request Mar 21, 2019
missed as part of #28953, c.f. #28881
vtjnash added a commit that referenced this pull request Mar 21, 2019
missed as part of #28953, c.f. #28881
vtjnash added a commit that referenced this pull request Mar 21, 2019
missed as part of #28953, c.f. #28881
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.

5 participants