Skip to content

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

Closed

Description

@william-gr
mannequin
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']

    Activity

    1. william-gr commented on Sep 7, 2018

      william-grmannequin
      MannequinAuthor

      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.

    2. added
      3.7 (EOL)
      3.8 (EOL)
      extension-modules
      on Sep 7, 2018
    3. vstinner commented on Sep 7, 2018

      @vstinner
      Member

      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

    4. serhiy-storchaka commented on Sep 7, 2018

      @serhiy-storchaka
      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.

    5. vstinner commented on Sep 7, 2018

      @vstinner
      Member

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

    6. william-gr commented on Sep 8, 2018

      william-grmannequin
      MannequinAuthor

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

    7. vstinner commented on Sep 9, 2018

      @vstinner
      Member

      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

    8. vstinner commented on Sep 9, 2018

      @vstinner
      Member

      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

    9. vstinner commented on Sep 9, 2018

      @vstinner
      Member

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

    10. william-gr commented on Sep 10, 2018

      william-grmannequin
      MannequinAuthor

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

    11. vstinner commented on Sep 10, 2018

      @vstinner
      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 ;-)

    12. serhiy-storchaka commented on Dec 5, 2018

      @serhiy-storchaka
      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

    13. serhiy-storchaka commented on Dec 5, 2018

      @serhiy-storchaka
      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

    14. serhiy-storchaka commented on Dec 5, 2018

      @serhiy-storchaka
      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

    15. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)3.8 (EOL)extension-modules

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions