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

force a require if binding with different uuid is present. #21537

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -746,11 +746,19 @@ function stale_cachefile(modpath::String, cachefile::String)
modules, files, required_modules = parse_cache_header(io)

# Check if transitive dependencies can be fullfilled
for mod in keys(required_modules)
for (mod, uuid) in required_modules
if mod == :Main || mod == :Core || mod == :Base
continue
# Module is already loaded
elseif isdefined(Main, mod)
elseif isbindingresolved(Main, mod)
current_uuid = module_uuid(getfield(Main, mod))
# Depends on the assumption that uuid monotonically increase
if current_uuid > uuid
# Module is newer, reject cache
return true
elseif current_uuid < uuid
warn("The currently loaded module $mod is older than the dependency for $cachefile and will be replaced.")
end
continue
end
name = string(mod)
Expand Down
6 changes: 5 additions & 1 deletion src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -2282,8 +2282,12 @@ static jl_value_t *read_verify_mod_list(ios_t *s, arraylist_t *dependent_worlds)
uint64_t uuid = read_uint64(s);
jl_sym_t *sym = jl_symbol(name);
jl_module_t *m = NULL;
if (jl_binding_resolved_p(jl_main_module, sym))
if (jl_binding_resolved_p(jl_main_module, sym)) {
m = (jl_module_t*)jl_get_global(jl_main_module, sym);
// Potentially two modules with the same name.
if (m && jl_is_module(m) && m->uuid != uuid)
m = NULL;
}
if (!m) {
static jl_value_t *require_func = NULL;
if (!require_func)
Expand Down