Skip to content

cargo publish chokes on symlinks #2748

@elinorbgr

Description

@elinorbgr

On my project wayland-client, I have a structure like this:

- protocols/
- wayland-client/
    |- protocols/ (symlink -> ../protocols)
    |- src/
    |- Cargo.toml

With previous versions of cargo, publishing wayland-client worked as expected, packaging the contents of protocols through the symlink as if it was a simple directory.

Now, since I updated to cargo 0.10.0, cargo publish chokes on the protocols symlink:

 $ cargo publish --verbose
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Packaging wayland-client v0.6.0 (file:///home/levans/dev/wayland-rs/wayland-client)
   Archiving Cargo.toml
   Archiving build.rs
   Archiving examples/list_globals.rs
   Archiving examples/simple_window.rs
   Archiving protocols
error: failed to prepare local package for uploading

Caused by:
  could not archive source file `protocols`

Caused by:
  Is a directory (os error 21)

Activity

elinorbgr

elinorbgr commented on May 28, 2016

@elinorbgr
Author

Hmm, last time I tried to publish something, I worked around the issue by copying the directory in place of the symlink and it worked fine.

Now, it doesn't any more, and I didn't update cargo in the meantime... I don't understand what's going on.

elinorbgr

elinorbgr commented on May 28, 2016

@elinorbgr
Author

Thanks to @SimonSapin I understood what's going on: cargo uses the git index to list the files to package.But the symlink is listed as a plain file in this index, not as a directory (and that's caused my other error: I didn't git add the directory after copying it).

Needless to say I'd really like this to work again (I use the symlink because this "protocols" directory is shared between two projects), but I understand I'd be more than a simple bugfix.

emberian

emberian commented on Oct 30, 2016

@emberian
Contributor

This isn't always quite as simple to workaround when the symlink is in a submodule that you don't really have the ability to modify...

davechallis

davechallis commented on Aug 24, 2018

@davechallis

Are there currently any good workarounds for this? I'm working on a project which uses a 3rd party submodule (which itself contains submodules), and which makes heavy use of symlinks throughout its directory structure (which makes modifying it non-trivial).

This also affects the cargo package command, so maybe needs a label for that adding?

added a commit that references this issue on Jul 31, 2019
0237953
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @alexcrichton@davechallis@emberian@elinorbgr

      Issue actions

        cargo publish chokes on symlinks · Issue #2748 · rust-lang/cargo