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

Code loading: do the "skipping mtime check for stdlib" check regardless of the value of ispath(f) #50919

Closed
wants to merge 5 commits into from
Closed
Changes from 4 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
18 changes: 12 additions & 6 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3117,13 +3117,19 @@ end
end
for chi in includes
f, ftime_req = chi.filename, chi.mtime
if !ispath(f)
if ispath(f)
Copy link
Member Author

Choose a reason for hiding this comment

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

Is it even necessary to branch on the value of ispath(f) here? Can we just get rid of the branch, and do _f = fixup_stdlib_path(f) unconditionally?

Presumably, if f is already a valid filesystem path, we would expect the replace inside fixup_stdlib_path to have no effect, right?

Copy link
Member Author

@DilumAluthge DilumAluthge Aug 15, 2023

Choose a reason for hiding this comment

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

Or are we trying to avoid calling the potentially expensive fixup_stdlib_path(f) if we don't need to?

_f = f
else
_f = fixup_stdlib_path(f)
if isfile(_f) && startswith(_f, Sys.STDLIB)
# mtime is changed by extraction
@debug "Skipping mtime check for file $f used by $cachefile, since it is a stdlib"
continue
end
end
if isfile(_f) && startswith(_f, Sys.STDLIB)
# mtime is changed by extraction
# Note: we intentionally include the value of `ispath(f)` in the following debug message,
# to help debug which branch we went down.
@debug "Skipping mtime check for file $f used by $cachefile, since it is a stdlib" ispath(f)
continue
end
if !ispath(f)
@debug "Rejecting stale cache file $cachefile because file $f does not exist"
return true
end
Expand Down
Loading