1: socketmodule.c now #includes getnameinfo.c and getaddrinfo.c. These functions both use offsetof(), which is defined (on my system, at least) in stddef.h.
That should be fixed now. stddef.h is included in socketmodule.c; if it is not available or does not define offsetof, an additional definition is provided.
- [...] Changes to either of the get{name,addr}info.c files will
not cause socketmodule to be rebuilt.
I don't know how to solve this one. If distutils builds the modules, makefile dependencies won't help.
- The socket module still does not work, however, since it refers
to an unresolved symbol inet_pton
I took the simplest solution that I could think of, delegating inet_{pton,ntop} to inet_{ntoa,addr} for AF_INET, failing for all other address families (AF_INET6 in particular). I've verified that this code does the same as the builtin functions on my Linux system; please let me know whether it compiles for you.
Regards, Martin
[Martin v. Loewis]
1: socketmodule.c now #includes getnameinfo.c and getaddrinfo.c. These functions both use offsetof(), which is defined (on my system, at least) in stddef.h.
That should be fixed now. stddef.h is included in socketmodule.c; if it is not available or does not define offsetof, an additional definition is provided.
Yes, this is fine now...
- [...] Changes to either of the get{name,addr}info.c files will
not cause socketmodule to be rebuilt.
I don't know how to solve this one. If distutils builds the modules, makefile dependencies won't help.
- The socket module still does not work, however, since it refers
to an unresolved symbol inet_pton
I took the simplest solution that I could think of, delegating inet_{pton,ntop} to inet_{ntoa,addr} for AF_INET, failing for all other address families (AF_INET6 in particular). I've verified that this code does the same as the builtin functions on my Linux system; please let me know whether it compiles for you.
To get socketmodule.c to compile, I had to make a change to line 2963 so that the declaration of inet_pton matched the previous declaration on line 220 (changing char *src to const char *src). Still have problems though, due to the use of snprintf in getnameinfo.c:
Python 2.2a0 (#444, Jun 25 2001, 05:58:17) [C] on osf1V4 Type "copyright", "credits" or "license" for more information.
import socket
Traceback (most recent call last): File "<stdin>", line 1, in ? File "/home/gonzo1/mark/groucho1/mark/src/python/CVS/python/dist/src/Lib/socket.py", line 41, in ? from _socket import * ImportError: Unresolved symbol in /home/gonzo1/mark/groucho1/mark/src/python/CVS/python/dist/src/build/lib.osf1-V4.0-alpha-2.2/_socket.so: snprintf
Cheers, Mark
To get socketmodule.c to compile, I had to make a change to line 2963 so that the declaration of inet_pton matched the previous declaration on line 220 (changing char *src to const char *src). Still have problems though, due to the use of snprintf in getnameinfo.c:
Ok, they are printing a single number into a 512 byte buffer; that is safe even with sprintf only, so I have just remove the snprintf call. Can you please try again?
Thanks for your reports, Martin
"Martin v. Loewis" wrote:
To get socketmodule.c to compile, I had to make a change to line 2963 so that the declaration of inet_pton matched the previous declaration on line 220 (changing char *src to const char *src). Still have problems though, due to the use of snprintf in getnameinfo.c:
Ok, they are printing a single number into a 512 byte buffer; that is safe even with sprintf only, so I have just remove the snprintf call. Can you please try again?
Thanks for your reports, Martin
No trouble... The current CVS compiles (with a warning), links, and runs. The warning given is:
cc: Warning: /home/gonzo1/mark/groucho1/mark/src/python/CVS/python/dist/src/Modu les/getaddrinfo.c, line 407: In this statement, the referenced type of the point er value "hostname" is const, but the referenced type of the target of this assi gnment is not. (notconstqual) if (inet_pton(gai_afdl[i].a_af, hostname, pton)) { ------------------------------------------------^
which can be fixed by declaring the second argument to inet_pton as const char* instead of char* in the two occurences of inet_pton in socketmodule.c
Cheers, Mark