This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2009年11月20日 01:24 by eplese, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| pwd-grp-unsigned-uid.patch | eplese, 2009年11月20日 01:24 | |||
| issue7365_refresh_default.patch | sandro.tosi, 2011年03月29日 20:08 | review | ||
| Messages (3) | |||
|---|---|---|---|
| msg95520 - (view) | Author: Ed Plese (eplese) | Date: 2009年11月20日 01:24 | |
Both Linux and Solaris define uid_t and gid_t as unsigned integers. The pwd and grp modules cast these to signed long values that are then converted with PyInt_FromLong. For large values, greater than 2 ** 32 - 1, the result is correct when Python is compiled as a 64-bit executable, but is incorrect when compiled as a 32-bit executable. Similar bugs have been noted in the posix module as reported in #4591. For example, on OpenSolaris build 127, the 32-bit version of Python returns a negative uid: pw_uid=-2147483647: $ file /usr/bin/python2.6 /usr/bin/python2.6: ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, not stripped, no debugging information available $ /usr/bin/python2.6 Python 2.6.2 (r262, Oct 26 2009, 01:06:14) [C] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import pwd >>> pwd.getpwnam('test@foo.com') pwd.struct_passwd(pw_name='test@foo.com', pw_passwd='x', pw_uid=-2147483647, pw_gid=10000, pw_gecos='Test User', pw_dir='', pw_shell='') $ file /usr/bin/amd64/python2.6 /usr/bin/amd64/python2.6: ELF 64-bit LSB executable AMD64 Version 1 [SSE FXSR FPU], dynamically linked, not stripped, no debugging information available $ /usr/bin/amd64/python2.6 Python 2.6.2 (r262, Oct 26 2009, 01:09:04) [C] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import pwd >>> pwd.getpwnam('test@foo.com') pwd.struct_passwd(pw_name='test@foo.com', pw_passwd='x', pw_uid=2147483649, pw_gid=10000, pw_gecos='Test User', pw_dir='', pw_shell='') The attached patch against 2.6.4 changes PyInt_FromLong to PyLong_FromUnsignedLong and changes casts to unsigned long. |
|||
| msg132516 - (view) | Author: Sandro Tosi (sandro.tosi) * (Python committer) | Date: 2011年03月29日 20:08 | |
I took the freedom to refresh the patch against default (I don't know yet the policies for what to backport and what not), built a debug version of python with the patch applied and run the test suite with no regression. A test would be nice to be added, but I'm not sure how to do that (is test_grp.py reading local /etc/groups or so?). I'd be happy another pair of eyes to look at the patch, but it seems worth to be committing it (modulo the backport thing: what lower version should be targetting?). |
|||
| msg182085 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年02月14日 10:51 | |
Fixed by patch for issue4591. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:54 | admin | set | github: 51614 |
| 2013年02月14日 10:51:02 | serhiy.storchaka | set | status: open -> closed superseder: 32-bits unsigned user/group identifier nosy: + serhiy.storchaka messages: + msg182085 resolution: duplicate stage: patch review -> resolved |
| 2011年06月25日 22:39:57 | terry.reedy | set | versions: - Python 3.1 |
| 2011年03月29日 20:08:05 | sandro.tosi | set | files:
+ issue7365_refresh_default.patch versions: + Python 3.3 nosy: + sandro.tosi messages: + msg132516 |
| 2010年07月11日 13:56:54 | brian.curtin | set | components: + Extension Modules, - Library (Lib) |
| 2010年07月11日 10:53:44 | BreamoreBoy | set | stage: patch review components: + Library (Lib), - Extension Modules versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6 |
| 2009年11月20日 01:24:04 | eplese | create | |