Processed: Bug#119974: Bug confirmed
Processing commands for [EMAIL PROTECTED]: tag 119974 + pending Bug#119974: libc6-dev: fsync() doesn't get declared on unistd.h without __USE_BSD or __USE_XOPEN Tags were: pending Tags added: pending thanks Stopping processing here. Please contact me if you need assistance. Debian bug tracking system administrator (administrator, Debian Bugs database) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#119974: Bug confirmed
tag 119974 + pending thanks I checked in the POSIX doc, FWIW here is what I found: fsync was first introduced it seems as an XOPEN extension. Hence the __USE_XOPEN guard, and defining _XOPEN_SOURCE indeed works. Else, wrt POSIX, fsync last updates are in posix 1003.1-2001. Just saying POSIX does not tell you if its POSIX.1 or POSIX.1b. Given the current messy use of test macros, it would be natural to think POSIX refers to whatever _POSIX_SOURCE buys you by default (POSIX.1); otherwise the manual page would state clearly the standard revision so you could define the test macro to the appropiate number. On the other hand, the fsync(2) manual page (which I had read) clearly labels fsync() as POSIX.1b, so I was a bit confused for the precise revision, but it is clearly a POSIX function. Current man page advertise it as POSIX 1003.1-2001 which is correct. So FWIW compiling with: gcc -ansi -Wall -D_POSIX_SOURCE=1 -D_POSIX_C_SOURCE=200112 a.c should work. The correct fix is to add an || defined(__USE_POSIX2K) in the guard. -- ·O· Pierre Habouzit ··O[EMAIL PROTECTED] OOOhttp://www.madism.org pgpiBKtpULC8O.pgp Description: PGP signature
Bug#119974: Bug confirmed
tag 119974 + pending thanks I checked in the POSIX doc, FWIW here is what I found: fsync was first introduced it seems as an XOPEN extension. Hence the __USE_XOPEN guard, and defining _XOPEN_SOURCE indeed works. Else, wrt POSIX, fsync last updates are in posix 1003.1-2001. Just saying POSIX does not tell you if its POSIX.1 or POSIX.1b. Given the current messy use of test macros, it would be natural to think POSIX refers to whatever _POSIX_SOURCE buys you by default (POSIX.1); otherwise the manual page would state clearly the standard revision so you could define the test macro to the appropiate number. On the other hand, the fsync(2) manual page (which I had read) clearly labels fsync() as POSIX.1b, so I was a bit confused for the precise revision, but it is clearly a POSIX function. Current man page advertise it as POSIX 1003.1-2001 which is correct. So FWIW compiling with: gcc -ansi -Wall -D_POSIX_SOURCE=1 -D_POSIX_C_SOURCE=200112 a.c should work. The correct fix is to add an || defined(__USE_POSIX2K) in the guard. -- ·O· Pierre Habouzit ··O[EMAIL PROTECTED] OOOhttp://www.madism.org pgp85O9pigVE7.pgp Description: PGP signature
Processed: Re: Bug#119974: Bug confirmed
Processing commands for [EMAIL PROTECTED]: tag 119974 + pending Bug#119974: libc6-dev: fsync() doesn't get declared on unistd.h without __USE_BSD or __USE_XOPEN There were no tags set. Tags added: pending thanks Stopping processing here. Please contact me if you need assistance. Debian bug tracking system administrator (administrator, Debian Bugs database) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#119974: Bug confirmed
On Mon, Jan 13, 2003 at 08:02:14AM -0500, H. S. Teoh wrote: So you're saying that even if you ask for POSIX.1b, you still don't get fsync()? Yes. Try this: $ cat test.c #include unistd.h void foo (void) { fsync(0); } $ gcc -Wall -D_POSIX_C_SOURCE=199309L -c test.c test.c: In function `foo': test.c:2: warning: implicit declaration of function `fsync' According to my online research, fsync is NOT part of POSIX.1, but it IS a part of POSIX.1b. There was an earlier contention over fsync's semantics that precluded it from being in POSIX.1; but apparently the POSIX people have decided to put it in 1b. Now, whether or not the glibc headers correctly reflect this is something the glibc maintainers should check. Well, if it's part of POSIX then the function prototype is not correctly guarded by only the BSD and X/Open flags. It does not work for those who ask for POSIX.1b *but not more*. Also, if the glibc docs are confusing, then it should be fixed so that fsync is clearly labelled as POSIX.1b, not just POSIX (which, IIRC, means POSIX.1 only---or at least, that's what the current glibc headers will give you when you ask for POSIX.) Please, since you know the details and can point to facts (surely better than me), could you file the bug for glibc-doc? -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#119974: Bug confirmed
Hi, I've just tested this bug, and observed something rather interesting: % cpp /usr/include/unistd.h |grep fsync extern int fsync (int __fd) ; % cpp -D_POSIX_SOURCE /usr/include/unistd.h | grep fsync % So it gets included in the default header file, but not when _POSIX_SOURCE is defined. Now according to a little online research[1], I've found out that fsync() was actually NOT part of POSIX.1, but was introduced in POSIX.1b. (There was apparently some controversy surrounding the exact semantics of fsync(), which may have played a role in its late introduction to POSIX.) It may be that the fsync declaration in unistd.h was written before POSIX.1b, and so it would be excluded when _POSIX_SOURCE was defined. But I presume the manpages were written/updated after POSIX.1b, and hence they mark fsync as POSIX-compliant. Regardless, since fsync is now POSIX-compliant (specifically, POSIX.1b-compliant), unistd.h should be fixed. The glibc maintainers should, of course, check the actual POSIX.1b spec to ensure that this is accurate. (Also, there may be an issue surrounding old code that expects _POSIX_SOURCE to refer only to POSIX.1 (as opposed to .1b) compliance, and so would expect fsync *not* to be defined; but I'm not well informed enough to know if this is the case or not.) Notes: [1] I was going to include it here, but it was getting a bit lengthy and perhaps not that relevant. But I'll provide it if anybody's interested. T -- Some ideas are so stupid that only intellectuals could believe them. -- George Orwell -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#119974: Bug confirmed
On Sat, Dec 28, 2002 at 12:07:14PM -0500, H. S. Teoh wrote: Hi, I've just tested this bug, and observed something rather interesting: % cpp /usr/include/unistd.h |grep fsync extern int fsync (int __fd) ; % cpp -D_POSIX_SOURCE /usr/include/unistd.h | grep fsync % So it gets included in the default header file, but not when _POSIX_SOURCE is defined. Now according to a little online research[1], I've found out that fsync() was actually NOT part of POSIX.1, but was introduced in POSIX.1b. (There was apparently some controversy surrounding the exact semantics of fsync(), which may have played a role in its late introduction to POSIX.) It's guarded by: #if defined __USE_BSD || defined __USE_XOPEN _POSIX_SOURCE is: _POSIX_SOURCEIEEE Std 1003.1. i.e. not 1b. On the other hand, given: _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if =2 add IEEE Std 1003.2; if =199309L, add IEEE Std 1003.1b-1993; if =199506L, add IEEE Std 1003.1c-1995 but _POSIX_C_SOURCE=199309 is not enough to turn on the prototype of fsync... so there is a problem, but _POSIX_SOURCE is behaving as intended. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#119974: Bug confirmed
On Sat, Dec 28, 2002 at 07:23:06PM -0500, Daniel Jacobowitz wrote: [snip] It's guarded by: #if defined __USE_BSD || defined __USE_XOPEN _POSIX_SOURCE is: _POSIX_SOURCEIEEE Std 1003.1. i.e. not 1b. Ahh, that explains it. On the other hand, given: _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if =2 add IEEE Std 1003.2; if =199309L, add IEEE Std 1003.1b-1993; if =199506L, add IEEE Std 1003.1c-1995 but _POSIX_C_SOURCE=199309 is not enough to turn on the prototype of fsync... so there is a problem, but _POSIX_SOURCE is behaving as intended. [snip] Wow, this is a messier tangle than I previously thought. :-) Is any of this documented anywhere? I think the original bug submitter filed the bug because according to his understanding of the documentation, fsync *should* be included when _POSIX_SOURCE is defined. The manpage *does* mention POSIX.1b; so if what you describe above is actually documented somewhere, then the submitter should be referred to it, and the bug should be closed. T -- Roasting my brains over a slow fire. Please do not interrupt this process. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#119974: Bug confirmed
On Sat, Dec 28, 2002 at 08:03:40PM -0500, H. S. Teoh wrote: On Sat, Dec 28, 2002 at 07:23:06PM -0500, Daniel Jacobowitz wrote: [snip] It's guarded by: #if defined __USE_BSD || defined __USE_XOPEN _POSIX_SOURCE is: _POSIX_SOURCEIEEE Std 1003.1. i.e. not 1b. Ahh, that explains it. On the other hand, given: _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if =2 add IEEE Std 1003.2; if =199309L, add IEEE Std 1003.1b-1993; if =199506L, add IEEE Std 1003.1c-1995 but _POSIX_C_SOURCE=199309 is not enough to turn on the prototype of fsync... so there is a problem, but _POSIX_SOURCE is behaving as intended. [snip] Wow, this is a messier tangle than I previously thought. :-) Is any of this documented anywhere? I think the original bug submitter filed the bug because according to his understanding of the documentation, fsync *should* be included when _POSIX_SOURCE is defined. The manpage *does* mention POSIX.1b; so if what you describe above is actually documented somewhere, then the submitter should be referred to it, and the bug should be closed. Documented? Well, sort of. There's practical documentation in the source; please read /usr/include/features.h near the top, which is _extensively_ commented. Aha, I see that there is a Feature Test Macros in the info documentation also. I'm not sure if the bug should be closed; it depends exactly where fsync belongs. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#119974: Bug confirmed
Hi, I've just tested this bug, and observed something rather interesting: % cpp /usr/include/unistd.h |grep fsync extern int fsync (int __fd) ; % cpp -D_POSIX_SOURCE /usr/include/unistd.h | grep fsync % So it gets included in the default header file, but not when _POSIX_SOURCE is defined. Now according to a little online research[1], I've found out that fsync() was actually NOT part of POSIX.1, but was introduced in POSIX.1b. (There was apparently some controversy surrounding the exact semantics of fsync(), which may have played a role in its late introduction to POSIX.) It may be that the fsync declaration in unistd.h was written before POSIX.1b, and so it would be excluded when _POSIX_SOURCE was defined. But I presume the manpages were written/updated after POSIX.1b, and hence they mark fsync as POSIX-compliant. Regardless, since fsync is now POSIX-compliant (specifically, POSIX.1b-compliant), unistd.h should be fixed. The glibc maintainers should, of course, check the actual POSIX.1b spec to ensure that this is accurate. (Also, there may be an issue surrounding old code that expects _POSIX_SOURCE to refer only to POSIX.1 (as opposed to .1b) compliance, and so would expect fsync *not* to be defined; but I'm not well informed enough to know if this is the case or not.) Notes: [1] I was going to include it here, but it was getting a bit lengthy and perhaps not that relevant. But I'll provide it if anybody's interested. T -- Some ideas are so stupid that only intellectuals could believe them. -- George Orwell
Bug#119974: Bug confirmed
On Sat, Dec 28, 2002 at 12:07:14PM -0500, H. S. Teoh wrote: Hi, I've just tested this bug, and observed something rather interesting: % cpp /usr/include/unistd.h |grep fsync extern int fsync (int __fd) ; % cpp -D_POSIX_SOURCE /usr/include/unistd.h | grep fsync % So it gets included in the default header file, but not when _POSIX_SOURCE is defined. Now according to a little online research[1], I've found out that fsync() was actually NOT part of POSIX.1, but was introduced in POSIX.1b. (There was apparently some controversy surrounding the exact semantics of fsync(), which may have played a role in its late introduction to POSIX.) It's guarded by: #if defined __USE_BSD || defined __USE_XOPEN _POSIX_SOURCE is: _POSIX_SOURCEIEEE Std 1003.1. i.e. not 1b. On the other hand, given: _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if =2 add IEEE Std 1003.2; if =199309L, add IEEE Std 1003.1b-1993; if =199506L, add IEEE Std 1003.1c-1995 but _POSIX_C_SOURCE=199309 is not enough to turn on the prototype of fsync... so there is a problem, but _POSIX_SOURCE is behaving as intended. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer
Bug#119974: Bug confirmed
On Sat, Dec 28, 2002 at 07:23:06PM -0500, Daniel Jacobowitz wrote: [snip] It's guarded by: #if defined __USE_BSD || defined __USE_XOPEN _POSIX_SOURCE is: _POSIX_SOURCEIEEE Std 1003.1. i.e. not 1b. Ahh, that explains it. On the other hand, given: _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if =2 add IEEE Std 1003.2; if =199309L, add IEEE Std 1003.1b-1993; if =199506L, add IEEE Std 1003.1c-1995 but _POSIX_C_SOURCE=199309 is not enough to turn on the prototype of fsync... so there is a problem, but _POSIX_SOURCE is behaving as intended. [snip] Wow, this is a messier tangle than I previously thought. :-) Is any of this documented anywhere? I think the original bug submitter filed the bug because according to his understanding of the documentation, fsync *should* be included when _POSIX_SOURCE is defined. The manpage *does* mention POSIX.1b; so if what you describe above is actually documented somewhere, then the submitter should be referred to it, and the bug should be closed. T -- Roasting my brains over a slow fire. Please do not interrupt this process.
Bug#119974: Bug confirmed
On Sat, Dec 28, 2002 at 08:03:40PM -0500, H. S. Teoh wrote: On Sat, Dec 28, 2002 at 07:23:06PM -0500, Daniel Jacobowitz wrote: [snip] It's guarded by: #if defined __USE_BSD || defined __USE_XOPEN _POSIX_SOURCE is: _POSIX_SOURCEIEEE Std 1003.1. i.e. not 1b. Ahh, that explains it. On the other hand, given: _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if =2 add IEEE Std 1003.2; if =199309L, add IEEE Std 1003.1b-1993; if =199506L, add IEEE Std 1003.1c-1995 but _POSIX_C_SOURCE=199309 is not enough to turn on the prototype of fsync... so there is a problem, but _POSIX_SOURCE is behaving as intended. [snip] Wow, this is a messier tangle than I previously thought. :-) Is any of this documented anywhere? I think the original bug submitter filed the bug because according to his understanding of the documentation, fsync *should* be included when _POSIX_SOURCE is defined. The manpage *does* mention POSIX.1b; so if what you describe above is actually documented somewhere, then the submitter should be referred to it, and the bug should be closed. Documented? Well, sort of. There's practical documentation in the source; please read /usr/include/features.h near the top, which is _extensively_ commented. Aha, I see that there is a Feature Test Macros in the info documentation also. I'm not sure if the bug should be closed; it depends exactly where fsync belongs. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer