cargo pgo optimize: Invalid cross-device link (os error 18)
burjui opened this issue · 6 comments
I get this error when I run cargo pgo optimize
on a project under /home
, which is mounted on a separate partition. If I copy the project to e.g. /tmp
and run the command on the copy - no problem whatsoever.
Heh, I was wondering whether this error could happen.. it seems that it indeed can happen :) I think that this is probably caused by the usage of std::fs::rename
in pgo optimize
. Sadly the std::io::ErrorKind::CrossesDevices
error kind is still unstable, so I cannot detect this error easily, but I will change the code to just perform a non-atomic copy + delete if a move fails.
Could you please check if #17 fixes your problem?
$ cargo install --git https://github.com/kobzol/cargo-pgo --branch move-across-devices
Yes, the problem is gone, thank you :)
I met this error as well. I was building https://github.com/Wilfred/difftastic through these commands:
$ cargo pgo run -- sample_files/slow_before.rs sample_files/slow_after.rs
$ cargo pgo optimize run -- sample_files/slow_before.rs sample_files/slow_after.rs
My project is put in home dir. /tmp
of my computer is tmpfs, while /home
is btrfs.
I did not release a new version with the fix yet, I will do it soon.
Does it work for you with
$ cargo install --git https://github.com/kobzol/cargo-pgo --branch main
?
It works perfectly. Thanks!
Great :) I just published version 0.2.1
with the fix.