-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Let Cargo put data into platform-specific directories #1615
Conversation
There's a stale pull request to do something like this: rust-lang/cargo#2127, I'll gladly update it if it is desired. I figured that it might be big enough of a change to justify an RFC. |
|
||
* This increases the complexity of where to find the files Cargo uses. This can | ||
be alleviated by providing library functions for Cargo related tools and a | ||
command line to tell which paths are in use. |
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.
It's not just this though; it's also things like documentation, explaining how cargo works to the user, etc
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.
Good point, added to the section.
|
||
``` | ||
cache: .cache/cargo | ||
config .config/cargo |
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.
These should use the XDG_CONFIG_HOME
and XDG_CACHE_HOME
environment variables
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.
They are, perhaps I should clarify that a little. We're following the XDG spec, and by default it's these directories.
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.
+1 on clarification.
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.
Done.
I personally think all CLI tools should adopt XDG on all *nix platforms as the only reasonable attempt at a standard that anyone's produced. There's no actual standard on any *nix platform as far as I know, and I don't see a way that storing the files in the way specified by XDG is worse than storing them in I don't think that Rust tools should do something different on OS X from what they do on other *nixen, for the reasons cited in the issue. |
@withoutboats Indeed, and that's also what |
* Putting caches in designated cache directories allows backup tools to ignore | ||
them. | ||
* Using a `.cargo` directory on Windows is not idiomatic at all, no programs | ||
for Windows would such a directory. |
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.
Typo: "no programs for Windows would such a directory".
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.
Fixed.
This swaps an alternative with the appropiate section in detailed design.
@withoutboats I exchanged the plan for OS X with one of the alternatives. Now everything is the same across non-Windows platforms and only Windows differs. |
Another huge upside to this is that it removes clutter from |
Could you elabrate? What tools will interacts well (better) with Cargo, and why? Edit: cache or disk cleanup tools will benifit at least, as the motivation section said. |
One drawback that may want to be added to this is that there are a good number of other apps and such which don't follow the XDG spec on Linux, and likely for their own "good reasons". This in turn means that if one day the spec becomes widely adopted it will likely need to be changed in one form or another. Put another way, many other major projects aren't following this spec, and to follow the spec it's quite likely that it'll need some sort of breaking change in one way or another. It's seems like it may be risky to hitch ourselves to this bandwagon? Also, are there any other apps which follow XDG on OSX? Is the spec even defined for OSX? I'd be quite hesitant to follow a Linux spec on OSX as it seems like we'd just be winding up in the same situation of OSX users thinking that we're not doing the "native thing" |
@alexcrichton On my MacBook, I have "configstore", "fish", "git', "gtk-2.0", "htop", and "nvim" directories in my |
On Linux, my impression is that all per-app dotfiles/dotdirs either predate or are done in ignorance of the XDG spec. Separating configuration from caching is quite useful and I cannot envision any downsides. |
That's been my experience as well. @alexcrichton Are you aware of any projects that would follow the spec if some sort breaking change were implemented? Most cases I've seen where it was brought up and rejected were due to inertia. |
@alexcrichton on linux:
Is there a specific program with issues with xdg that you're thinking of? |
From the RFC text:
[1]: the installer can/already do this (one off job). not a benefit. So, there is only one benefit: to make 3rd-party tools happy, to help them find/clean cargo's cache data. And this is not a benefit for us, the users and developers of cargo. We get little benefit on this. But it will make difficulty to our life: we must remember more dirs, if we want to find them; we must do more os-specific work to implement it and maintain it; we can't easily create a portable cargo that all in one directory. One more thing: it's not clear what will be put into cache directory. (e.g. Will (XDG spec is nice. But what's the benefit if we follow it?) |
@liigo It is not the only benefit. See my comment from earlier. This should also be added to the RFC text. |
[1] is a benefit because that way, you don't end up with a path in I think it's pretty clear that all of these are benefits. Whether they're worth the trade-off is what the RFC discussion should be about, but claiming that they aren't benefits isn't really helping. EDIT: Regarding making 3rd party tools happy vs interacting with them: I as a user would be happy if the backup tool would know to ignore the Cargo cache. This is not for the benefit of the 3rd party tool, but for the benefit of me, the user of Cargo. |
@liigo as a cargo user who sometimes uses other tools also, making cargo interoperate with them better definitely makes my life better. :-) |
To me it seems like everyone would want to implement the change but may not be able to. If no one actually implements it then no one's following the spec, which seems to defeat the purpose of having it in the first place? It seems to me that if updates can't happen, then the spec is frozen as-is today. Then if it's frozen as-is there are major tools which have good reasons for not following it, and there's little hope for those reasons to get resolved?
Looking in my home folder, programs which don't follow xdg include:
Notably including many other languages' package managers. I forget if this has been brought up before, but I've at least discussed it with others. The point about operating with third-party programs is also an interesting one. There are programs which don't follow XDG, so any robust third-party program would already have to handle non-conforming programs with some heuristics. In that sense you may not actually get any benefit at all if Cargo follows XDG because the heuristics are already correctly classifying Cargo. If Cargo isn't falling in the right bucket but could easily do so for some popular programs, that would also be a reasonable course of action I think. |
Both pip and git support XDG.
I use rsnapshot for backups. The heuristic is the user adding exceptions on their own. It would be much nicer if Cargo didn't need an exception. I mentioned advantages and disadvantages in the RFC. It seems that at least the advantages are real for some users. Maybe the discussion should focus on how to weigh these arguments against each other. Especially on Windows, there seems little resistance against using the Windows-specific directories. |
Not everyone. For some programs which have been around longer than I've been alive, following the XDG spec as a fallback would be a change in functionality that has worked for decades. Inertia gets in the way there. "If it ain't broke, don't fix it." I'm not aware of any project that has been told about the spec and decided not to follow it but would have followed it if the spec had X changed where X wasn't just keep doing what already works.
People do implement it: $ ls .config
abrt goa-1.0 Pinta
anjuta google-chrome ppsspp
autostart gtk-2.0 pulse
beets gtk-3.0 QtProject.conf
cef_user_data gvbam ranger
Clementine hexchat retroarch
CuteMarkEd Project htop Rygel
dconf ibus rygel.conf
dleyna-renderer-service.conf imsettings sealert.conf
dleyna-server-service.conf inkscape sonata
easytag insta-site syncthing
enchant jstest-gtk systemd
eog keepnote tilda
epiphany libreoffice tomboy
evince libvirt totem
evolution markdownlint tracker
filezilla menus Trolltech.conf
gambatte mimeapps.list unity3d
gconf monitors.xml user-dirs.dirs
gedit mono.addins user-dirs.locale
gespeaker MonoGame VirtualBox
git mopidy vlc
gnome-boxes mpv watch-later
gnome-builder mupen64plus yelp
gnome-control-center myapp youtube-dl
gnome-initial-setup-done nautilus Zeal
gnome-session nvim
gnote PCSX2 Just not everyone: $ ls -d .?*
.. .git-credential-cache .lastpass .rbtools-cookies
.adobe .gitk .lesshst .sdkman
.bash_aliases .gnome .local .serverauth.22085
.bash_history .gnupg .m2 .serverauth.4384
.bash_logout .gradle .macromedia .speech-dispatcher
.bashrc .grails .mozilla .ssh
.cache .grails_history .multirust .subversion
.cargo .groovy .netrc .Xauthority
.config .gstreamer-0.10 .npm .xinitrc
.emacs.d .ICEauthority .nvimlog .xsel.log
.esd_auth .idlerc .pki .zshrc
.exercism.json .inputrc .profile
.gimp-2.8 .java .python_history
If you're going to make that argument, having at least one example would be nice. You have a point about most other languages' package managers though. You can add sdkman to the list. |
I asked about programs that have issues with XDG, not ones simply that don't impliment it. I'm looking for a downside, a complication, that would cause a program to actively avoid XDG. Right now one hasn't been presented.
I don't believe that is the case. At the least, no one has noted a reason (other than a program being old or inertia) that things don't impliment it. Please let us know if there is some reason you're aware of. |
My opinions on this subject (not commenting directly on the content of the RFC, which I've only skimmed - sorry). I think we should change where It's important for consistency that users can find Rust tools in expected places. There is no universal agreement on Unixes about the future of the XDG spec, and we should not use it by default. For those that want XDG we should consider making it optional. |
I'm going to move to postpone this. We're acknowledging the reality that this isn't moving forward at this time. The Cargo team is interested in seeing better native platform layouts. However, it is evident that there are a lot of details to consider, and discussing them on a PR with over 300 comments probably isn't the best way forward. Unfortunately I don't have an easy answer at this time on how this can make progress, as the team currently doesn't have the capacity to help in depth. Thank you everyone for the comments and time spent looking into this. @rfcbot fcp postpone |
Team member @ehuss has proposed to postpone this. The next step is review by the rest of the tagged team members:
No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
I do very much want to see this, but I agree that this doesn't seem to be making forward progress at this time. @rfcbot reviewed |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to postpone, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This is now postponed. |
I would like to see this implemented. Rust toolchain (incl. What is the policy on "Postponed" RFCs? When would it be feasible to reconsider this? |
The core problem is that those who are interested in fixing this don't make the decisions, and those making decisions aren't interested. |
You can try submitting a new RFC. :) |
This is now the second time I receive a notification mail for a comment that has disappeared in the meantime. I'm wondering who keeps deleting comments, and for which purpose. |
For future reference -- Ruby supports the XDG spec as of 2020: ruby/ruby#2174 |
Please be mindful of those that are only subscribed to this issue because they want to know when/if this will be implemented.
To my knowledge there was nothing wrong with the RFC. The issue got closed because there was no clear plan for its implementation.
If there's another RFC, I hope it won't suffer the same fate.
|
"I started working on it, then got reprimanded about daring to work on it so I stopped. And now it is postponed because nobody is working on it." – deleted comment
Why would it go differently if nobody knows what needs to be done differently, compared to this effort? |
@soc No clear plan [from the leadership].
Somebody working on the issue won't guarantee that it makes it into a release if nobody that makes the decisions is invested in it enough.
|
@aidanharris, regarding "#1615 (comment)", subscribers to the issue via GitHub are able to customize their subscription to the issue so that they are solely notified of when it is closed or reopened: |
Quick plug - I wrote an analysis on the subject of platform-compliance and why it's stalled: https://poignardazur.github.io/2023/05/23/platform-compliance-in-cargo/ |
Refs. - https://rust-lang.github.io/rustup/environment-variables.html - https://doc.rust-lang.org/cargo/reference/environment-variables.html See also: - https://wiki.archlinux.org/title/XDG_Base_Directory#Partial - rust-lang/rustup#247 - rust-lang/cargo#1734 - rust-lang/rfcs#1615 - rust-lang/cargo#5183 - rust-lang/cargo#148
(rendered)