Author xdegaye
Recipients serhiy.storchaka, vstinner, xdegaye
Date 2017-11-15.10:34:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
On Android API 24:

$ python -c "import pwd; print(pwd.getpwuid(0))"
pwd.struct_passwd(pw_name='root', pw_passwd='', pw_uid=0, pw_gid=0, pw_gecos=None, pw_dir='/', pw_shell='/system/bin/sh')

The pw_gecos member is None and the test_values test of pwd fails because it expects a string. The fix is either (1) to skip the pw_gecos check in test_values for Android or (2) to modify the sets() function in Modules/pwdmodule.c to set an empty string instead of None when the member of the passwd structure is a NULL pointer.

POSIX [1] does not specify what are the possible values of the members of the struct passwd. GNU libc states that pw_dir and pw_shell may be NULL pointers so it seems that sets() is broken in these two cases.

Date User Action Args
2017-11-15 10:34:19xdegayesetrecipients: + xdegaye, vstinner, serhiy.storchaka
2017-11-15 10:34:19xdegayesetmessageid: <>
2017-11-15 10:34:19xdegayelinkissue32033 messages
2017-11-15 10:34:19xdegayecreate