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

ERL-567: code:is_loaded/1: Filename is an absolute filename #3506

Closed
OTP-Maintainer opened this issue Feb 21, 2018 · 4 comments
Closed

ERL-567: code:is_loaded/1: Filename is an absolute filename #3506

OTP-Maintainer opened this issue Feb 21, 2018 · 4 comments
Assignees
Labels
bug Issue is reported as a bug priority:low team:VM Assigned to OTP team VM

Comments

@OTP-Maintainer
Copy link

Original reporter: sdl.web@gmail.com
Affected version: OTP-20.2
Component: kernel
Migrated from: https://bugs.erlang.org/browse/ERL-567


{{code:is_loaded(yaws_dynopts)}} returns {code:erlang}{file, []}{code} which is not an absolute filename. yaws_dynopts is loaded using {{code:load_binary/3}}.
@OTP-Maintainer
Copy link
Author

john said:

{{code:load_binary/3}} doesn't actually load anything from disk, and the {{Filename}} argument lets you specify which file you want the code server to believe you loaded the module from (for bookkeeping purposes).

Looking at the YAWS source code it passes an empty filename to {{code:load_binary/3}} when generating this module, so {{code:is_loaded/1}} will return an empty filename.

https://github.com/klacke/yaws/blob/80caa2b2a7608638046fdb00180fa79262a8f2a8/src/yaws_dynopts.erl#L180

@OTP-Maintainer
Copy link
Author

sdl.web@gmail.com said:

Thanks for the quick response. That's what I understood too. Should the documentation of {{code:is_loaded/1}} be fixed?

@OTP-Maintainer
Copy link
Author

john said:

Sure, I'll add a note saying you can't rely on the filename for anything more than debugging.

@OTP-Maintainer
Copy link
Author

sdl.web@gmail.com said:

Thanks.

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug team:VM Assigned to OTP team VM priority:low labels Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:low team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

2 participants