Skip to content

Projects with symlinked Project.tomls are broken #48339

Open
@chriselrod

Description

@chriselrod

Issue originally filed with Pkg: JuliaLang/Pkg.jl#3326

Because instantiating the project follows the symlink and creates/instantiates the Manifest.toml in the directory of the pointed to Project.toml.
However, trying to using any package in that project checks the project directory itself, which doesn't have a Manifest.toml due to it having been created elsewhere.

E.g.:
tests.tar.gz

(myproj) pkg> instantiate
    Updating registry at `~/.julia/registries/General.toml`
    Updating `~/Documents/progwork/julia/tests/myproj/Project.toml`
  [615f187c] + IfElse v0.1.1
    Updating `~/Documents/progwork/julia/tests/myproj/Manifest.toml`
  [615f187c] + IfElse v0.1.1

(myproj) pkg> st
Status `~/Documents/progwork/julia/tests/myproj/Project.toml`
  [615f187c] IfElse v0.1.1

julia> using IfElse
ERROR: ArgumentError: Package IfElse [615f187c-cbe4-4ef1-ba3b-2fcf58d6d173] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

Stacktrace:
 [1] _require(pkg::Base.PkgId, env::String)
   @ Base ./loading.jl:1685
 [2] _require_prelocked(uuidkey::Base.PkgId, env::String)
   @ Base ./loading.jl:1571
 [3] macro expansion
   @ ./loading.jl:1559 [inlined]
 [4] macro expansion
   @ ./lock.jl:267 [inlined]
 [5] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1522

julia> Base.active_project()
"/home/chriselrod/Documents/progwork/julia/tests/myprojlink/Project.toml"

shell> ll myprojlink/
total 4.0K
lrwxrwxrwx. 1 chriselrod chriselrod 22 Jan 18 15:19 Project.toml -> ../myproj/Project.toml

I attached the sample directory illustrating the problem.

myproj contains a Project.toml.
myprojlink contains a symlink to this Project.toml

I activate the myprojlink project. The active project is myprojlink.

I instantiate the project. The Manifest.toml gets created in myproj, the location of the actual Project.toml. That is, it follows the link.

I using IfElse. This throws an error, because there is no Manifest.toml inside the active project.
It unhelpfully suggests I try instantiating the project.

For the example to illustrate the problem, you can't have IfElse.jl in your main environment/it can't be findable otherwise. Otherwise it'll load from that Project+Manifest instead of the one we're testing.
I used IfElse as the example because (a) I figured people were unlikely to have it in their main environment and (b) it is one of the most lightweight packages.

I think Pkg should be consistent in following or not following the symlink with respect to creating and reading the Manifest.toml.
It is the inconsistency that caused the problem.

Why does this example matter?
Some package managers (e.g. straight.el) clone repos in one directory, and then sym link the files to another directory for building.
This doesn't work if you want to have Julia dependencies without also shipping a Manifest.toml to be copied over. non-Jedi/eglot-jl#37

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions