[issue31044] FAIL: test_makedev (test.test_posix.PosixTester) on AMD64 FreeBSD CURRENT

STINNER Victor report at bugs.python.org
Thu Jul 27 10:07:36 EDT 2017


STINNER Victor added the comment:

I'm able to reproduce the bug on koobs's FreeBSD CURRENT:

* stat() returns st_dev = 0xde4d0429ab
* major(0xde4d0429ab) returns 0x29
* minor(0xde4d0429ab) returns 0x4d0400ab

minor() truncates most significant bits. major/minor are defined in sys/types.h:
https://github.com/freebsd/freebsd/blob/master/sys/sys/types.h#L372

#define	major(x)	((int)(((u_int)(x) >> 8)&0xff))	/* major number */
#define	minor(x) ((int)((x)&0xffff00ff)) /* minor number */

The definition of minor() confirms that most significant bits are truncated by "& 0xffff00ff".

I'm surprised that stat().st_dev returns a device larger than INT_MAX: 0xde4d0429ab.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31044>
_______________________________________


More information about the Python-bugs-list mailing list