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

mimetypes read_windows_registry should tolerate permissions errors #54371

Closed
bobince mannequin opened this issue Oct 21, 2010 · 4 comments
Closed

mimetypes read_windows_registry should tolerate permissions errors #54371

bobince mannequin opened this issue Oct 21, 2010 · 4 comments
Assignees
Labels
OS-windows stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@bobince
Copy link
Mannequin

bobince mannequin commented Oct 21, 2010

BPO 10162
Nosy @tjguk, @bobince, @briancurtin
Files
  • mimetypes-patch-3.2a3.patch: Ignore permissions errors, patch for mimetypes in py3k branch
  • mimetypes-patch-2.7.patch: Ignore permissions errors, patch for mimetypes in release27-maint branch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/briancurtin'
    closed_at = <Date 2010-10-21.14:50:06.832>
    created_at = <Date 2010-10-21.00:44:35.805>
    labels = ['type-bug', 'library', 'OS-windows']
    title = 'mimetypes read_windows_registry should tolerate permissions errors'
    updated_at = <Date 2010-10-21.14:50:06.831>
    user = 'https://github.com/bobince'

    bugs.python.org fields:

    activity = <Date 2010-10-21.14:50:06.831>
    actor = 'brian.curtin'
    assignee = 'brian.curtin'
    closed = True
    closed_date = <Date 2010-10-21.14:50:06.832>
    closer = 'brian.curtin'
    components = ['Library (Lib)', 'Windows']
    creation = <Date 2010-10-21.00:44:35.805>
    creator = 'aclover'
    dependencies = []
    files = ['19314', '19315']
    hgrepos = []
    issue_num = 10162
    keywords = ['patch']
    message_count = 4.0
    messages = ['119252', '119253', '119267', '119306']
    nosy_count = 3.0
    nosy_names = ['tim.golden', 'aclover', 'brian.curtin']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue10162'
    versions = ['Python 2.7', 'Python 3.2']

    @bobince
    Copy link
    Mannequin Author

    bobince mannequin commented Oct 21, 2010

    It is relatively common to have keys in the HKEY_CLASSES_ROOT MIME database that are not readable to all users, typically written by third-party applications. (My WinXP test box has a dozen, for apps like Flash, Silverlight and Java.)

    Currently, initialising mimetypes causes Python to try to read them all, and if the user running Python doesn't have permission to read a key (in particular, if the user is a low-privilege daemon user such as IUSR_...), the script that caused mimetypes to be called will error out.

    This patch moves the try-block around the call to OpenKey as well as QueryValueEx, allowing the key to be skipped if unreadable.

    @bobince bobince mannequin added type-feature A feature request or enhancement stdlib Python modules in the Lib dir labels Oct 21, 2010
    @bobince
    Copy link
    Mannequin Author

    bobince mannequin commented Oct 21, 2010

    (same against 2.7 branch)

    @tjguk
    Copy link
    Member

    tjguk commented Oct 21, 2010

    I've only read the patch and not applied it, yet. But in principle I'm
    +1 on this. If Brian doesn't get there first, I'll try to apply later.

    @briancurtin
    Copy link
    Member

    Fixed in py3k (r85774, minor correction in r85775), and release27-maint (r85776).

    Thanks for the patches!

    @briancurtin briancurtin self-assigned this Oct 21, 2010
    @briancurtin briancurtin added type-bug An unexpected behavior, bug, or error and removed type-feature A feature request or enhancement labels Oct 21, 2010
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants