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

Strip trailing slashes in JULIA_DEPOT_PATH when embedding @depot #51892

Merged
merged 1 commit into from
Oct 27, 2023
Merged
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
13 changes: 10 additions & 3 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2600,8 +2600,15 @@ end

function replace_depot_path(path::AbstractString)
for depot in DEPOT_PATH
# Skip depots that don't exist
if !isdirpath(depot)
continue
end

# Strip extraneous pathseps through normalization.
depot = dirname(depot)
if startswith(path, depot)
path = replace(path, depot => "@depot")
path = replace(path, depot => "@depot"; count=1)
break
end
end
Expand All @@ -2619,7 +2626,7 @@ function resolve_depot(includes)
end
for depot in DEPOT_PATH
if all(includes) do inc
isfile(replace(inc, r"^@depot" => depot))
isfile(replace(inc, r"^@depot" => depot; count=1))
end
return depot
end
Expand Down Expand Up @@ -2725,7 +2732,7 @@ function parse_cache_header(f::IO, cachefile::AbstractString)
@debug "Missing @depot tag for include dependencies in cache file $cachefile."
else
for inc in includes
inc.filename = replace(inc.filename, r"^@depot" => depot)
inc.filename = replace(inc.filename, r"^@depot" => depot; count=1)
end
end
includes_srcfiles_only = includes[keepidx]
Expand Down
2 changes: 1 addition & 1 deletion test/relocatedepot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if !test_relocated_depot
pkgname = "RelocationTestPkg2"
test_harness() do
push!(LOAD_PATH, @__DIR__)
push!(DEPOT_PATH, @__DIR__)
push!(DEPOT_PATH, string(@__DIR__, "/"))
pkg = Base.identify_package(pkgname)
cachefiles = Base.find_all_in_cache_path(pkg)
rm.(cachefiles, force=true)
Expand Down