Skip to content
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

Ensurepip fails ungracefully when mimetype is missing from Windows registry #100256

Open
BlipRanger opened this issue Dec 14, 2022 · 2 comments
Open
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes easy extension-modules C modules in the Modules dir OS-windows topic-ensurepip triaged The issue has been accepted as valid by a triager. type-bug An unexpected behavior, bug, or error

Comments

@BlipRanger
Copy link

BlipRanger commented Dec 14, 2022

Bug report

A "WinError 5 Access is denied" error occurs when ensurepip (for python 3.10 and above) is run and there are missing/inaccessible mimetypes in the Windows registry. Because ensurepip is used in the Python installer, it also fails silently there, causing pip to never be installed without alerting the user to the issue. The line in which the error occurs is here:

_mimetypes_read_windows_registry(add_type)

Bypassing that line and instead using self._read_windows_registry(add_type) (which is the fallback function I believe) fixes the problem. I believe that _mimetypes_read_windows_registry(add_type) needs to be able to fail more gracefully when it can't find a particular mimetype in the registry.
I found someone else describing exactly the issue here.

Your environment

  • CPython versions tested on: 3.10, 3.11
  • Operating system and architecture: Windows 10 LTSC, x64

Linked PRs

@BlipRanger BlipRanger added the type-bug An unexpected behavior, bug, or error label Dec 14, 2022
@eryksun eryksun added OS-windows extension-modules C modules in the Modules dir 3.11 only security fixes 3.10 only security fixes 3.12 bugs and security fixes labels Dec 14, 2022
@huanghe2015
Copy link

Same thing happened with me ,Patrick and Stackoverflow.

@eryksun eryksun added 3.13 bugs and security fixes 3.14 new features, bugs and security fixes easy triaged The issue has been accepted as valid by a triager. and removed 3.11 only security fixes 3.10 only security fixes labels Jun 18, 2024
LucasEsposito added a commit to LucasEsposito/cpython that referenced this issue Jul 19, 2024
LucasEsposito added a commit to LucasEsposito/cpython that referenced this issue Jul 19, 2024
LucasEsposito added a commit to LucasEsposito/cpython that referenced this issue Jul 19, 2024
@LucasEsposito
Copy link
Contributor

Opened a PR to address this issue

LucasEsposito added a commit to LucasEsposito/cpython that referenced this issue Jul 21, 2024
LucasEsposito added a commit to LucasEsposito/cpython that referenced this issue Jul 21, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 7, 2024
…pe implementation (pythonGH-122047)

(cherry picked from commit 0bd9375)

Co-authored-by: Lucas Esposito <LucasEsposito@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 7, 2024
…pe implementation (pythonGH-122047)

(cherry picked from commit 0bd9375)

Co-authored-by: Lucas Esposito <LucasEsposito@users.noreply.github.com>
zooba pushed a commit that referenced this issue Aug 7, 2024
…lementation (GH-122047)

(cherry picked from commit 0bd9375)

Co-authored-by: Lucas Esposito <LucasEsposito@users.noreply.github.com>
blhsing pushed a commit to blhsing/cpython that referenced this issue Aug 22, 2024
Yhg1s pushed a commit that referenced this issue Sep 2, 2024
…ype implementation (GH-122047) (#122786)

gh-100256: Skip inaccessible registry keys in the WinAPI mimetype implementation (GH-122047)
(cherry picked from commit 0bd9375)

Co-authored-by: Lucas Esposito <LucasEsposito@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes easy extension-modules C modules in the Modules dir OS-windows topic-ensurepip triaged The issue has been accepted as valid by a triager. type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants