This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/12037] New: Feature test macros incorrect for ftruncate() (and probably also truncate())


I've just been documenting the new feature test macro requirements for
truncate() and ftruncate() in glibc 2.12, and it appears that the FTMs for
ftruncate() are incorrect.

Some background. In POSIX, these functions are marked as follows:

POSIX.1-2001/SUSv3
ftruncate() no markings
truncate() marked XSI

POSIX.1-2008/SUSv4
ftruncate() no markings
truncate() no markings

Here's the history of feature test macro requirements for these two functions as
defined in <unistd.h>:

       truncate():
           Since glibc 2.12
               _BSD_SOURCE || _XOPEN_SOURCE >= 500 ||
               _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED ||
               _POSIX_C_SOURCE >= 200809L
           Before glibc 2.12:
               _BSD_SOURCE || _XOPEN_SOURCE >= 500 ||
               _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED

       ftruncate():
           Since glibc 2.12:
               _BSD_SOURCE || _XOPEN_SOURCE >= 500 ||
               _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED ||
               _POSIX_C_SOURCE >= 200809L
           Between glibc 2.3.5 and 2.11
               _BSD_SOURCE || _XOPEN_SOURCE >= 500 ||
               _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED ||
               _POSIX_C_SOURCE >= 200112L
           Before glibc 2.3.5:
               _BSD_SOURCE || _XOPEN_SOURCE >= 500 ||
               _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED

>From the above, ftruncate() is no longer exposed in glibc 2.12 if
_POSIX_C_SOURCE >= 200112. This seems pretty clearly incorrect. I belive the
FTMs governing the declaration should have remained as they were pre 2.12:

#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K

-- 
           Summary: Feature test macros incorrect for ftruncate() (and
                    probably also truncate())
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper dot fsp at gmail dot com
        ReportedBy: mtk dot manpages at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=12037

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]