Skip to content
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

Process.get_connections() is broken on big-endian architectures #201

Closed
giampaolo opened this issue May 23, 2014 · 10 comments
Closed

Process.get_connections() is broken on big-endian architectures #201

giampaolo opened this issue May 23, 2014 · 10 comments

Comments

@giampaolo
Copy link
Owner

From matrixhasu on August 28, 2011 16:57:01

Hi,
followuing up issue 200 , I gave a look at what's happening on sparc about:

FAIL: test_get_connections (__main__.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_psutil.py", line 147, in inner
    return fun(self, *args, **kwargs)
  File "test/test_psutil.py", line 974, in test_get_connections
    self.assertEqual(ip, '127.0.0.1')
AssertionError: '1.0.0.127' != '127.0.0.1'

The problem (that I think it's related to the endianess of the architecture) is 
that _decode_address() expect 127.0.0.1 in a line like this

   2: 0100007F:1DD2 00000000:0000 0A 00000000:00000000 00:00000000 00000000     
0        0 6797 1 ffff880115776040 300 0 0 2 -1                      

while on sparc you'd get something like:

   2: 7F000001:A13F 00000000:0000 0A 00000000:00000000 00:00000000 00000000  
2940        0 41019895 1 fffff8103c59be80 300 0 0 2 -1                  

so the second field (the local address) is in reverse.

The different ordering might come up even on other part of the code.

If you need any help in debugging further, don't hesitate to contact me.

Cheers,
Sandro

Original issue: http://code.google.com/p/psutil/issues/detail?id=201

@giampaolo
Copy link
Owner Author

From matrixhasu on August 28, 2011 15:55:00

I can see an error like this even on: mips (but not on mipsel, which is little 
endian, so it's definitely alignment-related), powerpc and s390 .

@giampaolo
Copy link
Owner Author

From g.rodola on August 29, 2011 03:49:25

Can you please check whether this patch works (note: I still haven't took care of IPv6)?

Attachment: endianess.patch

@giampaolo
Copy link
Owner Author

From matrixhasu on August 29, 2011 10:54:59

Yep, it works fine (I tested both on a little and big endian box)

@giampaolo
Copy link
Owner Author

From g.rodola on August 29, 2011 13:06:03

This should now be fixed in r1113 and r1114 .
I've also added a brand new IPv6-related test so please re-run tests to make 
sure everything is fine.

Summary: Process.get_connections() is broken on big-endian architectures
Status: Started
Labels: OpSys-Linux Milestone-0.3.1

@giampaolo
Copy link
Owner Author

From matrixhasu on August 29, 2011 13:27:59

It works fine either on sparc and on amd64 (so 2 different endian machines). 
Ah, since you're giving me credit (thanks about that!) you might want to refer 
to my real name "Sandro Tosi" (for the email you can use sandro.tosi@gmail.com 
or morph@debian.org).

@giampaolo
Copy link
Owner Author

From g.rodola on August 29, 2011 13:31:43

Oh yeah, we met at Euro Python in Florence this very year. =)
Fixed in r1115 .

Status: FixedInSVN

@giampaolo
Copy link
Owner Author

From g.rodola on October 21, 2011 16:44:17

Labels: -Milestone-0.3.1

@giampaolo
Copy link
Owner Author

From g.rodola on October 21, 2011 16:45:27

Labels: Milestone-0.4.0

@giampaolo
Copy link
Owner Author

From g.rodola on October 28, 2011 20:44:14

Status: Fixed

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 04:03:06

Updated csets after the SVN -> Mercurial migration: r1113 == revision 
e00994c657c0 r1115 == revision 3671d370e764

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant