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
Add some posix functions #55021
Comments
Here's a patch that adds a bunch of posix functions that are missing from the posix module. Includes tests & documentation. Tested on Linux & FreeBSD. Specifically: |
First couple comments:
|
For the record, I get the following failures under OpenSolaris: ====================================================================== Traceback (most recent call last):
File "/home/antoine/py3k/cc/Lib/test/test_posix.py", line 265, in test_lutimes
posix.lutimes(support.TESTFN, None)
AttributeError: 'module' object has no attribute 'lutimes' ====================================================================== Traceback (most recent call last):
File "/home/antoine/py3k/cc/Lib/test/test_posix.py", line 236, in test_posix_fallocate
posix.posix_fallocate(fd, 0, 10)
OSError: [Errno 22] Invalid argument |
According to the posix_fallocate() man page under OpenSolaris:
I would go for the third (last) interpretation: the filesystem (ZFS here) doesn't support it. |
This patch: Fixes test_lutimes(), |
The patch contains a lot of repeated boilerplate code. I wonder if some of it can be factored out and reused. For example iov buffer allocation code appears to be identical in writev and readv. |
This new patch reuses iov allocation code between readv & writev. I've tried where possible to reuse code but I think though that the code seems pretty standard for the posix module. Each function pretty much parses args, calls posix function, checks for error and returns result. |
Patch looks mostly good. Some comments:
|
According to the spec for gethostname(), the hostname that it returns is null-terminated so it won't support embedded NUL bytes. Should we still add it anyway? |
Thanks for the comments. I implemented sethostid() - its not actually in the posix spec, but linux/*bsd I implemented gethostname(). Both get/sethostname() now use FSDefault encoding. Since id_t can contain a pid_t, I now parse id_t with _Py_PARSE_PID. According to the spec, gethostid does not set errno - it now checks anyway. Instead of PARSE_OFF_T, I use a O& parser. |
Oops, I misread the spec. No, gethostname should then not be duplicated. |
Sorry, I misread that also. Leaving the check is fine; reverting it to |
This patch takes out sethostname() and gethostname(). I'll open up a new issue to add sethostname() to the socket module. |
A few small fixes for OS X: |
I added some comments on the review for 10812_v5.patch. not sure why v6 doesn't have a review link. Overall, very nice after addressing the few comments I had. btw, can you sync this up with the hg tip (3.3) now while addressing the above? I'm excited to see readv/writev/fadvise added. Extremely useful. |
PyParse_off_t was already added when sendfile() was added as was the iovec_setup stuff. I'll upload a patch soon which updates it to take this and the other comments into account. |
v6 was created against an unknown mercurial repository (most likely code.python.org). It actually doesn't apply cleanly anymore so it would be best to regenerate it it (or go on with any v7 that may result out of the review). |
This new patch, updated against the tip for 3.3: Shares the iov_setup and iov_cleanup code, py_parse_off_t with sendfile(). Removes gethostid and sethostid since they're deprecated. I think I was correct with referring to utime() since I was referring to the python function, os.utime(). |
Forgot to attach the patch |
New changeset 525320df8afb by Ross Lagerwall in branch 'default': |
New changeset 8945e087a5a6 by Ross Lagerwall in branch 'default': |
New changeset 96e09d039433 by Ross Lagerwall in branch 'default': |
msg126598 says that waitid is broken on MacOSX. In what way it is broken? The code is currently disabled for OSX without any indication why this is so, that makes it hard to know how to test if new OSX releases (like the just released OSX 10.8) fix waitid. |
To elaborate: when I remove the "&& !defined(APPLE)" tests from posixmodule.c test_posix passes on OSX 10.8, including test_waitid. I have no idea if this means that waitid is no longer "broken" in OSX 10.8 or that test_posix doesn't trigger the issue. |
I can't actually remember why I disabled waitid for OS X - that was message was rather a long time ago :-( Unfortunately, I don't currently have access to an OS X machine to test it. A google search shows the following comment in the v8 javascript engine: Do you have access to test an older release like Leopard? |
I have VMs with earlier versions of OSX (at least 10.5 and 10.6). I cannot run those right now because they use enough resources to interfere with other activities. I'll try to test later this week. BTW. I'd prefer to make waitid available on OSX unless it is totally non-functional. I'm not convinced that the Google problem is a good enough reason to avoid exposing the function. If it is disabled there should be a clear description of why that is, preferable in the form of a (configure) test. |
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: