rust-lang/rustwide

If a folder named 'docker' is in the current directory, rustwide will try to execute it

Closed this issue · 2 comments

With a docker directory:

(bash@joshua-ThinkPad-P51s) ~/.../rust/docs.rs ▶️ ls -ld docker/
drwxrwxr-x 2 joshua joshua 4096 Jun 28 21:49 docker/
(bash@joshua-ThinkPad-P51s) ~/.../rust/docs.rs ▶️ cargo run build crate regex 0.3.0
    Finished dev [unoptimized + debuginfo] target(s) in 0.23s
     Running `/home/joshua/.local/lib/cargo/target/debug/cratesfyi build crate regex 0.3.0`
2020/06/28 22:12:57 [DEBUG] cratesfyi::docbuilder: Loading cache
2020/06/28 22:12:57 [DEBUG] cratesfyi::docbuilder: Loading database cache
2020/06/28 22:12:57 [INFO] rustwide::cmd::sandbox: pulling image rustops/crates-build-env from Docker Hub
2020/06/28 22:12:57 [INFO] rustwide::cmd: running `Command { std: "/home/joshua/src/rust/docs.rs/docker" "pull" "rustops/crates-build-env", kill_on_drop: false }`
2020/06/28 22:12:57 [ERROR] rustwide::cmd: error running command: Permission denied (os error 13)
thread 'main' panicked at 'failed to initialize rustwide: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', src/bin/cratesfyi.rs:323:21

Without a docker directory:

(bash@joshua-ThinkPad-P51s) ~/.../rust/docs.rs ▶️ ls -ld docker
ls: cannot access 'docker': No such file or directory
(bash@joshua-ThinkPad-P51s) ~/.../rust/docs.rs ▶️ cargo run build crate regex 0.3.0
    Finished dev [unoptimized + debuginfo] target(s) in 0.19s
     Running `/home/joshua/.local/lib/cargo/target/debug/cratesfyi build crate regex 0.3.0`
2020/06/28 22:13:32 [DEBUG] cratesfyi::docbuilder: Loading cache
2020/06/28 22:13:32 [DEBUG] cratesfyi::docbuilder: Loading database cache
2020/06/28 22:13:32 [INFO] rustwide::cmd::sandbox: pulling image rustops/crates-build-env from Docker Hub
2020/06/28 22:13:32 [INFO] rustwide::cmd: running `Command { std: "docker" "pull" "rustops/crates-build-env", kill_on_drop: false }`
2020/06/28 22:13:32 [INFO] rustwide::cmd: [stdout] Using default tag: latest
2020/06/28 22:13:33 [INFO] rustwide::cmd: [stdout] latest: Pulling from rustops/crates-build-env
2020/06/28 22:13:33 [INFO] rustwide::cmd: [stdout] Digest: sha256:819119df93c0f5eca3f29186f14981ef29945a311854d7222af07488600a2584
2020/06/28 22:13:33 [INFO] rustwide::cmd: [stdout] Status: Image is up to date for rustops/crates-build-env:latest
2020/06/28 22:13:33 [INFO] rustwide::cmd: [stdout] docker.io/rustops/crates-build-env:latest
Backtrace
  14: tokio::runtime::handle::Handle::block_on
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.21/src/runtime/handle.rs:263
  15: rustwide::cmd::Command::run_inner
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.7.1/src/cmd/mod.rs:426
  16: rustwide::cmd::Command::run
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.7.1/src/cmd/mod.rs:292
  17: rustwide::cmd::sandbox::SandboxImage::remote
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.7.1/src/cmd/sandbox.rs:33
  18: rustwide::workspace::WorkspaceBuilder::init::{{closure}}
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.7.1/src/workspace.rs:152
  19: std::panicking::try::do_call
             at /home/joshua/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:331
  20: __rust_try
  21: std::panicking::try
             at /home/joshua/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:274
  22: std::panic::catch_unwind
             at /home/joshua/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394
  23: rustwide::utils::file_lock
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.7.1/src/utils.rs:27
  24: rustwide::workspace::WorkspaceBuilder::init
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustwide-0.7.1/src/workspace.rs:148

This call to normalize_path is incorrect:

let mut cmd = AsyncCommand::new(crate::utils::normalize_path(&binary));