Skip to content

Incorrect include/exclude behavior with git dependencies (doesn't match cargo package) #962

@vikanezrimaya

Description

@vikanezrimaya

Describe the bug

Package with a git dependency that has a really complicated include section in Cargo.toml doesn't build, because ripgrep excludes files that cargo package would leave included. (There are two conflicting rules, which Cargo and ripgrep seem to interpret differently; cargo allows the more specific include rule to take precedence over the more vague exclusion rule, while ripgrep excludes it based on the vague wildcard rule).

Reproduction

$ nix build -L github:vikanezrimaya/crane-git-dep-include-bug

Additional notes
Adding --debug to the rg invocation in lib/downloadCargoPackageFromGit.nix confirmed the specific rg interpretation described above, while running cargo package in the git checkout of the aforementioned dependency and inspecting the .crate files confirmed that Cargo's behavior matches my expectations.

Perhaps it would be better to simply run cargo package in the crate checkout and then unpack the crates into $out instead of emulating Cargo's behavior using ripgrep?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions