-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
relocation: account for trailing path separator in depot paths #55355
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
Changes from all commits
01d11e9
cba4a7e
8dcf3d6
d03ff12
8c6d7db
0174e43
b600a62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -3176,23 +3176,29 @@ mutable struct CacheHeaderIncludes | |||
const modpath::Vector{String} # seemingly not needed in Base, but used by Revise | ||||
end | ||||
|
||||
function replace_depot_path(path::AbstractString) | ||||
for depot in DEPOT_PATH | ||||
!isdir(depot) && continue | ||||
|
||||
# Strip extraneous pathseps through normalization. | ||||
if isdirpath(depot) | ||||
depot = dirname(depot) | ||||
end | ||||
|
||||
if startswith(path, depot) | ||||
function replace_depot_path(path::AbstractString, depots::Vector{String}=normalize_depots_for_relocation()) | ||||
for depot in depots | ||||
if startswith(path, string(depot, Filesystem.pathsep())) || path == depot | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In many cases, Windows accepts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, I did not know that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! The replace isn't safe for UNC paths (it destroys double slashes https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#example-ways-to-refer-to-the-same-file shows some exotic ways to build paths on Windows, in case we do. The Base path functionality uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I now settled to just use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I traced back the use of
So I will revert changes related to this and make the tests pass again. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right before spawning the precompilation process, here Line 2812 in f2f76d8
Shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's something that spawns a process with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am sorry, I don't understand. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, my point is that it's legal to spawn Julia with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I see. Indeed, that's problematic. |
||||
path = replace(path, depot => "@depot"; count=1) | ||||
break | ||||
end | ||||
end | ||||
return path | ||||
end | ||||
|
||||
function normalize_depots_for_relocation() | ||||
depots = String[] | ||||
sizehint!(depots, length(DEPOT_PATH)) | ||||
for d in DEPOT_PATH | ||||
isdir(d) || continue | ||||
if isdirpath(d) | ||||
d = dirname(d) | ||||
end | ||||
push!(depots, abspath(d)) | ||||
end | ||||
return depots | ||||
end | ||||
|
||||
function restore_depot_path(path::AbstractString, depot::AbstractString) | ||||
replace(path, r"^@depot" => depot; count=1) | ||||
end | ||||
|
Uh oh!
There was an error while loading. Please reload this page.