Issue 34604: Possible mojibake in pwd.getpwnam and grp.getgrnam (original) (raw)

Created on 2018-09-07 13:14 by wg, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9098 merged wg,2018-09-07 13:34
PR 9104 merged wg,2018-09-07 17:45
PR 9105 merged wg,2018-09-07 17:46
PR 9165 merged wg,2018-09-11 14:50
PR 10947 merged serhiy.storchaka,2018-12-05 20:32
PR 10954 merged miss-islington,2018-12-05 21:23
Messages (13)
msg324738 - (view) Author: William Grzybowski (wg) * Date: 2018-09-07 13:14
Issue was spotted by @vstinner while reviewing https://github.com/python/cpython/pull/7081 pwd.getpwnam and grp.getgrnam are susceptible to mojibake as they are using encoded bytes instead of unicode in the error message.
msg324772 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-09-07 17:10
New changeset 28658485a54ad5f9df52ecc12d9046269f1654ec by Victor Stinner (William Grzybowski) in branch 'master': bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098) https://github.com/python/cpython/commit/28658485a54ad5f9df52ecc12d9046269f1654ec
msg324805 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-09-07 22:07
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.
msg324806 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-09-07 22:09
%R sounds like a good idea, but I suggest to only use %R in the master branch.
msg324831 - (view) Author: William Grzybowski (wg) * Date: 2018-09-08 11:37
What is the policy to amend a new commit to master for %R? Create a new PR? Wont that cause problem with NEWS entry?
msg324879 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-09-09 11:26
New changeset 1bcd891c200b8122493ddad5a203331e1a3bfcb5 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) https://github.com/python/cpython/commit/1bcd891c200b8122493ddad5a203331e1a3bfcb5
msg324880 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-09-09 11:27
New changeset 7a633ed79cfba2cfc0f80410ddcaeecadc2030e9 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) https://github.com/python/cpython/commit/7a633ed79cfba2cfc0f80410ddcaeecadc2030e9
msg324882 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-09-09 11:34
The bug has been fixed. For %R, does someone want to propose a change for master? William?
msg324924 - (view) Author: William Grzybowski (wg) * Date: 2018-09-10 13:37
I can do it if you feel the need. Can this same issue be used? Will the new PR require another NEWS entry?
msg324949 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-09-10 18:36
> 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 ;-)
msg331141 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-05 19:10
New changeset 34c7f0c04e2b4e715b2c3df1875af8939fbe7d0b by Serhiy Storchaka (William Grzybowski) in branch 'master': bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165) https://github.com/python/cpython/commit/34c7f0c04e2b4e715b2c3df1875af8939fbe7d0b
msg331170 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-05 21:23
New changeset ac8b47c8b4edd59aaee857717d434df52ec49e6c by Serhiy Storchaka in branch '3.7': bpo-34604: Use %R because of invisible characters or trailing whitespaces. (GH-9165). (GH-10947) https://github.com/python/cpython/commit/ac8b47c8b4edd59aaee857717d434df52ec49e6c
msg331181 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-05 22:04
New changeset 3a9b3346b03796d8573c063ab4c2407043609459 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) https://github.com/python/cpython/commit/3a9b3346b03796d8573c063ab4c2407043609459
History
Date User Action Args
2022-04-11 14:59:05 admin set github: 78785
2018-12-05 22:09:34 serhiy.storchaka set status: open -> closedstage: patch review -> resolvedresolution: fixedversions: - Python 2.7
2018-12-05 22:04:23 serhiy.storchaka set messages: +
2018-12-05 21:23:17 miss-islington set pull_requests: + <pull%5Frequest10203>
2018-12-05 21:23:08 serhiy.storchaka set messages: +
2018-12-05 20:32:55 serhiy.storchaka set pull_requests: + <pull%5Frequest10197>
2018-12-05 19:10:25 serhiy.storchaka set messages: +
2018-09-11 14:50:32 wg set pull_requests: + <pull%5Frequest8608>
2018-09-10 18:36:59 vstinner set messages: +
2018-09-10 13:37:26 wg set messages: +
2018-09-09 11:34:06 vstinner set messages: +
2018-09-09 11:27:35 vstinner set messages: +
2018-09-09 11:26:58 vstinner set messages: +
2018-09-08 11:37:13 wg set messages: +
2018-09-07 22:09:08 vstinner set messages: +
2018-09-07 22:07:18 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2018-09-07 17:46:08 wg set pull_requests: + <pull%5Frequest8559>
2018-09-07 17:45:26 wg set pull_requests: + <pull%5Frequest8558>
2018-09-07 17:10:43 vstinner set messages: +
2018-09-07 13:34:48 wg set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest8552>
2018-09-07 13:24:23 vstinner set nosy: + vstinnerversions: + Python 2.7, - Python 3.4, Python 3.5
2018-09-07 13:14:54 wg create