Skip to content

Wrong default REPL prompt when JULIA_DEPOT_PATH is a symlink #55850

@christiangnrd

Description

@christiangnrd
Contributor

Found when trying to run tests on master but this happens all the way back to at least 1.5.

Discovered because of new tests.

Test Failed at /Users/christian/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.12/REPL/test/repl.jl:1971
  Expression: prompt == "(@v$(VERSION.major).$(VERSION.minor)) pkg> "
   Evaluated: "(v1.12) pkg> " == "(@v1.12) pkg> "

Seems like projname(project_file::String) only checks abspath instead of safe_realpath when comparing envdir and project_file

for depot in Base.DEPOT_PATH
envdir = joinpath(depot, "environments")
if startswith(abspath(project_file), abspath(envdir))
return "@" * name
end
end

Repl walkthrough of my investigation:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.12.0-DEV.1238 (2024-09-23)
 _/ |\__'_|_|_|\__'_|  |  Commit 0fade450a18 (0 days old master)
|__/                   |

julia> withenv("JULIA_DEPOT_PATH" => mktempdir(), "JULIA_LOAD_PATH" => nothing) do
              run(`$(Base.julia_cmd()[1]) --startup-file=no`)
          end
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.12.0-DEV.1238 (2024-09-23)
 _/ |\__'_|_|_|\__'_|  |  Commit 0fade450a18 (0 days old master)
|__/                   |

julia> using REPL; REPL.Pkg_promptf()
[ Info: Precompiling REPL [3fa0cd96-eef1-5676-8a61-b3b8758bbffb] 
"(v1.12) pkg> "

julia> depot = Base.DEPOT_PATH |> first
"/var/folders/4g/lnkpkf3s4rxd_wbl8vwnqs4r0000gn/T/jl_KEaptd"

julia> envdir = joinpath(depot, "environments")
"/var/folders/4g/lnkpkf3s4rxd_wbl8vwnqs4r0000gn/T/jl_KEaptd/environments"

julia> project_file = REPL.find_project_file()
"/private/var/folders/4g/lnkpkf3s4rxd_wbl8vwnqs4r0000gn/T/jl_KEaptd/environments/v1.12/Project.toml"

julia> startswith(abspath(project_file), abspath(envdir)) # Line 91 in Pkg_beforeload.jl
false

Activity

added a commit that references this issue on Sep 24, 2024
b418266
changed the title [-]Wrong default REPL prompt when root of `Base.active_project()` is a symlink to another root directory[/-] [+]Wrong default REPL prompt when `JULIA_DEPOT_PATH` is a symlink[/+] on Sep 24, 2024
added
REPLJulia's REPL (Read Eval Print Loop)
on Sep 24, 2024
added a commit that references this issue on Oct 1, 2024
4c87cb4
added a commit that references this issue on Oct 4, 2024
358bc55
added a commit that references this issue on Oct 5, 2024
fb77d60
added a commit that references this issue on Oct 7, 2024
bc75cd1
added a commit that references this issue on Oct 15, 2024
f9e4d07
added a commit that references this issue on Oct 22, 2024
0517ff8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    REPLJulia's REPL (Read Eval Print Loop)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @nsajko@christiangnrd

      Issue actions

        Wrong default REPL prompt when `JULIA_DEPOT_PATH` is a symlink · Issue #55850 · JuliaLang/julia