Bug 754188

Summary: Functions major() and minor() returns unsigned value
Product: [Fedora] Fedora Reporter: Zdenek Kabelac <zkabelac>
Component: man-pagesAssignee: Peter Schiffer <pschiffe>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: agk, jakub, mnewsome, mtk.manpages, pschiffe
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: man-pages-3.41-1.fc18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-12 10:05:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zdenek Kabelac 2011-11-15 16:25:20 UTC
Description of problem:

While 'man major' | 'man minor'  is giving me impression it should return 'int' (signed) value, the header file: /usr/include/sys/sysmacros.h is convincing me, I should expect unsigned value:

extern unsigned int gnu_dev_major (unsigned long long int __dev)
     __THROW __attribute_const__;
extern unsigned int gnu_dev_minor (unsigned long long int __dev)
     __THROW __attribute_const__;

# define major(dev) gnu_dev_major (dev)
# define minor(dev) gnu_dev_minor (dev)

Is there any good reason to have this  incompatibility?
(Well the gcc is giving sign warning - and I think we should probably follow the common UNIX definition here ?)


Version-Release number of selected component (if applicable):
glibc-headers-2.14.90-15.2.x86_64

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Jeff Law 2011-12-08 06:31:06 UTC
The man pages are incorrect and need to be updated.  major/minor were never part of the POSIX specification.  In the past they were actually macros and thus took on the types based on the context in which the macros were used and the usual C promotions.

glibc has chosen to more strictly define major/minor which allows programmers to better predict its behavior.

Changing component to man-pages.

Comment 2 Michael Kerrisk 2012-04-29 23:27:36 UTC
Will be fixed in upstream man-pages-3.41.

Comment 3 Peter Schiffer 2012-09-12 10:05:23 UTC
As Michael wrote, this bug was fixed in:
man-pages-3.41-1.fc18
http://koji.fedoraproject.org/koji/buildinfo?buildID=319380