New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lack of pw_gecos field in Android's struct passwd causes cross-compilation for the pwd module to fail #64505
Comments
As the title states, mkpwent() in pwdmodule.c accesses Attached is a patch that works around the issue by setting the field to None on Android. |
Interesting. It seems pw_gecos isn't mandated by POSIX: I wonder if there's a better way to do this (autoconf check?) than an Android-specific #ifdef, though. |
Ah, yes, if it's not actually mandated by POSIX, something like HAVE_PASSWD_PW_GECOS would be more appropriate. I'll rework the patch into something more generic. |
Here is shiz's patch extended with the addition to configure.ac. I added the variable HAVE_PASSWD_GECOS_FIELD and the appropriate tests. Luckily this very problem (missing pw_gecos field) is the example used in the autoconf manual (https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Generic-Structures.html#Generic-Structures). (Otherwise I would have been as lost as I usually am with autoconf.) |
Apologies. That last patch includes diffs to generated files (configure and pyconfig.h.in). This version just patches Modules/pwdmodule.c and configure.ac. After applying the patch please run "autoheader" and "autoconf" to correctly regenerate configure and pyconfig.h.in. |
New changeset 0d74d4937ab9 by Stefan Krah in branch 'default': |
With changeset 0d74d4937ab9, test_pwd fails on android API level 21 at test_values with:
Traceback (most recent call last):
File "/sdcard/org.bitbucket.pyona/lib/python3.6/test/test_pwd.py", line 27, in test_values
self.assertIsInstance(e.pw_passwd, str)
AssertionError: None is not an instance of <class 'str'> On android API 21 HAVE_STRUCT_PASSWD_PW_PASSWD is defined but p->pw_passwd is set to NULL. |
New changeset f0f519aca558 by Stefan Krah in branch 'default': |
Okay, for the record: I think that returning "None" would probably be Realistically, probably no one cares about pw_passwd at all. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: