-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
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:
- Create a new empty project with
cargo new --lib broken-vendor
- Add the following dependencies to Cargo.toml:
[dependencies]
jemallocator = "0.3.2"
jemalloc-ctl = "0.3.2"
- Vendor the dependencies with
mkdir .cargo && cargo vendor deps >> .cargo/config.toml
- 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.