rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.71k stars 12.5k forks source link

`compiletest::runtest`: `aggressive_rm_rf` does not like symlinks on Windows #129155

Open jieyouxu opened 3 weeks ago

jieyouxu commented 3 weeks ago

While reviewing #128562 and testing I discovered that runtest.rs's aggressive_rm_rf is not aggressive enough, unfortunately, because symlink-to-dir and symlink-to-file on Windows need different handling.

Have not considered junction points and hard links.

This can cause a rmake.rs test that creates symlinks to have its output artifacts fail to be removed on non-fresh test runs.

RalfJung commented 3 weeks ago

Doesn't one need admin permissions to even create symlinks on Windows? At least in Miri we had trouble with people not being able to run tests on Windows because they created symlinks. The tests worked on CI where apparently we do have enough permissions (or developer mode is on), but not on contributor's machines.

So it seems like a bad idea to make the rustc test suite rely on symlinks on Windows. Or am I missing something?

jieyouxu commented 3 weeks ago

Doesn't one need admin permissions to even create symlinks on Windows?

It's a bit weird because symlinks have specific priviledges (individual perms or developer mode), and AFAIK you don't necessarily need admin perms (or developer mode) to create them.

So it seems like a bad idea to make the rustc test suite rely on symlinks on Windows. Or am I missing something?

compiletest has a directive //@ needs-symlink which will ignore the test if we don't have symlink priviledges.

jieyouxu commented 3 weeks ago

Re-opening due to revert #129413.