Issue 767150: socket.inet_aton on 64bit platform (original) (raw)

Created on 2003-07-07 14:03 by geertj, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Messages (6)
msg16937 - (view) Author: Geert Jansen (geertj) * Date: 2003-07-07 14:03
Hi, socket.inet_aton() returns an 8 byte string when built on Linux/IA64. This should be 4 bytes on all architectures. Example: >>> import socket >>> socket.inet_aton('192.168.2.1') '\xc0\xa8\x02\x01\x00\x00\x00\x00' The bug is caused by Modules/socketmodule.c using sizeof(unsinged long) when constructing the string, which is 8 bytes on Linux/IA64. The bug seems to be fixed in Python 2.3 in the case struct in_addr is available. Otherwise it still uses an unsigned long. Geert
msg16938 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-07-07 21:10
Logged In: YES user_id=21627 Can you try to come up with a patch?
msg16939 - (view) Author: Mats Wichmann (mwichmann) * Date: 2004-08-12 16:45
Logged In: YES user_id=53605 I've just run into this problem, which is still present in current cvs. This now (2.3.x and cvs head) occurs for the code path where inet_aton is not detected by configure, so it's not a terribly common case. Of course, I have one ... The conversion needs to be done on a 32-bit quantity. It's a one-liner to fix, I'll submit a patch if I can make the patch manager work for me.
msg16940 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2004-11-12 02:16
Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as "Won't fix". Thank you! . Facundo
msg16941 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2005-03-21 17:40
Logged In: YES user_id=752496 Deprecated. Reopen only if still happens in 2.3 or newer. . Facundo
msg81690 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2009-02-11 23:33
Sad that this was closed as wontfix years ago. anyways I am fixing this. see #1008086.
History
Date User Action Args
2022-04-10 16:09:48 admin set github: 38810
2009-02-11 23:33:41 gregory.p.smith set keywords: + 64bitnosy: + gregory.p.smithsuperseder: socket.inet_aton returns 8 bytes on LP64 platformsmessages: +
2003-07-07 14:03:54 geertj create