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 upFix windows home dir implementation #46799
Conversation
rust-highfive
assigned
dtolnay
Dec 18, 2017
dtolnay
added
the
T-libs
label
Dec 18, 2017
This comment has been minimized.
This comment has been minimized.
|
@rust-lang/libs Check out the linked issue, especially #28940 (comment) and #28940 (comment). I believe this is going to hinge on whether fixing the incorrect behavior of @rfcbot fcp merge |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Dec 18, 2017
•
|
Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged teams: Concerns:
Once these reviewers reach consensus, 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
the
proposed-final-comment-period
label
Dec 18, 2017
This comment has been minimized.
This comment has been minimized.
|
Could someone explain the interaction with cygwin in more detail here? My reading of this comment seems to suggest that this might change the behavior of command line tools that are built to run in either cygwin or cmd on Windows. For example, is it possible that such command line tools might accidentally do the right thing for cygwin users today? |
This comment has been minimized.
This comment has been minimized.
|
Cygwin emulates a linux distribution on windows: the cygwin target is therefore a linux target and code compiled for that target should not use this code-path (or any As with any change in behaviour, it's possible that this is accidentally working for someone right now, but on the other hand there are definitely applications currently using |
kennytm
added
the
S-waiting-on-team
label
Dec 18, 2017
This comment has been minimized.
This comment has been minimized.
|
I believe the main pushback on this issue was indeed the breaking changes that would come about with a change like this. For example Cargo and Rustup may be likely to break as tools which heavily use the home directory for caching and such. I'm not sure how many other tools rely on something like this. Cargo now depends on a crate called
I believe that rustup/Cargo are both intended to not use I'm not entirely sure how to guage the expected breakage across the rest of the ecosystem. It may be best to have a better story for this breakage, for example "use this crate for the old behavior" or something like that would be a great way to help mitigate the breakage. (aka the thing that cargo/rustup will transition to using). If we can get our ducks in a row via something like that I'd be ok landing this. |
This comment has been minimized.
This comment has been minimized.
|
@rfcbot concern cargo-rustup-breakage (see previous comment) |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton There's no way this change can break cargo or rustup, since as you pointed out, they don't call this function? The good thing is that with this change, the unsafe code in those tools could be removed: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I think this would be my concern then. Right now I distribute a single binary that is intended to work well in both cygwin and cmd. Perhaps this is "wrong," but having two different bins for cygwin and cmd would be quite user hostile IMO. Anyway, I don't want to debate that aspect too much, but would rather just say that this is a source of potential breakage. |
This comment has been minimized.
This comment has been minimized.
|
I'm not even sure there's a single correct home directory under MSYS. "Globally installed" programs like rustc/cargo from rustup that just happen to be called from MSYS shell (but can be run outside of it) should still use the "global" home directory, i.e. the Windows one. If something is supposed to be installed locally into the MSYS's little Unix filesystem emulation, then it should use The way of treating and prioritizing home directories seems to be largely application-dependent. |
This comment has been minimized.
This comment has been minimized.
|
Sorry for the long delay on this! The libs team discussed this API in our previous meeting. While it seems good to pursue this change, we are wary of changing the behavior of stable APIs, and instead would like to propose the following:
How does that sound? |
This comment has been minimized.
This comment has been minimized.
|
@aturon the |
This comment has been minimized.
This comment has been minimized.
|
Triage ping @rust-lang/libs, given the comment in #46799 (comment) I suppose the FCP should be canceled? @Diggsey as you mentioned first step is already done in the
|
This comment has been minimized.
This comment has been minimized.
|
I don't think there should be a function to get this directory on Windows. Typical applications should not be accessing it. Having it in the standard library makes it too convenient to do so. |
This comment has been minimized.
This comment has been minimized.
|
@rfcbot fcp cancel Echoing #46799 (comment) -- breaking a stable API this way is not going to work even if the current behavior is allegedly never what someone should want. Let's work on figuring out a better API in an external crate. The As a first step I would recommend cataloguing as many use cases as possible among the crates that currently call |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Jan 29, 2018
|
@dtolnay proposal cancelled. |
rfcbot
removed
the
proposed-final-comment-period
label
Jan 29, 2018
dtolnay
closed this
Jan 29, 2018
dtolnay
referenced this pull request
Jan 29, 2018
Closed
`env::home_dir()` should use `SHGetKnownFolderPath()` on windows. #28940
This comment has been minimized.
This comment has been minimized.
|
I know this is an ancient thread but @alexcrichton the functionality you are pointing to in |
This comment has been minimized.
This comment has been minimized.
|
The actual 'home' definitions are legit, whereas the definitions in directories are MPL2. |
Diggsey commentedDec 18, 2017
Fixes #28940
r? @dtolnay