Skip to content

Unreproducible "failed to remove file" from cargo doc #13531

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

Closed
ijackson opened this issue Mar 4, 2024 · 3 comments
Closed

Unreproducible "failed to remove file" from cargo doc #13531

ijackson opened this issue Mar 4, 2024 · 3 comments
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@ijackson
Copy link
Contributor

ijackson commented Mar 4, 2024

Problem

 Documenting rustls-webpki v0.101.7
 Documenting webpki v0.22.4
error: failed to remove file `/volatile/rustcargo/Rustup/Arti/arti/target/doc/webpki/time/struct.Time.html`

Caused by:
    No such file or directory (os error 2)

Error: failed to remove directory `/volatile/rustcargo/Rustup/Arti/arti/target/doc/webpki/time`

Caused by:
    No such file or directory (os error 2)

Error: failed to remove directory `/volatile/rustcargo/Rustup/Arti/arti/target/doc/webpki`

Caused by:
  No such file or directory (os error 2)
warning: build failed, waiting for other jobs to finish...

Steps

I don't have a reproducer. This is about the third time this has happened to me. In each case, running the original cargo doc command again "seems to fix it".

Possible Solution(s)

Probably, cargo is doing things in parallel to the same files. #6313 may be related.

Until #6313 can be fixed, cargo should at least take some kind of lock, or put pids in filenames, or something, to avoid this kind of uncontrolled behaviour. Having "one or the other" version documented is tolerable. Randomly crapping out isn't.

Notes

The command I ran was nailing-cargo doc --document-private-items --all-features --workspace which turns into cargo doc --locked --offline --document-private-items --all-features --workspace. I was in arti.git#ab950a685900bce50bd54e24694243592a2c5c67. I don't think this information is relevant, though.

Version

rustcargo@zealot:/volatile/rustcargo/Rustup/Arti/arti$ cargo version --verbose
cargo 1.77.0-beta.5 (837c09f04 2024-02-16)
release: 1.77.0-beta.5
commit-hash: 837c09f04022352c26cf445f37492709922b24ef
commit-date: 2024-02-16
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.5.0-DEV (sys:0.4.70+curl-8.5.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Debian 10 (buster) [64-bit]
rustcargo@zealot:/volatile/rustcargo/Rustup/Arti/arti$
@ijackson ijackson added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Mar 4, 2024
@ehuss
Copy link
Contributor

ehuss commented Mar 4, 2024

Thanks for the report! I'm pretty certain this is #6313 and #10368, since it prints the warning:

The lib target `webpki` in package `webpki v0.22.4` has the same output filename as the lib target `webpki` in package `rustls-webpki v0.101.7`.
Colliding filename is: /Users/eric/Temp/z19/arti/target/doc/webpki/index.html
The targets should have unique names.
This is a known bug where multiple crates with the same name use
the same path; see <https://github.com/rust-lang/cargo/issues/6313>.

I don't think we need another issue to track the collision. Of course it would be good if cargo didn't randomly fail on collisions, but I think those other issues cover the tracking of trying to address it.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2024
@ijackson
Copy link
Contributor Author

ijackson commented Mar 5, 2024

With respect, I don't agree that this bug should be closed.

This bug is about he fact that cargo doc randomly fails.

This is an aspect of the situation that is not covered by other bugs.

Neither #6313 nor #10368 reasonably represents the fact that cargo is rendered generally unreliable. Neither of them contain the error message that I experienced (and, naturally searched for). #10368 merely quotes the general "there are have duplicate outputs" message. #6313 is a tracking issue.

This bug could be fixed separately.

It would be possible to address the unreliability without eliminating the dup[licate artiffacts. Possible workarounds in cargo include additional serialisation, more careful/robust handling of output file writes, or tolerating certain errors.

That would leave a situation where cargo would reliably run to completion; the docs output for the affected crates would still be unpredictable and maybe broken, but other documentation would be unaffected, and the overall run would complete. That would be a significant practical improvement.

#6313 has been open for over half a decade. Expecting it to be fixed soon would be the triumph of hope over experience.

The background is that we need Rust to be reliable. That means we need cargo to not randomly fail.

@robamu
Copy link

robamu commented Jul 11, 2024

I think I have this issue as well, but it can only be re-produced in CI? See https://github.com/us-irs/va416xx-rs/actions/runs/9797632441/job/27337932825

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

3 participants