Repository navigation
Closed
Labels
Description
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
william-gr commentedon 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.
vstinner commentedon 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 commentedon Sep 7, 2018
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 commentedon Sep 7, 2018
%R sounds like a good idea, but I suggest to only use %R in the master branch.
william-gr commentedon 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 commentedon 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 commentedon 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 commentedon Sep 9, 2018
The bug has been fixed. For %R, does someone want to propose a change for master? William?
william-gr commentedon 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 commentedon Sep 10, 2018
Sure, reuse the same bpo number. You can modify the NEWS entry that you added ;-)
serhiy-storchaka commentedon Dec 5, 2018
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 commentedon Dec 5, 2018
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 commentedon Dec 5, 2018
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