rust-lang / rust-lang/rustup

test uninstall_self_delete_works fails on Mac OS

Open
#1,515 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug O-macos
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

Both locally and on CI. It has been broken for some time, we've just not noticed (since before 1.13, and on various versions of Rust). I'm not sure if this is an old regression in Rustup or due to a change in std or even Mac OS.

The test checks that Rustup can successfully uninstall itself. The test process creates some directories and sets up an environment (including the cargo_home directory, which is something like target/tests/rustup-cargo/ch). It then runs rustup-init to install Rustup, then rustup self uninstall -y to uninstall it. As part of that, the Rustup process tries to delete target/tests/rustup-cargo/ch and a bunch of other files and directories. Note that the Rustup executable is target/tests/rustup-cargo/ch/bin/rustup. Deleting most of these files and directories (including target/tests/rustup-cargo/ch/bin) works fine. But attempting to delete target/tests/rustup-cargo/ch fails with ENOENT - directory does not exist. I have verified that it does in fact exist. It ends up being removed by the test process after the test finishes (and fails because it can't delete the directory).

Trying to delete the directory anywhere in the Rustup process fails (I tried using different ways to delete it in (i.e., not just remove_dir_all) lots of different places. Deleting it in the test process works fine. Therefore, I think there is some kind of lock on that directory by the test process. Nothing I could do in Rust fixed this (trying to prevent any possible way of keeping the directory open). DTrace and Fuser told me nothing useful, permissions on the directory are fine. I don't know enough about Mac OS to investigate any further :-(

Given that this seems to be a bug due to the test architecture and not a bug in real life, we'll ignore this test on Mac OS. However, it would be great to find out what is going on here, and/or rewrite the test some how so that it works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating and reproducing the uninstall_self_delete_works test on macOS, focusing on the cargo_home path target/tests/rustup-cargo/ch and the rustup-init self-uninstall flow. Investigate why the test process can remove the directory while Rustup reports ENOENT, then either make the test reliable on macOS or document and apply a narrowly scoped skip.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, rust
Domain
operating-systems, testing-qa
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.