-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
warning: File system loop found: xxx
printed when running cargo run
on file not ever needed by cargo
#12600
Comments
Hmm… I don't know how 1.71.0 and 1.72.0 differ. |
For background, the message is coming from the |
IMO symlinks pointing to ancestor directories is normal on Unix. This ought not to generate a warning. Is there a way to completely suppress it? |
Also, cargo should be following symlinks which are not relevant to its own operation. In my project I'm getting warnings about "loops" in my A working tree might contain symlinks to hazardous or untrusted data (for example, in test temporary directories, or test cases). cargo ought not to be scanning the whole directory tree. Tools that scan "every file" in a subtree ought not to be following symlinks at all. |
I believe this is only happening when using build scripts which makes things a bit fuzzier. #9931 does not help. |
The warning was introduced via #10214. If it is really that common we should be open to adjust #10214 (comment). However, that means we either need to reopen #9528, or has a |
Could you provide context to this. In what way are they common? What is the use case, particularly as it relates to cargo source trees? |
I find this question perplexing. I can try to expand: I have been working with Unix systems since 1989. In my experience symlinks to ancestor directories are common. The usual reason is simply (i) we use symlinks a lot, whenever we have some situation where a file or directory is being searched or used or most conveniently found in one place, but we want it to be physically located elsewhere. Reasons might include: so that it is updated as part of the right subsystem; to put it on the right filesystem volume with the right storage properties; to put it on the right fileserver; to refer to objects from a superior security context; to refer to a separately managed (sub)project; compatibility reasons. Plus, (ii) often the actual location wants to be an ancestor of the symlink, and this is normal and supported on Unix and doesn't cause any problems. Conversely tree walking tools on Unix don't generally descend through symlinks. (Some older tools need to be given a special option.) One example is that symlinks to
The one that happened to me yesterday is this: https://gitlab.torproject.org/tpo/core/rust-maint-common/-/tree/main You'll observe that it has a symlink https://salsa.debian.org/dgit-team/tag2upload-service-manager/-/tree/main/maint?ref_type=heads For reasons I don't understand,
IMO cargo doc has no business grobbling around in |
|
Oh, and:
Note that it is not reasonable to assume that a project source tree being processed by cargo is (just) "a cargo source tree". Projects typically contain information and source code aimed at multiple different kinds of tools, of which cargo is only one. Even pure Rust projects typicaly contain CI metadata, project management scripts, test case including test data, etc. More sophisticated projects will contain websites, documentation, and subprograms written in other languages. In summary, cargo should do its job, but mind its own business. That's part of playing well with others. It's also part of being a robust and safe tool. Tree contents that don't have names indicating that they are for cargo, may be worse than confusing to cargo. They may be hazardous - possibly much more hazardous than the mildly anomalous test data in the OP's test cases. |
How exciting. I see that #9528 is closed. It's a shame that the proper solution remains unimplemented since 2021. Is there a ticket to track this defect? |
They are |
@ijackson my question was not "why use symlinks" but "why use recursive symlinks in Rust projects". Most of the answer you gave seems to be about symlinks more generally. The examples come closest.
I don't quite get the flattening aspect. I understand compatibility though that would only be in transition and so not the most important for resolving this. The other case seems to be about providing a default for a tool that can be redirected?
Following symlinks is Cargo doing its job. We're fingerprinting all of the input for a build. If we stopped at symlinks, we wouldn't know if the target content changed. What could be done better is for those linked issues to be fixed so we only scan explicit or implicit inputs to a build. from #15141 (comment)
We'd be blocked on #12235 |
I agree that this is the right resolution. It would resolve the situation completely. Thanks.
Right. I can live with the warnings. In the meantime, whether to follow symlinks while scanning the whole tree is still a question, I think. In the usual case, symlinks will point to other parts of the same build tree. Having them point "out of the tree" is going to be less likely. If we're scanning the whole tree, in-tree symlink targets don't need to be scanned at all. After all, we'll find the files at the symlink's target when we scan them directly, under their real paths. The problem is with out-of-tree symlinks. I think scanning these is hazardous. They might point anywhere and having cargo follow those links is quite unexpected. On the other hand, some folks may deliberately make links pointing out of tree as a kind of ersatz git subtree. I suggest the following resolution for now:
|
This troublesome warning also happens if you have a |
Problem
cargo run
prints awarning: File system loop found: xxx
warning message on every build, for a symlink that is not ever needed by Cargo.This file is in a
fixture/
directory. The fixture exists specifically to test the code with this file system loop case.Steps
protoc
andcmake
cargo run
Observe:
Possible Solution(s)
No response
Notes
This did not occur in 1.71.0.
Version
The text was updated successfully, but these errors were encountered: