[Bug 221048] minor() truncates device number to 32 bits, whereas dev_t type was extended to 64 bits
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Jul 27 14:30:09 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221048
Bug ID: 221048
Summary: minor() truncates device number to 32 bits, whereas
dev_t type was extended to 64 bits
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: freebsd-bugs at FreeBSD.org
Reporter: victor.stinner at gmail.com
A commit made at May, 23, changed dev_t type from 32 bits to 64 bits:
* https://reviews.freebsd.org/D10439
*
https://github.com/freebsd/freebsd/commit/e75ba1d5c4c79376a78351c8544388491db49664#diff-12c2f5b61ce3b017a25144619d13ca66L108
The problem is that the userland minor() macro explicitly truncates to 32 bits:
#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
https://github.com/freebsd/freebsd/blob/master/sys/sys/types.h#L373
64-bit dev_t broke a unit test Python:
http://bugs.python.org/issue31044
In short, Python checks that makedev(major(dev), minor(dev))==dev, whereas dev
comes from stat.st_dev of a file created in the current directory (ex: ZFS
filesystem for $HOME).
Example:
* stat() returns st_dev = 0xde4d0429ab
* major(0xde4d0429ab) returns 0x29
* minor(0xde4d0429ab) returns 0x4d0400ab
The problem is that minor() truncates 0xde00000000 high bits.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list