Add clippy for Rust by narpfel · Pull Request #7477 · compiler-explorer/compiler-explorer

I suspect this has something to do with the changing of the customCwd, was there a particular reason for that?

clippy-driver produces basically the same intermediate files that rustc generates, so this can clash similarly to #7012:

`strace` output comparing `rustc` and `clippy-driver`

rustc:

$ strace --follow-forks rustc main.rs |& grep open | grep '"[^/][^"]*"'
openat(3, "nightly-x86_64-unknown-linux-gnu", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
[pid 89534] openat(AT_FDCWD, "main.rs", O_RDONLY|O_CLOEXEC) = 7
[pid 89537] openat(AT_FDCWD, "main.ag6xynnvnvnd8moyn4jm2d9ew.rcgu.o", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 7
[pid 89538] openat(AT_FDCWD, "main.main.377a27d04d259e8d-cgu.0.rcgu.o", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666 <unfinished ...>
[pid 89541] openat(AT_FDCWD, "main.main.377a27d04d259e8d-cgu.0.rcgu.o", O_RDONLY|O_CLOEXEC) = 3
[pid 89541] openat(AT_FDCWD, "main.ag6xynnvnvnd8moyn4jm2d9ew.rcgu.o", O_RDONLY|O_CLOEXEC) = 3
[pid 89541] openat(AT_FDCWD, "main.tmp03f884e", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 3
[pid 89541] openat(AT_FDCWD, "main", O_RDONLY|O_CLOEXEC) = 3
[pid 89541] openat(AT_FDCWD, "main.tmp2882fbe", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0777) = 3

clippy-driver:

$ strace --follow-forks clippy-driver main.rs |& grep open | grep '"[^/][^"]*"'
openat(3, "nightly-x86_64-unknown-linux-gnu", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
[pid 89499] openat(AT_FDCWD, "main.rs", O_RDONLY|O_CLOEXEC) = 5
[pid 89499] openat(AT_FDCWD, "Cargo.toml", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 89502] openat(AT_FDCWD, "main.ag6xynnvnvnd8moyn4jm2d9ew.rcgu.o", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 5
[pid 89503] openat(AT_FDCWD, "main.main.377a27d04d259e8d-cgu.0.rcgu.o", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666 <unfinished ...>
[pid 89506] openat(AT_FDCWD, "main.main.377a27d04d259e8d-cgu.0.rcgu.o", O_RDONLY|O_CLOEXEC) = 3
[pid 89506] openat(AT_FDCWD, "main.ag6xynnvnvnd8moyn4jm2d9ew.rcgu.o", O_RDONLY|O_CLOEXEC) = 3
[pid 89506] openat(AT_FDCWD, "main.tmp81c5545", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 3
[pid 89506] openat(AT_FDCWD, "main", O_RDONLY|O_CLOEXEC) = 3
[pid 89506] openat(AT_FDCWD, "main.tmpb4b0d34", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0777) = 3

However, when specifying an output filename, this does not clash anymore:

$ strace --follow-forks clippy-driver main.rs -o clippy-output-unused |& grep open | grep '"[^/][^"]*"'
[...]
[pid 89785] openat(AT_FDCWD, "clippy-output-unused.ag6xynnvnvnd8moyn4jm2d9ew.rcgu.o", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666 <unfinished ...>
[...]

So passing -o <something> is probably sufficient that a second tempdir is not needed.