Skip to content

Dependencies with custom build scripts cannot be built when vendored. #9127

@Reisen

Description

@Reisen

Problem

Since the end of November, cargo vendor will strip the executable flag from vendored dependencies. This means any repository with for example a setup.sh executed by build.rs will now fail to build the project due to file permission errors.

A good example of this is a crate that depends on jemalloc-sys. When building with vendored dependencies the following errors are produced:

  ./config.status: line 1262: /build/source/target/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-008d3f566bf6b3e0/out/jemalloc/include/jemalloc/internal/private_symbols.sh: Permission denied
  ./config.status: line 1268: /build/source/target/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-008d3f566bf6b3e0/out/jemalloc/include/jemalloc/internal/private_symbols.sh: Permission denied
  ./config.status: line 1272: /build/source/target/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-008d3f566bf6b3e0/out/jemalloc/include/jemalloc/internal/public_namespace.sh: Permission denied
  ./config.status: line 1276: /build/source/target/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-008d3f566bf6b3e0/out/jemalloc/include/jemalloc/internal/public_unnamespace.sh: Permission denied
  ./config.status: line 1288: /build/source/target/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-008d3f566bf6b3e0/out/jemalloc/include/jemalloc/jemalloc_rename.sh: Permission denied
  ./config.status: line 1292: /build/source/target/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-008d3f566bf6b3e0/out/jemalloc/include/jemalloc/jemalloc_mangle.sh: Permission denied
  ./config.status: line 1296: /build/source/target/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-008d3f566bf6b3e0/out/jemalloc/include/jemalloc/jemalloc_mangle.sh: Permission denied
  ./config.status: line 1300: /build/source/target/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-008d3f566bf6b3e0/out/jemalloc/include/jemalloc/jemalloc.sh: Permission denied

With a non-vendored build, these files are executable.

Steps

Minimal reproduction:

  1. Create a new empty project with cargo new --lib broken-vendor
  2. Add the following dependencies to Cargo.toml:
[dependencies]
jemallocator = "0.3.2"
jemalloc-ctl = "0.3.2"
  1. Vendor the dependencies with mkdir .cargo && cargo vendor deps >> .cargo/config.toml
  2. Try and build!

All .sh files in the jemalloc-sys directory are missing `+x, and the build will break. If you do this with a normal build, the files are correctly copied into the filesystem with executable permissions preserved.

Possible Solution(s)

I'm not entirely sure if this was an intentional change or not, I can't find much info on it. There's no way to hook this process to work around it currently.

Notes

Output of cargo version:

Tested broken on these versions:
cargo 1.50.0-nightly (d274fcf 2020-12-07)
cargo 1.51.0-nightly (c3abcfe 2021-01-25)

Last working version I could find was November 25th 2020.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions