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

Possible mojibake in pwd.getpwnam and grp.getgrnam #78785

Closed
william-gr mannequin opened this issue Sep 7, 2018 · 13 comments
Closed

Possible mojibake in pwd.getpwnam and grp.getgrnam #78785

william-gr mannequin opened this issue Sep 7, 2018 · 13 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes extension-modules C modules in the Modules dir

Comments

@william-gr
Copy link
Mannequin

william-gr mannequin commented Sep 7, 2018

BPO 34604
Nosy @vstinner, @serhiy-storchaka, @william-gr
PRs
  • bpo-34604: Fix possible mojibake in pwd.getpwnam and grp.getgrnam #9098
  • [3.7] bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098) #9104
  • [3.6] bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098) #9105
  • bpo-34604: Use %R because of invisible characters or trailing whitespaces #9165
  • [3.7] bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165). #10947
  • [3.6] bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165). (GH-10947) #10954
  • 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 = None
    closed_at = <Date 2018-12-05.22:09:34.390>
    created_at = <Date 2018-09-07.13:14:54.950>
    labels = ['extension-modules', '3.7', '3.8']
    title = 'Possible mojibake in pwd.getpwnam and grp.getgrnam'
    updated_at = <Date 2018-12-05.22:09:34.388>
    user = 'https://github.com/william-gr'

    bugs.python.org fields:

    activity = <Date 2018-12-05.22:09:34.388>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-12-05.22:09:34.390>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2018-09-07.13:14:54.950>
    creator = 'wg'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34604
    keywords = ['patch']
    message_count = 13.0
    messages = ['324738', '324772', '324805', '324806', '324831', '324879', '324880', '324882', '324924', '324949', '331141', '331170', '331181']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'serhiy.storchaka', 'wg']
    pr_nums = ['9098', '9104', '9105', '9165', '10947', '10954']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue34604'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @william-gr
    Copy link
    Mannequin Author

    william-gr mannequin commented Sep 7, 2018

    Issue was spotted by @vstinner while reviewing #7081

    pwd.getpwnam and grp.getgrnam are susceptible to mojibake as they are using encoded bytes instead of unicode in the error message.

    @william-gr william-gr mannequin added 3.7 (EOL) end of life 3.8 only security fixes extension-modules C modules in the Modules dir labels Sep 7, 2018
    @vstinner
    Copy link
    Member

    vstinner commented Sep 7, 2018

    New changeset 2865848 by Victor Stinner (William Grzybowski) in branch 'master':
    bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098)
    2865848

    @serhiy-storchaka
    Copy link
    Member

    Wouldn't be better to use %R? The name can contain invisible characters or trailing whitespaces, in which case the traceback can look confusing. Since names are likely created with PyUnicode_DecodeFSDefault(), they can contain undecodable bytes represented as surrogates U+D8XX if the current filesystem encoding doesn't match the filesystem encoding used for creating entries.

    @vstinner
    Copy link
    Member

    vstinner commented Sep 7, 2018

    %R sounds like a good idea, but I suggest to only use %R in the master branch.

    @william-gr
    Copy link
    Mannequin Author

    william-gr mannequin commented Sep 8, 2018

    What is the policy to amend a new commit to master for %R? Create a new PR? Wont that cause problem with NEWS entry?

    @vstinner
    Copy link
    Member

    vstinner commented Sep 9, 2018

    New changeset 1bcd891 by Victor Stinner (William Grzybowski) in branch '3.6':
    [3.6] bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098) (GH-9105)
    1bcd891

    @vstinner
    Copy link
    Member

    vstinner commented Sep 9, 2018

    New changeset 7a633ed by Victor Stinner (William Grzybowski) in branch '3.7':
    [3.7] bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098) (GH-9104)
    7a633ed

    @vstinner
    Copy link
    Member

    vstinner commented Sep 9, 2018

    The bug has been fixed. For %R, does someone want to propose a change for master? William?

    @william-gr
    Copy link
    Mannequin Author

    william-gr mannequin commented Sep 10, 2018

    I can do it if you feel the need.
    Can this same issue be used? Will the new PR require another NEWS entry?

    @vstinner
    Copy link
    Member

    I can do it if you feel the need. Can this same issue be used? Will the new PR require another NEWS entry?

    Sure, reuse the same bpo number. You can modify the NEWS entry that you added ;-)

    @serhiy-storchaka
    Copy link
    Member

    New changeset 34c7f0c by Serhiy Storchaka (William Grzybowski) in branch 'master':
    bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165)
    34c7f0c

    @serhiy-storchaka
    Copy link
    Member

    New changeset ac8b47c by Serhiy Storchaka in branch '3.7':
    bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165). (GH-10947)
    ac8b47c

    @serhiy-storchaka
    Copy link
    Member

    New changeset 3a9b334 by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6':
    bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165). (GH-10947) (GH-10954)
    3a9b334

    @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
    3.7 (EOL) end of life 3.8 only security fixes extension-modules C modules in the Modules dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants