I'm running python on OpenBSD/sparc64 (SUN Ultra 10). On this machine struct.pack() gives me: >>> struct.pack('l', 1) '\x00\x00\x00\x00\x00\x00\x00\x01' >>> struct.pack('i', 1) '\x00\x00\x00\x01' On i386 box I have: >>> struct.pack('l', 1) '\x01\x00\x00\x00' >>> struct.pack('i', 1) '\x01\x00\x00\x00' Because of this, OpenBSD port uses attached patch. I guess that this is generic problem (not OpenBSD specific) and every 64bit platform would suffer. Am I right?
Logged In: YES user_id=31435 For a Unix-head reviewer: the patch is to test_fcntl.py, which uses a native struct.pack() to build a lockdata argument for fcntl. On the OP's box, it constructs stuff of the wrong size, due to "l" format codes producing 8-byte thingies. The patch changes the "l" codes to "i" on the OP's platform. I wonder whether we couldn't instead use "i" codes on all BSD- ish platforms -- on 32-bit boxes, "i" is synonymous with "l", while on 64-bit boxes it looks like "l" is wrong but "i" is correct.
Logged In: YES user_id=21627 I don't quite understand the current code: struct flock is on Darwin struct flock { off_t l_start; /* starting offset */ off_t l_len; /* len = 0 means until end of file */ pid_t l_pid; /* lock owner */ short l_type; /* lock type: read/write, etc. */ short l_whence; /* type of l_start */ }; and off_t is typedef int64_t quad_t; typedef quad_t off_t; /* file offset */ so it appears there is no padding at all. In any case, this needs to be changed in posixfile._posixfile_.flock accordingly.