Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Reisen opened this issue Feb 3, 2021 · 1 comment · Fixed by #9131
Closed

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

Reisen opened this issue Feb 3, 2021 · 1 comment · Fixed by #9131
Labels

Comments

@Reisen
Copy link

Reisen commented Feb 3, 2021

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.

@ehuss
Copy link
Contributor

ehuss commented Feb 4, 2021

Thanks for the report @Reisen, I have posted a fix at #9131.

bors added a commit that referenced this issue Feb 4, 2021
[BETA] Revert "Slightly optimize `cargo vendor`"

This reverts #8937, which seems to have caused a permission issue.

cc #9127
@bors bors closed this as completed in 34170fc Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants