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
FAIL: test_makedev (test.test_posix.PosixTester) on AMD64 FreeBSD CURRENT #75227
Comments
The test failed in the build 632 (Wed Jul 26 10:47:01 2017) for the first time. == CPython 3.7.0a0 (heads/master:ede9084476, Jul 26 2017, 20:49:33) [GCC 4.2.1 Compatible FreeBSD Clang 5.0.0 (trunk 308421)] Traceback (most recent call last):
File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_posix.py", line 543, in test_makedev
self.assertEqual(posix.makedev(major, minor), dev)
AssertionError: 1292118443 != 954774858155 |
The test fails on Debug but also Non-Debug buildbots, master and 3.6 branches. It looks more like a change on the buildbot, maybe a FreeBSD upgrade? |
I'm able to reproduce the bug on koobs's FreeBSD CURRENT:
minor() truncates most significant bits. major/minor are defined in sys/types.h: #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. |
os.stat() seems correct, st_dev and st_ino are the same than the system command "stat": CURRENT-amd64% ./python -c 'import os; st=os.stat("setup.py"); print(st)' CURRENT-amd64% stat setup.py The used filesystem for /home is ZFS: CURRENT-amd64% df . CURRENT-amd64% mount|grep home |
The problem is more the major(), minor() and makedev() commands: CURRENT-amd64% ./python
Python 3.7.0a0 (heads/master:d5ed47dea2, Jul 28 2017, 00:10:54)
[GCC 4.2.1 Compatible FreeBSD Clang 5.0.0 (trunk 308421)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> dev=954774858155; os.makedev(os.major(dev), os.minor(dev))
1292118443 "makedev, major, minor -- device number conversion" doc on FreeBSD CURRENT: SYNOPSIS
#include <sys/types.h>
int
major(dev_t dev);
int
minor(dev_t dev); DESCRIPTION
RETURN VALUES |
Confirmation that minor() truncates high bits: CURRENT-amd64% ./python -c 'import os; print(hex(os.minor(0xaabbccddff)))' |
At May 23, the dev_t type changed from 32 bits to 64 bits on FreeBSD in the kernel, but minor() wasn't updated. I reported a bug to FreeBSD: |
I enabled again the test in the master branch, the FreeBSD kernel bug has been fixed 10 months ago:
Technically, we could reenable the test in 3.7 as well, but I prefer to leave it disabled since I'm not 100% sure that all FreeBSD kernels in the wild are fine, and the code is already well tested by other platforms. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: