-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Please reconsider endorsing dirs
and deprecating std::env::home_dir
#71684
Comments
I do not see how the link here confirms that statement, it just shows the GH project index page? |
The archive doesn't show it, but the |
I see. But that doesn't say anything about "providing the level and variety of support expected by users of the Rust std library". |
@RalfJung I'm curious how marking the source repository read only could signal something other than "I'm not interested in maintaining this project anymore." |
That was not your claim. You made a very specific claim for the motivation for them not wanting to maintain the project any more. I was asking why you think that "not interested providing the level and variety of support expected by users of the Rust std library" was the motivation. You proved that they don't want to support this any more. You didn't prove your claim which said specifically why they don't want to support this any more. |
To be clear, I am entirely on board with the goals of this issue -- to stop recommending an unmaintained crate. I am just disputing a particular statement on the original post, which I believed and still believe to be unfounded. |
"maintained", to me, is a subset of "the level and variety of support expected by users of the Rust EDIT: I never meant to imply they said as much, my initial comments are my own evaluation. |
Most libraries are not maintained to the same standards as libstd. So I don't think "I don't want to maintain crate X any more" implies "I don't want to maintain crate X to the same standards as std". But also, this is getting increasingly off-topic, so I will stop here. |
Would opening a PR to remove the recommendation be appropriate at this time? |
I'll defer that question to @rust-lang/libs -- |
I think we should, at minimum, remove the recommendation for It would be nice to un-deprecate and fix this, but this was certainly something that was considered. See:
Personally, I'd like to see a working |
I've opened #71784 to remove the recommendation for now. I don't intend to halt the discussion as to whether rust-lang should recommend a crate here, or if a function should be pulled into std from crates.io, but we can act on the decision we did make, which is to not recommend this crate. |
It's pretty clear the behaviour of this deprecated function is toeing the line between bug and feature. Were it a bug, the answer would be simple, fix the problem. No deprecation necessary. If alternatively it's a misguided feature, then deprecation seems like a reasonable approach. Frequently during the discussions you linked I see concerns being raised that this is, perhaps to some, a feature, or at the very least that changing it may cause excessive breaking changes. I suppose I understand the caution, as gathering data on the usage of this API is nearly impossible, since most of its users are going to be bin users. One approach to gathering the data necessary to answer that question might be building telemetry into rustc itself. As far as I know there's no such precedence for such telemetry in rustc though. That would probably be a risky and controversial move in and of itself. So a simpler approach honestly might be a poll/survey. Ask the community. Imprecise, but any data is better than no data? It's certainly an interesting problem. I can't help wondering how many users of Rust programs would actually experience an observable change in program behavior from this. How many of those would consider such a change fatal to their workflow? Additionally, one might consider such breakage fine, because if the behaviour of the code using this is really that important, then the software shop probably has rigorous QA processes that would catch this kind of impact. In the absence of a good dataset to draw from I suppose the most cautious approach is the only good one, and the most cautious approach is leaving the behaviour unchanged and deprecating the API. |
Hey, a concern raised in deprecating std
|
As a windows user, it bothers me a lot when applications check for standard configuration/environment features in nonstandard ways. The worst one I run into is applications looking for UI language grabbing it from the system locale instead of from the, uh, system UI language. Using environment variables to find the "home" folder on windows is essentially the same; someone might want to check environment variables to find the home folder on windows, but doing so is essentially wrong in 99%+ of cases, just like interpreting the system locale as UI language. Of course, checking the USERPROFILE environment variable is forgivable since it's hardly ever going to be wrong, but HOME just isn't set by default on Windows in the first place (at least not the version I run), so checking it is just begging to have things magically misbehave in strange environments. Problems like this just kind of tend to happen when porting unix applications to win32 or vice versa, but, you know, windows doesn't give you all the necessary tools to work around badly-behaving applications that unix systems generally do. Of course, I'm not trying to resurrect old issues, but I wanted to throw in an argument in favor of the current std::env::home_dir staying deprecated, since someone threw in an argument that it may be considered a featurebug. |
Remove recommendation for unmaintained dirs crate See rust-lang#71684 for reasoning here
Remove recommendation for unmaintained dirs crate See rust-lang#71684 for reasoning here
@BurntSushi, it seems as if |
@cedricgrothues Hmm, doesn't look like it uses |
I would be ok with |
@Timmmm I'd prefer something like |
@Boscop Editions can't remove APIs from std. |
I think that would just lead to more confusion (given that |
That confusion is something documentation can solve. There is precedent for picking a new but sensible name: |
Would be nice to get this sorted
|
It's really funny to retire a std function and let user choose a third-party lib. |
I don't think it's always inappropriate to do that, but in this case I think it's definitely functionality that should be in std. And if it isn't, there should at least be a specific crate blessed as the official solution, and it should be named in the deprecation notice, and it should be a crate that is >=1.0, and does not call the deprecated function itself. |
This improves the documentation to say *why* it was deprecated. The reason was because it reads `HOME` on Windows which is meaningless there. Note that the PR that deprecated it stated that returning an empty string if `HOME` is set to an empty string was a problem, however I can find no evidence that this is the case. `cd` handles it fine whereas if `HOME` is unset it gives an explicit `HOME not set` error. * Original deprecation reason: https://internals.rust-lang.org/t/deprecate-or-break-fix-std-env-home-dir/7315 * Original deprecation PR: rust-lang#51656 See rust-lang#71684
☝️ I added a PR to at least document why it is deprecated so users can make up their own minds. I definitely care less about Cygwin and Mingw results being possibly unexpected than having to add a whole third party crate just for this. |
Better documentation for env::home_dir()'s broken behaviour This improves the documentation to say *why* it was deprecated. The reason was because it reads `HOME` on Windows which is meaningless there. Note that the PR that deprecated it stated that returning an empty string if `HOME` is set to an empty string was a problem, however I can find no evidence that this is the case. `cd` handles it fine whereas if `HOME` is unset it gives an explicit `HOME not set` error. * Original deprecation reason: https://internals.rust-lang.org/t/deprecate-or-break-fix-std-env-home-dir/7315 * Original deprecation PR: rust-lang#51656 See rust-lang#71684
Better documentation for env::home_dir()'s broken behaviour This improves the documentation to say *why* it was deprecated. The reason was because it reads `HOME` on Windows which is meaningless there. Note that the PR that deprecated it stated that returning an empty string if `HOME` is set to an empty string was a problem, however I can find no evidence that this is the case. `cd` handles it fine whereas if `HOME` is unset it gives an explicit `HOME not set` error. * Original deprecation reason: https://internals.rust-lang.org/t/deprecate-or-break-fix-std-env-home-dir/7315 * Original deprecation PR: rust-lang#51656 See rust-lang#71684
Now that the |
I'd rather have a new function in std that does what the home crate does. Also, the home crate calls the std home_dir function on Unix. |
Me too, but there is obviously some contention regarding that (especially around naming), so I would at least point people to a small & suitable crate in the meanwhile. |
@utkarshgupta137 but what does it accomplish? If you are fine with the incorrectness in |
The home crate fixes the incorrectness. |
The 2 lines above it: According to the documentation, the problem is that the |
The problems on Windows where far from the only reasons why the function was deprecated.
I guess another case of "incomplete documentation is worse than no documentation". 🤷 |
I must've missed some previous discussion, can you elaborate? Since cargo & rustup teams now maintain the home crate, I'm sure they would want to fix it. |
soc deprecated |
I wrote that updated documentation and I may have got it wrong, but I did look back through the discussion that was had when it was deprecated and I don't recall seeing any other reason. Can you perhaps post a link? I think recommending the |
Yikes, the empty Edit: Done: rust-lang/cargo#12023 Edit 2: @ehuss pointed out that most other languages don't handle this, so I don't see why Rust (or one of the crates) should go out of the way to do so. Additionally, defining |
Regarding the name for a new function, I wonder if a better way to handle it would be to move it to a different module. Perhaps |
Current state of this, the function is deprecated with:
which solves this issue and part of why it was posted |
For more context, a replacement is being proposed in rust-lang/libs-team#372. |
(Link for convenience: https://doc.rust-lang.org/std/env/fn.home_dir.html)
Recommending a user library in favor of the standard library is not an action without precedent.
However in this instance I think it's unwise. The author of
dirs
has made it clear they are not interested in providing the level and variety of support expected by users of the Ruststd
library.What I, and I suspect most of the Rust community, would prefer is fixing the behavior of
std::env::home_dir
, and bringing it back from deprecation. Choosing to deprecate it and recommend another crate implies that someone could be relying on the current incorrect behavior ofstd::env::home_dir
. Do we have any reason to believe someone is relying on that behavior? Is there room for disagreement as to what correct behavior is? My own review of the discussion surrounding this didn't seem to ask those questions and just deprecated it seemingly without questioning that.If nothing else, at this point it seems wise to remove the recommendation of theEDIT: Removing the recommendation has been done.dirs
crate, even if rust-lang wants to leave the deprecation intact.The text was updated successfully, but these errors were encountered: