-
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
When cargo can't run because it doesn't have permissions to a file, error messages should mention which file is causing the problem #2306
Comments
This may just be a case where we need to provide a better error message. Could you gist a full log perhaps? I'd also be curious to figure out which function is actually returning this error... |
Sometimes this issue prevents running Cargo commands at all, as in the executed Rust application hangs and does not output anything when using I can't see documentation on logging anywhere. Any idea where to look for log files or how to debug the execution? Should I clone and build to be able to do any proper debugging? I could not find logs anywhere where applications usually do logs. |
Strange, I have now disabled my antivirus as much as possible (uninstalling is the only option left right now), and still the Cargo commands result in
Running without Cargo works fine:
It seems the antivirus may not be the culprit here. I'll continue investigating. |
How are you seeing the |
Examples of what I see in my terminal:
I found that the Cargo is running to some permission wall and uses the Windows error message there. Most searches I made on that error relate to SQL server running on Windows Server. People have been told to fix it by running the SQL server process itself in elevated mode. The directory permissions for my project directory matches what I've always used for my whole system. All other tools which have not explicitly stated that elevated permissions are needed have worked fine (e.g. build tools, compilers, software installers, and so on). The above error messages appear on an elevated cmd.exe prompt too, so it is not about the permissions of the terminal trying to run Cargo. I'll attempt to elevate EDIT: |
Note that access can also be denied if it tries to open a file which another process currently has a lock on. It's not just about permissions. Sure would be nice if Cargo would tell you what operation it was trying to do which caused that error. |
Apparently there were four(!) ghost processes that did not want to die until I suffocated Does Cargo shove processes it cannot "run" to the background for I think the issue here is the behaviour Cargo does when a Rust program cannot be run properly through |
At the very least whenever Cargo tries to access or execute a file, if it errors, it should include the path to the file in the error. |
Did not see such behaviour in my setup. It either hanged or exited with that |
cargo
commands from working
I believe this can be closed. I get:
Which clearly mentions the file that is causing the problem. |
@Restioson This issue is for some situation on Windows where "Access is denied" is encountered, not "Permission denied". Possibly related to anti-virus. Cargo has dozens (hundreds?) of places where it accesses files, and any one of them could have raised that error without printing the path. |
Ah I see. |
Cargo is difficult to use on my system because of this ghost process problem:
|
@seanvikoren Can you run with the |
Hello guys, I just went through this and, if someone has the same problem, it can help: I use the mongodb database locally running on docker, this action created a directory named data within the structure of my project. For some reason, the cargo watch only came back to work now that I ran a Then for diagnostics, check the permissions of the files that are at the same level as your project. The image below is an example of how it didn't work: And below, an example of how I made it work: |
I'm going to close this as probably fixed. Extra context was added to error messages in #8232 among other PRs. Otherwise, without additional information on the specific cases reported here, I don't think any progress can be made. For anyone encountering similar problems, please open a new issue with as much detail as you can provide. |
Same problem: Caused by: |
I'm running the pre-packaged Windows GNU version of Rust on Windows 7 64-bit. I use Avast Antivirus.
When my antivirus is enabled, I cannot use any other
cargo
commands butnew
. All other commands returnAccess is denied. (os error 5)
.After disabling my antivirus' processes, other Cargo commands work fine.
Is this something which could be prevented inside Cargo or is it something that all users should "know" and fix themselves? Is this a known problem?
Building and running exes created with plain
rustc
worked fine when AV was running, so it is related to something Cargo is doing.The text was updated successfully, but these errors were encountered: