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

Better Libdl.dlopen error when using non-standard extension #46998

Merged
merged 1 commit into from
Oct 25, 2022

Conversation

fingolfin
Copy link
Contributor

When trying to dlopen a file with non-standard extension (e.g. foo.so instead of foo.dylib when running on macOS), if this failed (e.g. because of a reference to an undefined symbol), then instead of printing the error message returned by dlerror with a helpful notice what went wrong, a message indicating something to the effect that "foo.so.dylib was not found" was shown, which was not helpful at all.

To get the actual helpful error message, add a check so that when dlopen fails for a file that actually exists, we don't retry loading from a file with the standard extension attached, which might not even exist; instead we just give up.

This matches what is already being done for relative paths. This patch simply copies the relevant check to also be applied to the case dealing with absolute paths.

When trying to dlopen a file with non-standard extension (e.g. `foo.so`
instead of `foo.dylib` when running on macOS), if this failed (e.g.
because of a reference to an undefined symbol), then instead of printing
the error message returned by `dlerror` with a helpful notice what
went wrong, a message indicating something to the effect that
"foo.so.dylib was not found" was shown, which was not helpful at all.

To get the actual helpful error message, add a check so that when dlopen
fails for a file that actually exists, we don't retry loading from a
file with the standard extension attached, which might not even exist;
instead we just give up.

This matches what is already being done for relative paths. This patch
simply copies the relevant check to also be applied to the case dealing
with absolute paths.
@fingolfin
Copy link
Contributor Author

I think it would be sensible to backport this.

@giordano giordano added backport 1.6 Change should be backported to release-1.6 backport 1.8 Change should be backported to release-1.8 labels Oct 2, 2022
Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

This does look like it would be more consistent

@fingolfin
Copy link
Contributor Author

Can this be merged?

@vtjnash vtjnash merged commit a490197 into JuliaLang:master Oct 25, 2022
KristofferC pushed a commit that referenced this pull request Oct 27, 2022
When trying to dlopen a file with non-standard extension (e.g. `foo.so`
instead of `foo.dylib` when running on macOS), if this failed (e.g.
because of a reference to an undefined symbol), then instead of printing
the error message returned by `dlerror` with a helpful notice what
went wrong, a message indicating something to the effect that
"foo.so.dylib was not found" was shown, which was not helpful at all.

To get the actual helpful error message, add a check so that when dlopen
fails for a file that actually exists, we don't retry loading from a
file with the standard extension attached, which might not even exist;
instead we just give up.

This matches what is already being done for relative paths. This patch
simply copies the relevant check to also be applied to the case dealing
with absolute paths.

(cherry picked from commit a490197)
@KristofferC KristofferC mentioned this pull request Oct 27, 2022
37 tasks
KristofferC pushed a commit that referenced this pull request Oct 28, 2022
When trying to dlopen a file with non-standard extension (e.g. `foo.so`
instead of `foo.dylib` when running on macOS), if this failed (e.g.
because of a reference to an undefined symbol), then instead of printing
the error message returned by `dlerror` with a helpful notice what
went wrong, a message indicating something to the effect that
"foo.so.dylib was not found" was shown, which was not helpful at all.

To get the actual helpful error message, add a check so that when dlopen
fails for a file that actually exists, we don't retry loading from a
file with the standard extension attached, which might not even exist;
instead we just give up.

This matches what is already being done for relative paths. This patch
simply copies the relevant check to also be applied to the case dealing
with absolute paths.

(cherry picked from commit a490197)
@KristofferC KristofferC removed the backport 1.8 Change should be backported to release-1.8 label Nov 8, 2022
KristofferC pushed a commit that referenced this pull request Dec 21, 2022
When trying to dlopen a file with non-standard extension (e.g. `foo.so`
instead of `foo.dylib` when running on macOS), if this failed (e.g.
because of a reference to an undefined symbol), then instead of printing
the error message returned by `dlerror` with a helpful notice what
went wrong, a message indicating something to the effect that
"foo.so.dylib was not found" was shown, which was not helpful at all.

To get the actual helpful error message, add a check so that when dlopen
fails for a file that actually exists, we don't retry loading from a
file with the standard extension attached, which might not even exist;
instead we just give up.

This matches what is already being done for relative paths. This patch
simply copies the relevant check to also be applied to the case dealing
with absolute paths.

(cherry picked from commit a490197)
KristofferC pushed a commit that referenced this pull request Dec 21, 2022
When trying to dlopen a file with non-standard extension (e.g. `foo.so`
instead of `foo.dylib` when running on macOS), if this failed (e.g.
because of a reference to an undefined symbol), then instead of printing
the error message returned by `dlerror` with a helpful notice what
went wrong, a message indicating something to the effect that
"foo.so.dylib was not found" was shown, which was not helpful at all.

To get the actual helpful error message, add a check so that when dlopen
fails for a file that actually exists, we don't retry loading from a
file with the standard extension attached, which might not even exist;
instead we just give up.

This matches what is already being done for relative paths. This patch
simply copies the relevant check to also be applied to the case dealing
with absolute paths.

(cherry picked from commit a490197)
KristofferC pushed a commit that referenced this pull request Dec 21, 2022
When trying to dlopen a file with non-standard extension (e.g. `foo.so`
instead of `foo.dylib` when running on macOS), if this failed (e.g.
because of a reference to an undefined symbol), then instead of printing
the error message returned by `dlerror` with a helpful notice what
went wrong, a message indicating something to the effect that
"foo.so.dylib was not found" was shown, which was not helpful at all.

To get the actual helpful error message, add a check so that when dlopen
fails for a file that actually exists, we don't retry loading from a
file with the standard extension attached, which might not even exist;
instead we just give up.

This matches what is already being done for relative paths. This patch
simply copies the relevant check to also be applied to the case dealing
with absolute paths.

(cherry picked from commit a490197)
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
When trying to dlopen a file with non-standard extension (e.g. `foo.so`
instead of `foo.dylib` when running on macOS), if this failed (e.g.
because of a reference to an undefined symbol), then instead of printing
the error message returned by `dlerror` with a helpful notice what
went wrong, a message indicating something to the effect that
"foo.so.dylib was not found" was shown, which was not helpful at all.

To get the actual helpful error message, add a check so that when dlopen
fails for a file that actually exists, we don't retry loading from a
file with the standard extension attached, which might not even exist;
instead we just give up.

This matches what is already being done for relative paths. This patch
simply copies the relevant check to also be applied to the case dealing
with absolute paths.

(cherry picked from commit a490197)
KristofferC pushed a commit that referenced this pull request Oct 10, 2023
When trying to dlopen a file with non-standard extension (e.g. `foo.so`
instead of `foo.dylib` when running on macOS), if this failed (e.g.
because of a reference to an undefined symbol), then instead of printing
the error message returned by `dlerror` with a helpful notice what
went wrong, a message indicating something to the effect that
"foo.so.dylib was not found" was shown, which was not helpful at all.

To get the actual helpful error message, add a check so that when dlopen
fails for a file that actually exists, we don't retry loading from a
file with the standard extension attached, which might not even exist;
instead we just give up.

This matches what is already being done for relative paths. This patch
simply copies the relevant check to also be applied to the case dealing
with absolute paths.

(cherry picked from commit a490197)
@fingolfin fingolfin deleted the mh/better-dlopen-error branch January 26, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.6 Change should be backported to release-1.6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants