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

Projects with symlinked Project.tomls are broken #3326

Open
chriselrod opened this issue Jan 18, 2023 · 2 comments
Open

Projects with symlinked Project.tomls are broken #3326

chriselrod opened this issue Jan 18, 2023 · 2 comments

Comments

@chriselrod
Copy link

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

@KristofferC
Copy link
Member

If the Project and Manifest files are created correctly, then this seems to be more an issue with the package loading code in Julia and not the package manager itself.

@chriselrod
Copy link
Author

Should I file this bug with Julia?

I'd say all the files were created correctly, assuming sym linking is considered valid (which I don't see why it shouldn't be).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants