-
Notifications
You must be signed in to change notification settings - Fork 893
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
Delete content of downloads dir of user home in update subcommand #2046
Delete content of downloads dir of user home in update subcommand #2046
Conversation
594bd10
to
8cc51ff
Compare
60eb620
to
3b87cba
Compare
@timw4mail, good 👁. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for trying to solve this particular issue. However there are a couple of fundamental things which need changing.
One is that you need to properly manage the download path by means of the Cfg
instance which exists already, and not keep casting paths into strings. String
guarantees utf8 correctness, but UNIX paths are NOT guaranteed to be valid UTF8, hence Rust has Pathbuf
and Path
.
The second is that I really don't want to see the downloads dir cleaned up unless the user has just completed a full rustup update
because that's the only time where we can be sure that the partials are no longer needed.
There is a call to common::update_all_channels()
in update()
in rustup_mode.rs
which is where you should be adding your call to delete the downloads contents. i.e. in update()
after common::update_all_channels()
.
If you want additional help with making these changes, just let me know.
Thanks again,
D.
It may also make sense to solve #1252 at the same time, by adding support for cleaning up the content of the temp directory in |
4ff9ee1
to
cdc32c2
Compare
cb9c20c
to
f33ed66
Compare
@kinnison, thanks for the insightful comments. Last commit attempted to follow the suggestion, hopefully, make the calls to clean up "downloads/" and "tmp/" dirs at the right place where after a full rustup update. PTAL at convenience? Will promptly edit under guidance, if this version still is calling the cleanup functions at the right place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good, but I don't understand why there's a Cargo.lock
change here since you don't touch Cargo.toml
-- could you please remove that from the diff, and rename the variable as per my comment, then I think we're almost good to merge.
416dcf3
to
8825fdb
Compare
Reverted the overlook of Cargo.lock file in the PR.
Sounds great. Last commit renamed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One little tweak, but I can do that on merge if you don't want to.
854c4a8
to
0db473b
Compare
@kinnison, pushed another update for another tweak. Thanks for catching the unnecessary borrow. 👍 |
Resolves #2038.
P.S.: can use some mentoring from review comments to:
update
and assert the deleted content ofdownloads
folder of user home.I'll keep thinking, and will push edit(s), if I could figure out a better test. But thought that I'd start the PR to collect some feedback.