Skip to content

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

Closed
@ju1m

Description

@ju1m

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}";

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwontfix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions