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.

classification
Title: socket.inet_aton returns 8 bytes on LP64 platforms
Type: behavior Stage:
Components: Extension Modules Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: ajaksu2, amaury.forgeotdarc, collinwinter, gregory.p.smith, mwichmann, pitrou, twouters
Priority: normal Keywords: 64bit, easy

Created on 2004-08-12 16:50 by mwichmann, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
socketmod.patch mwichmann, 2004-08-12 16:50
Messages (10)
msg46687 - (view) Author: Mats Wichmann (mwichmann) * Date: 2004-08-12 16:50
The attached is a fix for the same problem that is
reported in 767150.  For 2.3.x and head cvs this
problem exists in the code path taken if configure does
not detect inet_aton.  I have not checked this against
2.2, which is the platform 767150 reports it against,
there may be header inclusion issues that make it not
work there but the essence is that the quantity worked
with has to be forced to be a 32-bit quanitity, not
declared unsigned long.
msg46688 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-11 18:53
The patch is only one line, changing a unsigned long to in_addr_t. Could someone familiar with/with access to Linux on an IA64 machine take a look at this?

Thomas, I notice a lot of posts from you about 64-bit issues... ; )
msg81520 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-02-10 01:40
This is a patch for issue 767150, which was closed in 2005.
msg81522 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-02-10 02:22
I'm not sure in_addr_t is available everywhere. "unsigned int" should be
a good bet, since it is 32-bits in most platforms. Guarding the code
with a "#if (SIZEOF_INT == 4)" and erroring out otherwise will make the
patch ok (and, please add a test).
msg81523 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-02-10 02:23
Sorry, reopening.
msg81687 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-02-11 23:04
Test from issue 767150:
"""
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 was confirmed by a third-party in 2006:
http://mail.python.org/pipermail/python-list/2006-August/400655.html
msg81688 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2009-02-11 23:16
fixing now.
msg81691 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2009-02-11 23:47
fixed in trunk r69519.

needs backporting to release26-maint and release30-maint.  leaving open 
until that happens.
msg90272 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-07-08 16:13
Ping?
This has been merged to py3k with r69560 and is present in 3.1, what
about 2.6?
msg94803 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2009-11-01 20:30
Fixed in release26-maint r76022.  This will appear in Python 2.6.5.

I'm leaving release30-maint alone as it is already in 3.1.

sorry for not making it into 2.6.3/2.6.4 despite the code being ready.  I 
should've set this as a release blocker.
History
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40748
2009-11-01 20:30:04gregory.p.smithsetstatus: open -> closed
resolution: fixed
messages: + msg94803
2009-07-08 16:13:22amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg90272
2009-02-11 23:47:29gregory.p.smithsetkeywords: + 64bit, - patch
type: behavior
versions: + Python 3.0
messages: + msg81691
title: patch for 767150 -> socket.inet_aton returns 8 bytes on LP64 platforms
2009-02-11 23:33:41gregory.p.smithlinkissue767150 superseder
2009-02-11 23:16:20gregory.p.smithsetkeywords: + easy
assignee: twouters -> gregory.p.smith
messages: + msg81688
nosy: + gregory.p.smith
2009-02-11 23:04:39ajaksu2setmessages: + msg81687
2009-02-10 02:23:31pitrousetstatus: closed -> open
resolution: out of date -> (no value)
messages: + msg81523
2009-02-10 02:22:54pitrousetstatus: open -> closed
nosy: + pitrou
resolution: out of date
messages: + msg81522
2009-02-10 01:40:25ajaksu2setnosy: + ajaksu2
messages: + msg81520
2004-08-12 16:50:09mwichmanncreate