Skip to content
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

Open
lucacasonato opened this issue Aug 30, 2023 · 6 comments · May be fixed by #15141
Labels
A-build-scripts Area: build.rs scripts C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@lucacasonato
Copy link

Problem

cargo run prints a warning: 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

  1. Clone https://github.com/denoland/deno.git
  2. Install protoc and cmake
  3. cargo run

Observe:

warning: File system loop found: /path/to/deno/test_util/std/wasi/testdata/fixtures/symlink_to_parent_directory/fixtures/symlink_to_parent_directory points to an ancestor /path/to/deno/test_util/std/wasi/testdata/fixtures/symlink_to_parent_directory

Possible Solution(s)

No response

Notes

This did not occur in 1.71.0.

Version

cargo 1.72.0 (103a7ff2e 2023-08-15)
release: 1.72.0
commit-hash: 103a7ff2ee7678d34f34d778614c5eb2525ae9de
commit-date: 2023-08-15
host: aarch64-apple-darwin
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 7.88.1 (sys:0.4.63+curl-8.1.2 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Mac OS 13.4.1 [64-bit]
@lucacasonato lucacasonato added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Aug 30, 2023
@weihanglo
Copy link
Member

Hmm… I don't know how 1.71.0 and 1.72.0 differ.
Could you try adding exclude = ["testdata/"] to test_util/Cargo.toml? I feel like this may solve the problem.

@epage
Copy link
Contributor

epage commented Aug 30, 2023

For background, the message is coming from the ignore crate which we use to walk path sources to fingerprint them for detecting rebuilds.

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Aug 30, 2023
@ijackson
Copy link
Contributor

ijackson commented Feb 2, 2025

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?

@ijackson
Copy link
Contributor

ijackson commented Feb 2, 2025

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 maint/ directory, which cargo ought not to be looking at.

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.

@epage epage added the A-build-scripts Area: build.rs scripts label Feb 3, 2025
@epage
Copy link
Contributor

epage commented Feb 3, 2025

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 maint/ directory, which cargo ought not to be looking at.

I believe this is only happening when using build scripts which makes things a bit fuzzier. #9931 does not help.

@weihanglo
Copy link
Member

weihanglo commented Feb 4, 2025

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 debug! log helping future debugging. I lean to the logging approach a bit more, though people might still be confused because there will be no warning in the first place. See

@weihanglo weihanglo linked a pull request Feb 4, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-scripts Area: build.rs scripts C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants