[issue833] missing functions in the os module

New submission from teepark <travis.parker@gmail.com>: I ran into this when I needed os.fchmod, but there are quite a few names not present in pypy's os module (I'm on x86_64 linux, and I'm sure many of these aren't guaranteed to be there for any platform, but pypy on x86_64 linux should probably include them): - getlogin - confstr - getresgid - tcsetpgrp - statvfs - setresgid - initgroups - fstatvfs - getresuid - fchmod - setresuid - tcgetpgrp - confstr_names - setgroups - pathconf - fchown - openpty - ctermid - statvfs_result Please change the priority if "feature" isn't appropriate - it doesn't feel right but I don't know that cpython compatibility issues are being treated as bugs. ---------- messages: 2975 nosy: pypy-issue, teepark priority: feature status: unread title: missing functions in the os module ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

Armin Rigo <armin.rigo@gmail.com> added the comment: It's a duplicate of https://bugs.pypy.org/issue605 , but it's nice to have an updated list. I will close the other bug report as the duplicate one. ---------- nosy: +arigo status: unread -> chatting ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

teepark <travis.parker@gmail.com> added the comment: ah thank you, I searched for fchmod before posting but that wasn't in the other bug. this list was generated by pasting in dir(os) from cpython 2.7.1 to pypy 1.6 and doing the set difference, so should be up to date :) ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

Armin Rigo <armin.rigo@gmail.com> added the comment: Yes, thank you :-) I think the previous list was a comparison of PyPy in a release that supported Python 2.5, and CPython 2.5 itself. There is indeed no os.fchmod() in CPython 2.5 either. ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

Mitchell Hashimoto <mitchell.hashimoto@gmail.com> added the comment: I've added os.getlogin(), patch available at issue #841 https://bugs.pypy.org/issue841 ---------- nosy: +mitchellh ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

teepark <travis.parker@gmail.com> added the comment: another update to this list, from cpython 2.7.3 and pypy 1.9: 'setresgid', 'confstr', 'getresgid', 'tcsetpgrp', 'statvfs', 'pathconf', 'initgroups', 'fchown', 'getresuid', 'fchmod', 'setresuid', 'confstr_names', 'setgroups', 'tcgetpgrp', 'fstatvfs', 'ctermid', 'statvfs_result' ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

bdk <bdkearns@gmail.com> added the comment: some of these would be present if the buildbots translated pypy using a fresh cpython2.7 (with proper functions in the os module) rather than using an older pypy (which was translated either before the function was included in pypy's os or before the functions were in the host os module, ie functions added to cpython recently). for example, code to support fchown/fchmod was added 8275a7379d56 but will not be included until the translating host python has it in the os module. ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

Amaury Forgeot d Arc <amauryfa@gmail.com> added the comment: Using the host python is bad indeed. rffi_platform.configure() could be used instead to detect the presence of specific functions. ---------- nosy: +amaury ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

Armin Rigo <armin.rigo@gmail.com> added the comment: The current list of missing names, using a fresh CPython-translated PyPy: < confstr < confstr_names < getresgid < getresuid < initgroups < pathconf < setgroups < setresgid < setresuid < tcgetpgrp < tcsetpgrp ---------- release: 2.0 -> ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

Armin Rigo <armin.rigo@gmail.com> added the comment: I've now added all the remaining names. Still translating to check things are ok, but it seems to work, so I'm closing this. ---------- status: chatting -> resolved ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

Jana Sasout <jana@saout.de> added the comment: I just wanted to write a small patch to sneek in setgroups, but then noticed that it's already there. Unfortunately it still says "AttributeError: 'module' object has no attribute 'setgroups'". So, I suspect there is an issue with the conditional "@registering_if(os, 'setgroups')", because accessing setgroups with ctypes / cffi just works fine. If someone recognizes this as an obvious oversight, can someone sneak the fix into 2.3.1? ;) ---------- nosy: +chteffie status: resolved -> chatting ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

Armin Rigo <armin.rigo@gmail.com> added the comment: "os.setgroups" works without AttributeError for me on PyPy 2.3 (Linux64). Can you give more precisely your OS/platform, and from where you downloaded the PyPy you installed? We know that there are possible issues with that depending on how it is translated. ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

Jana Sasout <jana@saout.de> added the comment: I compiled it myself on an uptodate version of Gentoo x86-64. I, however, used the existing install of PyPy for translation, which didn't know about about os.setgroups either. Was this my mistake? (otherwise, I'll find out in an hour or so) If this was my mistake - sorry for the bother. ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________

Armin Rigo <armin.rigo@gmail.com> added the comment: Yes, that's the problem. Any PyPy translated using an older PyPy will only contain whatever os-module functions were already available in this older PyPy. This is rather buggy, but there is little incentive to fix it for the future, now that all functions are there... ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue833> ________________________________________
participants (6)
-
Amaury Forgeot d Arc
-
Armin Rigo
-
bdk
-
Jana Sasout
-
Mitchell Hashimoto
-
teepark