]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.7] bpo-35755: shutil.which() uses os.confstr("CS_PATH") (GH-12862)
authorVictor Stinner <vstinner@redhat.com>
Wed, 17 Apr 2019 16:38:06 +0000 (18:38 +0200)
committerGitHub <noreply@github.com>
Wed, 17 Apr 2019 16:38:06 +0000 (18:38 +0200)
commit394b991e41a2a4ce3afc8e6fde44de46e73bbb34
treecd1920fd99e3841168634d7609e45d2933f604a4
parentb87a8073db73f9ffa96104e00c624052e34b11c7
[3.7] bpo-35755: shutil.which() uses os.confstr("CS_PATH") (GH-12862)

* bpo-35755: shutil.which() uses os.confstr("CS_PATH") (GH-12858)

shutil.which() and distutils.spawn.find_executable() now use
os.confstr("CS_PATH") if available instead of os.defpath, if the PATH
environment variable is not set.

Don't use os.confstr("CS_PATH") nor os.defpath if the PATH
environment variable is set to an empty string.

Changes:

* find_executable() now starts by checking for the executable in the
  current working directly case. Add an explicit
  "if not path: return None".
* Add tests for PATH='' (empty string), PATH=':' and for PATHEXT.

(cherry picked from commit 228a3c99bdb2d02771bead66a0beabafad3a90d3)

* bpo-35755: Remove current directory from posixpath.defpath (GH-11586)

Document the change in a NEWS entry of the Security category.

(cherry picked from commit 2c4c02f8a876fcf084575dcaf857a0236c81261a)
Lib/distutils/spawn.py
Lib/distutils/tests/test_spawn.py
Lib/posixpath.py
Lib/shutil.py
Lib/test/test_shutil.py
Misc/NEWS.d/next/Library/2019-04-16-17-50-39.bpo-35755.Fg4EXb.rst [new file with mode: 0644]
Misc/NEWS.d/next/Security/2019-01-17-10-03-48.bpo-35755.GmllIs.rst [new file with mode: 0644]