Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upDeprecate `std::env::home_dir` and fix incorrect documentation #51656
Conversation
rust-highfive
assigned
shepmaster
Jun 20, 2018
This comment has been minimized.
This comment has been minimized.
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @shepmaster (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
rust-highfive
added
the
S-waiting-on-review
label
Jun 20, 2018
This comment has been minimized.
This comment has been minimized.
soc
force-pushed the
soc:topic/fix-home-dir
branch
from
5cc03a8
to
0093ea3
Jun 20, 2018
soc
changed the title
Fix unix implementation of std::env::home_dir() to follow documentation
Fix Unix implementation of std::env::home_dir() to follow documentation
Jun 20, 2018
This comment has been minimized.
This comment has been minimized.
|
The code seems reasonable to me, but I'm unclear on if such a change is acceptable. randomly reassigning to... r? @KodrAus |
rust-highfive
assigned
KodrAus
and unassigned
shepmaster
Jun 20, 2018
frewsxcv
added
the
T-libs
label
Jun 20, 2018
This comment has been minimized.
This comment has been minimized.
KodrAus
commented
Jun 21, 2018
|
So it looks like the docs were correct once upon a time, but since we stabilized with the current behaviour I think I'd be more comfortable updating the docs to reflect that, unless we do have the described behaviour on Windows. |
This comment has been minimized.
This comment has been minimized.
|
@KodrAus Windows is comparably broken (just in different ways) – see https://internals.rust-lang.org/t/deprecate-or-break-fix-std-env-home-dir/7315. Preferably, I'd fix all the issues, but fixing the bugs on Windows has already been rejected. May it be possible to reevaluate the earlier decision given the new circumstances? |
This comment has been minimized.
This comment has been minimized.
|
The reason I'm trying to figure out what's the position here is because I want to work on rust-lang/cargo#5183, which is blocked by the 1.0 release of the From a user/third-party library author perspective I pretty much have three options:
I'd really prefer it if we could make 3. work, although I'm slowly approaching the pain threshold of further delaying 1.0 releases for the crates and the things they keep blocking down the line. So I'd appreciate some communication about whether hoping for fixes is realistic. |
This comment has been minimized.
This comment has been minimized.
|
Nominating for @rust-lang/libs discussion, as they'd have to sign off on major changes here. |
steveklabnik
added
the
I-nominated
label
Jun 21, 2018
This comment has been minimized.
This comment has been minimized.
|
Do we know of a situation other than a test case where the environment variable might exist and be empty? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@soc (Assuming this is in response to me.) This post mentions not having a home directory. Is |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin It depends. It seems like creating a user and using the flags to not create a home directory usually causes some non-existing dir to end up in
|
soc
referenced this pull request
Jun 23, 2018
Open
Support platform-defined standard directories #5183
TimNN
added
S-waiting-on-team
and removed
S-waiting-on-review
labels
Jun 26, 2018
This comment has been minimized.
This comment has been minimized.
|
The libs team discussed this today and consensus was that, since this function is already not doing what people want on Windows, we’d rather deprecate it in favor of something on crates.io and not change its behavior. @rfcbot fcp close |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Jun 27, 2018
•
|
Team member @SimonSapin has proposed to close this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), 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. |
rfcbot
added
proposed-final-comment-period
disposition-close
labels
Jun 27, 2018
SimonSapin
removed
I-nominated
S-waiting-on-team
labels
Jun 27, 2018
shepmaster
added
the
S-waiting-on-team
label
Jun 29, 2018
This comment has been minimized.
This comment has been minimized.
|
I released 1.0 versions of dirs and directories with correct implementations of Shall I change this PR to deprecate |
stokhos
removed
the
S-waiting-on-team
label
Jul 6, 2018
soc
force-pushed the
soc:topic/fix-home-dir
branch
from
87ccd06
to
0afc16a
Jul 6, 2018
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin Done! |
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
bors
added
S-waiting-on-bors
and removed
S-waiting-on-author
labels
Jul 6, 2018
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Jul 7, 2018
This comment has been minimized.
This comment has been minimized.
|
|
bors
merged commit 0afc16a
into
rust-lang:master
Jul 7, 2018
rfcbot
removed
proposed-final-comment-period
disposition-close
labels
Jul 7, 2018
niklasad1
added a commit
to paritytech/parity-ethereum
that referenced
this pull request
Jul 9, 2018
niklasad1
referenced this pull request
Jul 9, 2018
Merged
Replace `std::env::home_dir` with `dirs::home_dir` #9077
5chdn
added a commit
to paritytech/parity-ethereum
that referenced
this pull request
Jul 9, 2018
dvdplm
added a commit
to paritytech/parity-common
that referenced
this pull request
Jul 9, 2018
dvdplm
referenced this pull request
Jul 9, 2018
Merged
Replace `std::env::home_dir` with `dirs::home_dir` (#9077) #3
hoodie
added a commit
to ascii-dresden/asciii
that referenced
this pull request
Jul 11, 2018
This comment has been minimized.
This comment has been minimized.
tjkirch
commented
Jul 30, 2018
|
I don't understand this decision. Removing the API seems like a bigger breakage than fixing the behavior, particularly when it works in normal cases. |
This comment has been minimized.
This comment has been minimized.
|
Deprecation is not removal. |
This comment has been minimized.
This comment has been minimized.
tjkirch
commented
Jul 30, 2018
|
Deprecation usually implies future removal. And now anyone using this API gets yelled at by the compiler, and so can't maintain a clean build without bringing in a dependency. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@tjkirch Yeah, I'm not too happy with the decision. I'm now basically on the hook for supporting every platform ever invented under the sun, which I'm practically unable to test. |
soc commentedJun 20, 2018
•
edited
Compare
std::env::home_dirs claim:... with its actual behavior:
The implementation is incorrect in two cases:
$HOMEis set, but empty./etc/passwd, but it'spw_diris empty.In both cases Rust considers an empty string to be a valid home directory. This contradicts the documentation, and is wrong in general.