rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.83k stars 2.42k forks source link

cargo build on Google Drive File Stream fails to link or copy .dSYM #8401

Open khoguan opened 4 years ago

khoguan commented 4 years ago

I have tried my first cargo project on a virtual disk of Google Drive File Stream (Version: 39.0.10.0) on top of Macbook Pro's Apple File System(APFS). But it fails to cargo build. If I create my cargo project directly on APFS, this error will not appear.

The relevant item of mount is:

drivefs       on         /Volumes/GoogleDrive  (dfsfuse_DFS,              local,    nodev,        nosuid,     synchronous,  mounted  by  khoguan)

The output of rustc -vV is:

rustc 1.44.1 (c7087fe00 2020-06-17)
binary: rustc
commit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7
commit-date: 2020-06-17
host: x86_64-apple-darwin
release: 1.44.1
LLVM version: 9.0

Here is the output of CARGO_LOG=cargo::util::paths=trace cargo build:

   Compiling hello_world v0.1.0 (/Volumes/GoogleDrive/My Drive/hello_world)
[2020-06-22T03:11:07Z DEBUG cargo::util::paths] invocation time for "/Volumes/GoogleDrive/My Drive/hello_world/target/debug/.fingerprint/hello_world-6706d124191574b7" is 1592795467.000000000s
warning: Hard linking files in the incremental compilation cache failed. Copying files instead. Consider moving the cache directory to a file system which supports hard linking in session dir `/Volumes/GoogleDrive/My Drive/hello_world/target/debug/incremental/hello_world-3lr0nf7wfwzik/s-folk4weenq-3aqig3-working`

warning: 1 warning emitted

[2020-06-22T03:11:07Z DEBUG cargo::util::paths] linking /Volumes/GoogleDrive/My Drive/hello_world/target/debug/deps/hello_world to /Volumes/GoogleDrive/My Drive/hello_world/target/debug/hello_world
[2020-06-22T03:11:07Z DEBUG cargo::util::paths] link failed Function not implemented (os error 78). falling back to fs::copy
[2020-06-22T03:11:07Z DEBUG cargo::util::paths] linking /Volumes/GoogleDrive/My Drive/hello_world/target/debug/deps/hello_world.dSYM to /Volumes/GoogleDrive/My Drive/hello_world/target/debug/hello_world.dSYM
[2020-06-22T03:11:07Z DEBUG cargo::util::paths] link failed Operation not supported (os error 45). falling back to fs::copy
error: failed to link or copy `/Volumes/GoogleDrive/My Drive/hello_world/target/debug/deps/hello_world.dSYM` to `/Volumes/GoogleDrive/My Drive/hello_world/target/debug/hello_world.dSYM`

Caused by:
  the source path is not an existing regular file

Originally posted by @khoguan in https://github.com/rust-lang/cargo/issues/4671#issuecomment-647252121

alexcrichton commented 4 years ago

Thanks for the report again! I believe the bug here is likely around here where we're calling link_or_copy on what we expect to be a file, but in this case for dSYM it's a directory. We can't fall back to copying a directory!