Skip to content

downloadCargoPackageFromGit fails on Cargo-invalid filenames #1044

Description

@simonzkl

Describe the bug
downloadCargoPackageFromGit fails when a git dependency contains a filename that Cargo refuses to package, even if the file is unrelated to the build.

This appears to be caused by #976, which changed git vendoring to call cargo package -l. Cargo rejects package filenames containing characters such as :.

Error:

error: cannot package a filename with a special character `:`: fixtures/US:TN.md

Expected: crane vendors the git dependency successfully.

I suppose the repo should fix this so it doesn't contain any files names that are invalid on windows. Though on the other hand, a regular cargo build by itself doesn't choke on these files.

I've worked around it by running this in downloadCargoPackageFromGit prePatch.

find . -depth -name '*[\\<>:"|?*]*' -print -exec rm -rf {} +

Not sure if this is a good idea to generalize though. If there's no reasonable way to handle this, then maybe documenting it with a manual workaround could be the way to go.

Reproduction
Minimal repro:

https://github.com/simonzkl/crane-download-git-invalid-filename-repro

Run:

nix build github:simonzkl/crane-download-git-invalid-filename-repro#

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwontfixThis will not be worked on

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions