-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo test
on cargo itself fails spuriously on Windows
#12042
Comments
also, this isn't a bug necessarily, but many other tests will fail unless |
This seems related to #11442 and #11872 in that cargo (currently) uses its own logic for removing directory trees. Which has nicer error output but doesn't handle all the edge cases on different platforms. In this particular case, git is setting the readonly attribute, which prevents deletion under win32 semantics. I guess they were expecting it to work like the unix permission. Things like rm -r -force and remove_dir_all essentially ignore the attribute. EDIT: Oh wait: switching to the |
This is the key part: I've been having this same problem on my system, but I was thinking it was something unique to my environment. I'm glad to see it's not just me. 😄 Something is creating this AppData directory in the mock home directory:
I've spent a fairly large amount of time searching on the internet for what could possibly be causing this, but I have not had much luck. Some of the searches I've had refer to InetCache as being a directory junction. But AFAICT, mine is not a junction. There is something funky about these directories. Most tools (like pwsh or cmd or explorer) can't even view the contents of the
I've checked permissions, and I don't see why. I saw some comments about "Virtual Folders" in some searches, but I'm not sure if that is the case here. I would love if someone could help figure this out. I've been hitting this for a very long time, and it has been driving me batty. The creation of these directories seems semi-random, and I can't find a correlation to what might be causing them. @jyn514 Can you include the complete version information of @ChrisDenton This is using |
One theory is that it is the VCTIP (VC++ Technology Improvement Program). I tried turning off telemetry, but it didn't seem to fix it. 😦 Maybe I didn't turn it off in the correct place? |
Ah I see! My workflow here would be to use Process Monitor to record events while cargo's tests are running and to apply filers for the file/directory names. My first assumption here would be that something in cargo's tests is loading a dll related to web stuff. |
I can try running process monitor in a bit. Is there a Windows version of |
Oh I see, ProcMon is the Windows version of strace. I'll see what I can find. |
@ehuss I don't think the version of cargo in my default toolchain is relevant. I can reproduce this just by running |
It might be because powershell is part of the telemetry system. Do you have VSCode running? That has a separate telemetry system from Visual Studio. |
I do. Let me close everything I have open and see what still pops up. |
Hmm, I set HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSCommon\17.0\SQM\OptIn to 0 as suggested in https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2017/ide/visual-studio-experience-improvement-program?view=vs-2017, but I'm still seeing the folder created by VCTIP, even after a restart. |
|
Ok, I'm at a computer now. I'm not sure if these work to disable telemetry completely but on my own machine I have these two environment variables set globally:
The directory in question seem to have an explicit "Deny" permission of listing the contents of a directory. It seems our |
I confirmed on my system that it is VCTIP as well. The item that seems to be the most trouble is Unless I'm mistaken, I think PowerShell just uses the facilities defined here. However, I can't quite follow from that what is unique about being a Reparse Point + having a restricted ACL. (The |
Linked above is a fix. If anyone were able to test test it then that would be grand. I did so using the following little app compiled first without the patch (which failed) and then with (which worked): fn main() {
let path = std::env::args().nth(1).unwrap();
println!("deleting {path}");
std::fs::remove_dir_all(&path).unwrap();
} |
I confirmed that rust-lang/rust#110918 works with deleting the troublesome directories. I'm going to close this issue as this seems to be a combination of external factors (VCTIP creating weird files and fs::remove_dir_all not being able to remove them). Solutions will hopefully be the linked PR, and disabling VCTIP here (I'm not sure if just the registry entry is enough, or if |
BTW, thanks @jyn514 and @ChrisDenton for helping with this, it is greatly appreciated! |
…r=cuviper `remove_dir_all`: try deleting the directory even if `FILE_LIST_DIRECTORY` access is denied If opening a directory with `FILE_LIST_DIRECTORY` access fails then we should try opening without requesting that access. We may still be able to delete it if it's empty or a link. Fixes rust-lang/cargo#12042
`remove_dir_all`: try deleting the directory even if `FILE_LIST_DIRECTORY` access is denied If opening a directory with `FILE_LIST_DIRECTORY` access fails then we should try opening without requesting that access. We may still be able to delete it if it's empty or a link. Fixes rust-lang/cargo#12042
`remove_dir_all`: try deleting the directory even if `FILE_LIST_DIRECTORY` access is denied If opening a directory with `FILE_LIST_DIRECTORY` access fails then we should try opening without requesting that access. We may still be able to delete it if it's empty or a link. Fixes rust-lang/cargo#12042
`remove_dir_all`: try deleting the directory even if `FILE_LIST_DIRECTORY` access is denied If opening a directory with `FILE_LIST_DIRECTORY` access fails then we should try opening without requesting that access. We may still be able to delete it if it's empty or a link. Fixes rust-lang/cargo#12042
`remove_dir_all`: try deleting the directory even if `FILE_LIST_DIRECTORY` access is denied If opening a directory with `FILE_LIST_DIRECTORY` access fails then we should try opening without requesting that access. We may still be able to delete it if it's empty or a link. Fixes rust-lang/cargo#12042
Problem
cargo test
is failing intermittently for me on Windows.Steps
Run
cargo t --test testsuite warn_on_failure::no_warning_on_bin_failure
on windows MSVC until you get a test failure. This usually only takes 2 or 3 run to fail for me, and once it fails once it will continue to fail until I runrm -r -force target\\tmp\\cit\\t0
.I am not sure what
-force
is doing thatCargoPathExt::rm_rf
isn't. Without force,rm
gives the same error as cargo. https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/remove-item?view=powershell-7.3#example-3-delete-hidden-read-only-files says it might be related to the index being read-only?Some more info that may or may not be helpful:
that
.git/objects
path apparently doesn't have write permissions set:I tried switching to https://github.com/XAMPPRocky/remove_dir_all, but it didn't help.
Possible Solution(s)
No response
Notes
No response
Version
8bcf8fe
The text was updated successfully, but these errors were encountered: