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

Rustup should always clean after itself #2202

Closed
gnzlbg opened this issue Jan 14, 2020 · 8 comments
Closed

Rustup should always clean after itself #2202

gnzlbg opened this issue Jan 14, 2020 · 8 comments
Labels

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Jan 14, 2020

After a successful rustup update (or maybe even after each successful rustup command), the RUSTUP_HOME directory should be in a "clean" state.

Example of a non-"clean" state:

ls .rustup/downloads
0018255b94a01c42bcf6f4c3f2b2cb008d9e870811abd7b491c1a5decc7dcef8         9704de3c1ddf5711026a6e76e4a74564314a56d192f94c6e9be73f53e128bd0a
0d1e77d383480dde5cd1ef00d4edf711ea8366e28995ff5b37856a292c0efb6d         a85620550390318cef250ef36e174c4922ab83848ab2502dfb74bfaa50b5267a
14a696cd425757956f0edbcaaa887c5e4c6b8b3248c1a5a88fbad27741411ece         a998c2af9af897c8ee288683fc4ac15222bea6ded995f0933f54f921c708053b
1642bc5f123f61c9bb8e99a2600f7adf68e6c21c960b482a0dcb6382332fff3e         a9a541657ad067c823d7436ef875ff2e6b5da67fabe38b874527d0efe8b46799
25d95e34bc33065dfd5c5452f8ebf87c63b74bc73873cd0dd76f0ab709f0a3da         b5cee0b7be3803c7c194bb6a3bfe85c5857d1696c84f1408a46d74b42471f976
279e047a5f91cde4767366c446bb38e3584cb81a531003624aa90bff4e9a78ef         b74e2a2b7192429478a819f5ddc27f17bacd75fdea62e8e941fa9adb174d678d
3633caab24d17af3a2679aefad736a9a43c40a75688ff849fcfcd6b86b5098dd         c15f37fc933c09359ae5fa8d33865379a4c7f23328fee09bb5e8871edc6e6fff
3e1d35f15a7f164f4cbfdc0f9f3797f81841498f5c9d9219373a74d62a495c89         c2ee290ad72ec327f43febc3e47e962eefa3f71bd7ea1af83b7c555995992fc7.partial
5e1e4b41fb275751115cf110c1b9b488c0b2a28d5cfced0d931e4b411111df2e.partial d2863fdab15e37a069d3372f529c1f4d4019860f272f5d437d52e5cb24f7b1e9
6641bfba31ef754b331bacc91b94ff45aba2394258fba5ead11479465ee95305         e2695c482277e33af377fce7fd8ca066ed8ab8d6ec482915ca4b774e11e519a2
7185fe0838b512eb87096b23e95b8c5a76fd0c962cbddfb2c34ed0eec0841e5a.partial e76515c5b75da508745259d145d513384fd33fdbe38918aa955e795a26db075c
7243706338030c46adbad4b387d493003e2cd01cfa5226dffdc8975bbccbd396         ec0e28cc0452b871c0b57289560dc30f49ff026d5b2513d9fc3071ef3d0d67ad
7525b45aca040b3d8c0dcb532128dfc0c09cf603746e507d2e0d940bd9e3ce20         ede4f03d16fdec8a88706fce1f52c0bfc34744dfbdc01dc0b1fa058ea71836af
8700c284bc6d61fdd4d0ef26cd68fe2b65f625701709493c106ca5f46e85d1b8         ef0e0bb8abf76b81f0999816595a56982a50791e58ee2895540969a5036a53bd
89b368af8f1a8fd94c70b249cf93dbb0ee2513585e2f84992e888fee1904049a         f20b176e10fec12b15fd7b9a172c4113150d416bf3b682e1f4e5fe7d4992d678

du -h ~/.rustup/downloads/
2.5G /Users/gnzlbg/.rustup/downloads/

That's 2.5 Gb of useless files.


Ideally,

  • we would have a definition of what "clean" means for the RUSTUP_HOME directory,
  • APIs to e.g. iterate over all files that would need to be removed for the RUSTUP_HOME directory to become clean
  • Decide which rustup commands, on success, should enforce that the RUSTUP_HOME directory is clean (e.g. rustup update, rustup self update, etc.) - I think we should try hard to avoid a rustup clean command, since users should not be required to know that such a command exists to avoid wasting multiple Gbs of files.
  • Tests that make sure that whatever gets implemented works.
@gnzlbg gnzlbg added the bug label Jan 14, 2020
@jyn514
Copy link
Member

jyn514 commented Jan 14, 2020

I would really appreciate this, my main partition only has about 50 GB and rust uses 5-10 of that after installing stable, nightly, and a few docker volumes for docs.rs. Knocking thar down by 2 GB would be an enormous win :)

@kinnison
Copy link
Contributor

I'd love to know what version of rustup you have there, since 3 months ago this commit was added: 0db473b and it was in #2046 that it was merged and released as part of Rustup 1.21.

@jyn514
Copy link
Member

jyn514 commented Jan 14, 2020

Look at that, you fixed it and I didn't even notice!

$ rustup update
...
  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.40.0 (73528e339 2019-12-16)
   nightly-x86_64-unknown-linux-gnu updated - rustc 1.42.0-nightly (859764425 2020-01-07) (from rustc 1.42.0-nightly (c5840f9d2 2020-01-03))

info: cleaning up downloads & tmp directories
(bash@lubuntu-thinkpad) ~/.../rust/rcc ▶️ usage /home/joshua/.local/lib/rustup/
894M	/home/joshua/.local/lib/rustup/toolchains
894M	/home/joshua/.local/lib/rustup/
12K	/home/joshua/.local/lib/rustup/update-hashes

Thanks so much for your hard work!

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jan 15, 2020

@kinnison I have rustup 1.21.1 (7832b2e 2019-12-20), hope that helps.

@kinnison
Copy link
Contributor

@gnzlbg Oh dear, that really ought to be cleaning up. If you run rustup update do you get info: cleaning up downloads & tmp directories at the end, and if so, is it still full'o'crud?

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jan 16, 2020

@gnzlbg Oh dear, that really ought to be cleaning up. If you run rustup update do you get info: cleaning up downloads & tmp directories at the end, and if so, is it still full'o'crud?

Sadly I manually deleted all the files when filling this issue, so I don't have those precise files anymore to reproduce. I did run rustup update, rustup self update, etc. and none of these commands removed the files, but I don't remember if I got the info: ... part. - it does not ring a bell, but I was not paying attention to that either.

I just touched some files in the directory, ran rustup update and the whole directory was deleted. Maybe rustup has some registers of files it should not delete within ~/.rustup/downloads ?

I should not have deleted the files so that we can reproduce, but I needed the space :(
Without a way to reproduce, it might be worth it to close this issue.

@kinnison
Copy link
Contributor

There's no such registry, but perhaps rustup hadn't updated itself at the point that you noted the large download waste? If you could keep an eye on it for a bit and if you can't reproduce it then decide when you feel this could be closed?

@kinnison
Copy link
Contributor

No further updates from @gnzlbg so I'm closing this. If it happens again, a fresh issue with reproduction instructions would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants