This is an archive of the discontinued Mercurial Phabricator instance.

py3: pass str into grp.getgrnam
ClosedPublic

Authored by pulkit on Feb 1 2019, 6:31 PM.

Details

Summary

grp.getgrnam expects str on Python 3.

This fixes test-acl.t on Python 3.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.Feb 1 2019, 6:31 PM
This revision was automatically updated to reflect the committed changes.
yuja added a subscriber: yuja.Feb 1 2019, 8:50 PM

+ name = pycompat.sysstr(name)

return list(grp.getgrnam(name).gr_mem)

Perhaps, it should be fsdecode() since they appear to abuse
PyUnicode_EncodeFSDefault() to get back bytes.

And we'll probably need to fsencode() gr_mem back to bytes as well.

In D5794#85031, @yuja wrote:

Perhaps, it should be fsdecode() since they appear to abuse
PyUnicode_EncodeFSDefault() to get back bytes.
And we'll probably need to fsencode() gr_mem back to bytes as well.

Ugh, Python. And the raw system call accepts a char *. So this whole "pretend to be Unicode" is just plain silly.