-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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(ext/ffi): don't panic in dlopen #12344
Conversation
@@ -370,7 +369,12 @@ where | |||
let permissions = state.borrow_mut::<FP>(); | |||
permissions.check(&path)?; | |||
|
|||
let lib = Library::open(&path).map_err(|e| anyhow!(format_error(e, path)))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this causing a panic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/denoland/deno/blob/main/cli/errors.rs#L33
Alternative would be to add a dlopen::Error::OpeningLibraryError
downcast there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a downcast for dlopen::Error
Lines 161 to 164 in 8705292
.or_else(|| { | |
e.downcast_ref::<dlopen::Error>() | |
.map(get_dlopen_error_class) | |
}) |
This PR just re-constructs
dlopen::Error::OpeningLibraryError
after formatting happens so it can be downcast-ed and not panic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @littledivy!
bug introduced in #12301