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

"File system loop found" upon cargo build #10213

Closed
winterqt opened this issue Dec 18, 2021 · 1 comment · Fixed by #10214
Closed

"File system loop found" upon cargo build #10213

winterqt opened this issue Dec 18, 2021 · 1 comment · Fixed by #10214
Labels
C-bug Category: bug

Comments

@winterqt
Copy link

Problem

When running cargo build, an error is thrown:

Caused by:
  failed to determine the most recently modified file in /path/to/package

Caused by:
  failed to determine list of files in /path/to/package

Caused by:
  File system loop found: /path/to/package/node/tools/node_modules/eslint/node_modules/eslint points to an ancestor /path/to/package/node/tools/node_modules/eslint

Steps

  1. Clone nodejs/node to a package directory
  2. Run cargo build

Possible Solution(s)

No response

Notes

This does not occur on Cargo v1.56.0 (I'm experiencing this on 3787309).

Version

cargo 1.59.0
release: 1.59.0
host: aarch64-apple-darwin
libgit2: 1.3.0 (sys:0.13.25 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:SecureTransport)
os: Mac OS 12.1.0 [64-bit]
@winterqt winterqt added the C-bug Category: bug label Dec 18, 2021
@weihanglo
Copy link
Member

weihanglo commented Dec 18, 2021

This was introduced by the patch #10188

Here is a reproducible script:

mkdir eloop && cd eloop
cargo init . --vcs none
mkdir -p a/b/c
ln -s "$PWD/a/b" a/b/c/d

Then run cargo doc, you will see a similar error:

[
    "/Users/me/eloop/Cargo.lock",
    "/Users/me/eloop/Cargo.toml",
    "/Users/me/eloop/_build.rs",
    "/Users/me/eloop/a/b/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e/c/e",
    "/Users/me/eloop/src/main.rs",
],

Why cargo before #10188 can succeed to build is that cargo ignores bad symlinks when checking it's mtime. Unfortunately #10188 proactively detects symlink loop and aborts when got one. I guess a revert might be fine.

@bors bors closed this as completed in 2478331 Jan 5, 2022
weihanglo pushed a commit to weihanglo/cargo that referenced this issue Jan 12, 2022
…alexcrichton

Be resilient to most IO error and filesystem loop while walking dirs

Let `PathSource::walk` be resilient to most IO errors and filesystem loop.

This PR also

- Add a test validating the resilience against filesystem loop to prevent regression.
- Emit warning when filesystem loop found while walking the filesystem. This is the only way I can think of now to solve rust-lang#9528

Fixes rust-lang#10213.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants