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

Wrong default REPL prompt when JULIA_DEPOT_PATH is a symlink #55850

Open
christiangnrd opened this issue Sep 24, 2024 · 0 comments · May be fixed by #55851
Open

Wrong default REPL prompt when JULIA_DEPOT_PATH is a symlink #55850

christiangnrd opened this issue Sep 24, 2024 · 0 comments · May be fixed by #55851
Labels
REPL Julia's REPL (Read Eval Print Loop)

Comments

@christiangnrd
Copy link
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
christiangnrd added a commit to christiangnrd/julia that referenced this issue Sep 24, 2024
@christiangnrd christiangnrd 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 Sep 24, 2024
@nsajko nsajko added the REPL Julia's REPL (Read Eval Print Loop) label Sep 24, 2024
KristofferC added a commit that referenced this issue Oct 1, 2024
Backported PRs:
- [x] #55849 <!-- Mmap: fix grow! for non file IOs -->
- [x] #55863 <!-- Update TaskLocalRNG docstring according to #49110 -->
- [x] #54433 <!-- Root globals in toplevel exprs -->
- [x] #55828 <!-- Fix some corner cases of `isapprox` with unsigned
integers -->
- [x] #55890 <!-- Profile: fix order of fields in heapsnapshot & improve
formatting -->
- [x] #55884 <!-- inference: add missing `TypeVar` handling for
`instanceof_tfunc` -->
- [x] #55881 <!-- Install terminfo data under /usr/share/julia -->
- [x] #55909 <!-- do not intentionally suppress errors in precompile
script from being reported or failing the result -->
- [x] #55355 <!-- relocation: account for trailing path separator in
depot paths -->
- [x] #55917 <!-- fix rawbigints OOB issues -->
- [x] #55892 <!-- TOML: Avoid type-pirating `Base.TOML.Parser` -->
- [x] #55798 <!-- Broadcast binary ops involving strided triangular -->
- [x] #55919 <!-- Limit `@inbounds` to indexing in the dual-iterator
branch in `copyto_unaliased!` -->

Contains multiple commits, manual intervention needed:
- [ ] #54009 <!-- allow extensions to trigger from packages in [deps]
-->
- [ ] #55509 <!-- Fix cong implementation to be properly random and not
just cycling. -->
- [ ] #55569 <!-- Add a docs section about loading/precomp/ttfx time
tuning -->
- [ ] #55824 <!-- Replace regex package module checks with actual code
checks -->

Non-merged PRs with backport label:
- [ ] #55932 <!-- REPL: make UndefVarError aware of imported modules -->
- [ ] #55910 <!-- Prevent extensions from blocking parallel
pre-compilation -->
- [ ] #55908 <!-- add logic to prefer loading modules that are already
loaded -->
- [ ] #55886 <!-- irrationals: restrict assume effects annotations to
known types -->
- [ ] #55871 <!-- lowering: don't reverse handler order in
`(pop-handler-list ...)` -->
- [ ] #55870 <!-- fix infinite recursion in `promote_type` for
`Irrational` -->
- [ ] #55867 <!-- update `hash` doc string: `widen` not required any
more -->
- [ ] #55851 <!-- [REPL] Fix #55850 by using `safe_realpath` instead of
`abspath` in `projname` -->
- [ ] #55813 <!-- Check for conflicting `@ccallable` name before JIT
registration -->
- [ ] #55743 <!-- doc: heap snapshot viewing -->
- [ ] #55741 <!-- Change annotations to use a NamedTuple -->
- [ ] #55534 <!-- Set stdlib sources as read-only during installation
-->
- [ ] #55499 <!-- propagate the terminal's `displaysize` to the
`IOContext` used by the REPL -->
- [ ] #55458 <!-- Allow for generically extracting unannotated string
-->
- [ ] #55457 <!-- Make AnnotateChar equality consider annotations -->
- [ ] #55220 <!-- `isfile_casesensitive` fixes on Windows -->
- [ ] #55169 <!-- `propertynames` for SVD respects private argument -->
- [ ] #54457 <!-- Make `String(::Memory)` copy -->
- [ ] #53957 <!-- tweak how filtering is done for what packages should
be precompiled -->
- [ ] #51479 <!-- prevent code loading from lookin in the versioned
environment when building Julia -->
- [ ] #50813 <!-- More doctests for Sockets and capitalization fix -->
- [ ] #50157 <!-- improve docs for `@inbounds` and
`Base.@propagate_inbounds` -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants