[issue36264] os.path.expanduser should not use HOME on windows

2020-05-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: > I thought it might be useful for testing purposes if os.path (i.e. ntpath and > posixpath) had a way to set the home directory that it uses in way that > wouldn't affect other libraries and child processes. I was thinking about this, and I'd argue that

[issue36264] os.path.expanduser should not use HOME on windows

2020-05-16 Thread Eryk Sun
Eryk Sun added the comment: > I’m not suggesting that from within Python there should be another way > to detect a home directory. The expanduser functionality as written is > just fine for that, though I agree with Steve that using an API on > Windows would be even better. I thought it

[issue36264] os.path.expanduser should not use HOME on windows

2020-05-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: > Platform differences can be papered over with functions. I’m not suggesting that from within Python there should be another way to detect a home directory. The expanduser functionality as written is just fine for that, though I agree with Steve that using

[issue36264] os.path.expanduser should not use HOME on windows

2020-05-16 Thread Paul Moore
Paul Moore added the comment: > Perhaps the best approach for the sake of POSIX compatibility is to set HOME > on startup to the correct value? If Python starts setting `HOME`, that has the potential to affect programs called in a subprocess, possibly breaking them (making them not find

[issue36264] os.path.expanduser should not use HOME on windows

2020-05-16 Thread Steve Dower
Steve Dower added the comment: Really, we shouldn't be using any environment variables on Windows here, because they open up too many security risks. There are API calls that are canonical, but the environment vars are compatibility helpers. Breakage due to HOME being overridden is serious

[issue36264] os.path.expanduser should not use HOME on windows

2020-05-15 Thread Eryk Sun
Eryk Sun added the comment: > set "HOME" to override a location derived from ~ Using HOME in Windows is not reliable because it is not a system environment variable. That makes it fair game for administrators, users, and applications to use however they like. Platform differences can be

[issue36264] os.path.expanduser should not use HOME on windows

2020-05-15 Thread Christoph Reiter
Christoph Reiter added the comment: Config on Windows should go into APPDATA not USERPROFILE/HOME, on macOS it should go to "$HOME/Library/Application Support" and on Linux $XDG_CONFIG_HOME or $HOME/.config. So using using HOME on all platforms for config is not what those platforms

[issue36264] os.path.expanduser should not use HOME on windows

2020-05-15 Thread Jason R. Coombs
Jason R. Coombs added the comment: I addressed the [setuptools test suite issue](https://github.com/pypa/setuptools/issues/2112) with [this commit](https://github.com/pypa/setuptools/commit/f866311d60f54499c3637309e3429780d8c8f218). What was a one-line elegant solution is now multiple lines

[issue36264] os.path.expanduser should not use HOME on windows

2020-05-15 Thread Jason R. Coombs
Jason R. Coombs added the comment: I should also point out that this was a documented feature of Python that was removed without any deprecation period. -- ___ Python tracker

[issue36264] os.path.expanduser should not use HOME on windows

2020-05-15 Thread Jason R. Coombs
Jason R. Coombs added the comment: Today I ran into an issue due to this change. I have a test that sets `os.environ['HOME']` in order to ensure that `os.path.expanduser(~)` returns that value

[issue36264] os.path.expanduser should not use HOME on windows

2020-01-28 Thread miss-islington
miss-islington added the comment: New changeset 595b516965ee88b817dc1b3d7713e1f3f263634d by Miss Islington (bot) in branch '3.8': bpo-38883: Don't use POSIX `$HOME` in `pathlib.Path.home/expanduser` on Windows (GH-17961)

[issue36264] os.path.expanduser should not use HOME on windows

2020-01-28 Thread Steve Dower
Steve Dower added the comment: New changeset c45a2aa9e255b5c7c211faa79f6b23895b64ab27 by Steve Dower (Christoph Reiter) in branch 'master': bpo-38883: Don't use POSIX `$HOME` in `pathlib.Path.home/expanduser` on Windows (GH-17961)

[issue36264] os.path.expanduser should not use HOME on windows

2020-01-28 Thread miss-islington
Change by miss-islington : -- pull_requests: +17609 pull_request: https://github.com/python/cpython/pull/18229 ___ Python tracker ___

[issue36264] os.path.expanduser should not use HOME on windows

2020-01-12 Thread Christoph Reiter
Change by Christoph Reiter : -- pull_requests: +17370 pull_request: https://github.com/python/cpython/pull/17961 ___ Python tracker ___

[issue36264] os.path.expanduser should not use HOME on windows

2019-11-21 Thread Christoph Reiter
Christoph Reiter added the comment: I've filed issue38883 -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36264] os.path.expanduser should not use HOME on windows

2019-11-21 Thread Christoph Reiter
Christoph Reiter added the comment: > Was pathlib forgotten here? Pathlib.home() is documented to return > the same as expanduser("~") but it still prefers HOME instead of > USERPROFILE. > > Yes, it was forgotten (why doesn't it just use expanduser?). We > should file a new bug for that.

[issue36264] os.path.expanduser should not use HOME on windows

2019-11-21 Thread Steve Dower
Steve Dower added the comment: > Was pathlib forgotten here? Pathlib.home() is documented to return the same > as expanduser("~") but it still prefers HOME instead of USERPROFILE. Yes, it was forgotten (why doesn't it just use expanduser?). We should file a new bug for that. > Note that

[issue36264] os.path.expanduser should not use HOME on windows

2019-11-21 Thread Christoph Reiter
Christoph Reiter added the comment: Was pathlib forgotten here? Pathlib.home() is documented to return the same as expanduser("~") but it still prefers HOME instead of USERPROFILE. Note that this change has some effect on cygwin/mingw environments which all set HOME and now potentially lead

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-17 Thread daniel hahler
daniel hahler added the comment: Just as a sidenote: the other day I was checking Python's source to see how to override a user's home (in tests, when os.path.expanduser` is used in code), and found it easy to just set $HOME in the environment in the end. I guess this change will cause

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Steve Dower
Change by Steve Dower : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Steve Dower
Steve Dower added the comment: New changeset 8ef864d50fb847cf15d5717c0db04fd60fb13d8d by Steve Dower in branch 'master': bpo-36264: Updates documentation for change to expanduser on Windows (GH-12294) https://github.com/python/cpython/commit/8ef864d50fb847cf15d5717c0db04fd60fb13d8d

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Steve Dower
Steve Dower added the comment: > Guido intentionally added support for HOME in ntpath.expanduser way back in > Python 1.5 (circa 1997), and now we're removing it over 20 years later. Wouldn't be the first thing to be removed :) -- ___ Python

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Eryk Sun
Eryk Sun added the comment: > `os.path.expanduser` in `ntpath` uses `HOME` in preference to > `USERPROFILE` / `HOMEDRIVE\\HOMEPATH` Guido intentionally added support for HOME in ntpath.expanduser way back in Python 1.5 (circa 1997), and now we're removing it over 20 years later. I expect

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Steve Dower
Change by Steve Dower : -- pull_requests: +12273 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Steve Dower
Steve Dower added the comment: > If we're going ahead with this, it's worth a mention in whatsnew Good call. I'll do it -- ___ Python tracker ___

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Zachary Ware
Zachary Ware added the comment: If we're going ahead with this, it's worth a mention in whatsnew as this is going to break things for some users. -- ___ Python tracker ___

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Steve Dower
Steve Dower added the comment: New changeset 25ec4a45dcc36c8087f93bd1634b311613244fc6 by Steve Dower (Anthony Sottile) in branch 'master': bpo-36264: Don't honor POSIX HOME in os.path.expanduser on Windows (GH-12282)

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Steve Dower
Steve Dower added the comment: Great, thanks for checking! I'll merge. -- assignee: -> steve.dower ___ Python tracker ___ ___

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Anthony Sottile
Anthony Sottile added the comment: > Modifying this value could have a real impact on the rest of the process, so > we should be very careful to undo it regardless of test result. (Modifying > HOME is not a as big a deal since, as you point out, it's not "real" ;) ) Agreed, though I'd like

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Steve Dower
Steve Dower added the comment: I like the patch, but I'm not sure all the tests are properly preserving the real value of USERPROFILE. Modifying this value could have a real impact on the rest of the process, so we should be very careful to undo it regardless of test result. (Modifying HOME

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-11 Thread Anthony Sottile
Change by Anthony Sottile : -- keywords: +patch pull_requests: +12262 stage: -> patch review ___ Python tracker ___ ___

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-11 Thread Anthony Sottile
New submission from Anthony Sottile : The current code for `os.path.expanduser` in `ntpath` uses `HOME` in preference to `USERPROFILE` / `HOMEDRIVE\\HOMEPATH` I can't find any documentation of `HOME` being relevant on windows (only on posix). For example, wikipedia only mentions