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

Regression: the subdir of a source-repository-package can no longer use symlinks to its ancestor or sibling directories #2258

Open
ju1m opened this issue Oct 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ju1m
Copy link
Contributor

ju1m commented Oct 14, 2024

Describe the bug

In cabal.project, it's no longer possible to use a source-repository-package with a subdir containing symlinks to its ancestor or sibling directories.

  • Haskell.nix tag 2024.10.13

Steps To Reproduce

In a cabal.project:

source-repository-package
    type: git
    location: https://github.com/AccelerateHS/accelerate-llvm.git
    tag: 2b5d69448557e89002c0179ea1aaf59bb757a6e3
    subdir: accelerate-llvm-native/
            accelerate-llvm/

This fails in the installPhase:

$ nix -L build .#project.hsPkgs.accelerate-llvm.components.library
accelerate-llvm-lib-accelerate-llvm> Running phase: installPhase
accelerate-llvm-lib-accelerate-llvm> LICENSE: copyFile: does not exist (No such file or directory)

Because accelerate-llvm/LICENSE is a symlink to a file outside the component's directory:

$ readlink accelerate-llvm/LICENSE 
../LICENSE

Expected behavior

The installPhase succeeds by having access to the whole initial file hierarchy of the git repository.

Additional context
It's the same symptom as in #1134 but very likely unrelated, since the present regression was introduced just one month ago in #2239. Indeed, it worked correctly just before 61fbe40

Possible cause may be that in lib/load-cabal-plan.nix, src is no longer defined using a origSrc and origSubDir, that lib/clean-cabal-component.nix could use to know the component is a subdir:

src = pkgs.lib.lists.elemAt callProjectResults.sourceRepos (pkgs.lib.strings.toInt p.pkg-src.source-repo.location)
+ pkgs.lib.optionalString (p.pkg-src.source-repo.subdir != ".") "/${p.pkg-src.source-repo.subdir}";

@ju1m ju1m added the bug Something isn't working label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant