Skip to content

Fix Libdl changes#28953

Merged
Keno merged 3 commits intomasterfrom
sf/libdl_news
Sep 1, 2018
Merged

Fix Libdl changes#28953
Keno merged 3 commits intomasterfrom
sf/libdl_news

Conversation

@staticfloat
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

staticfloat commented Aug 30, 2018 via email

@Keno
Copy link
Copy Markdown
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
Copy Markdown
Member Author

staticfloat commented Aug 30, 2018 via email

@Keno
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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