* [PATCH][BZ 18234] struct stat is not posix conform
@ 2015-05-20 16:17 Szabolcs Nagy
2015-05-20 16:24 ` Florian Weimer
2015-05-20 17:55 ` Carlos O'Donell
0 siblings, 2 replies; 11+ messages in thread
From: Szabolcs Nagy @ 2015-05-20 16:17 UTC (permalink / raw)
To: GNU C Library; +Cc: Marcus Shawcroft, Ramana Radhakrishnan
[-- Attachment #1: Type: text/plain, Size: 401 bytes --]
the generic definition of struct stat on linux miss the
st_atim, st_mtim and st_ctim members when _POSIX_C_SOURCE
is defined (affects at least aarch64 and arm).
i did not see regressions on aarch64.
2015-05-20 Szabolcs Nagy <szabolcs.nagy@arm.com>
[BZ #18234]
* sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat): Make
st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: stat.diff --]
[-- Type: text/x-patch; name=stat.diff, Size: 675 bytes --]
diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h
index 42cb198..82e6b1d 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
@@ -66,7 +66,7 @@ struct stat
__blksize_t st_blksize; /* Optimal block size for I/O. */
int __pad2;
__field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */
-#ifdef __USE_MISC
+#ifdef __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH][BZ 18234] struct stat is not posix conform
2015-05-20 16:17 [PATCH][BZ 18234] struct stat is not posix conform Szabolcs Nagy
@ 2015-05-20 16:24 ` Florian Weimer
2015-05-20 16:54 ` Carlos O'Donell
2015-05-20 17:55 ` Carlos O'Donell
1 sibling, 1 reply; 11+ messages in thread
From: Florian Weimer @ 2015-05-20 16:24 UTC (permalink / raw)
To: Szabolcs Nagy, GNU C Library; +Cc: Marcus Shawcroft, Ramana Radhakrishnan
On 05/20/2015 05:20 PM, Szabolcs Nagy wrote:
> the generic definition of struct stat on linux miss the
> st_atim, st_mtim and st_ctim members when _POSIX_C_SOURCE
> is defined (affects at least aarch64 and arm).
Does this need to be conditional on the POSIX version?
--
Florian Weimer / Red Hat Product Security
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH][BZ 18234] struct stat is not posix conform
2015-05-20 16:24 ` Florian Weimer
@ 2015-05-20 16:54 ` Carlos O'Donell
0 siblings, 0 replies; 11+ messages in thread
From: Carlos O'Donell @ 2015-05-20 16:54 UTC (permalink / raw)
To: Florian Weimer, Szabolcs Nagy, GNU C Library
Cc: Marcus Shawcroft, Ramana Radhakrishnan
On 05/20/2015 11:58 AM, Florian Weimer wrote:
> On 05/20/2015 05:20 PM, Szabolcs Nagy wrote:
>> the generic definition of struct stat on linux miss the
>> st_atim, st_mtim and st_ctim members when _POSIX_C_SOURCE
>> is defined (affects at least aarch64 and arm).
>
> Does this need to be conditional on the POSIX version?
>
This is already done by features.h.
e.g.
#if (_POSIX_C_SOURCE - 0) >= 200809L
# define __USE_XOPEN2K8 1
# undef _ATFILE_SOURCE
# define _ATFILE_SOURCE 1
#endif
Which should define __USE_XOPEN2K8 as expected.
My worry is that you've changed the semantics since __USE_MISC
was previously used.
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH][BZ 18234] struct stat is not posix conform
2015-05-20 16:17 [PATCH][BZ 18234] struct stat is not posix conform Szabolcs Nagy
2015-05-20 16:24 ` Florian Weimer
@ 2015-05-20 17:55 ` Carlos O'Donell
2015-05-20 19:25 ` Joseph Myers
1 sibling, 1 reply; 11+ messages in thread
From: Carlos O'Donell @ 2015-05-20 17:55 UTC (permalink / raw)
To: Szabolcs Nagy, GNU C Library, Joseph S. Myers
Cc: Marcus Shawcroft, Ramana Radhakrishnan
On 05/20/2015 11:20 AM, Szabolcs Nagy wrote:
> the generic definition of struct stat on linux miss the
> st_atim, st_mtim and st_ctim members when _POSIX_C_SOURCE
> is defined (affects at least aarch64 and arm).
>
> i did not see regressions on aarch64.
>
> 2015-05-20 Szabolcs Nagy <szabolcs.nagy@arm.com>
>
> [BZ #18234]
> * sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat): Make
> st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8.
I like the idea of the change.
Firstly it needs a test case.
Secondly, it changes when these members are made available, and that
might break applications unless you show that __USE_MISC is a subset
of __USE_XOPEN2K8, which I don't think it is.
Therefore you will have to use "__USE_MISC || __USE_XOPEN2K8" preceeded
by a lengthy comment about the fact that in _DEFAULT_SOURCE you'll get
these members, but in strict compliance you need to have POSIX Issue 7.
Joseph, does that sound right to you?
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h
> index 42cb198..82e6b1d 100644
> --- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
> +++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
> @@ -66,7 +66,7 @@ struct stat
> __blksize_t st_blksize; /* Optimal block size for I/O. */
> int __pad2;
> __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */
> -#ifdef __USE_MISC
> +#ifdef __USE_XOPEN2K8
> /* Nanosecond resolution timestamps are stored in a format
> equivalent to 'struct timespec'. This is the type used
> whenever possible but the Unix namespace rules do not allow the
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH][BZ 18234] struct stat is not posix conform
2015-05-20 17:55 ` Carlos O'Donell
@ 2015-05-20 19:25 ` Joseph Myers
2015-05-20 21:55 ` Szabolcs Nagy
0 siblings, 1 reply; 11+ messages in thread
From: Joseph Myers @ 2015-05-20 19:25 UTC (permalink / raw)
To: Carlos O'Donell
Cc: Szabolcs Nagy, GNU C Library, Marcus Shawcroft, Ramana Radhakrishnan
On Wed, 20 May 2015, Carlos O'Donell wrote:
> On 05/20/2015 11:20 AM, Szabolcs Nagy wrote:
> > the generic definition of struct stat on linux miss the
> > st_atim, st_mtim and st_ctim members when _POSIX_C_SOURCE
> > is defined (affects at least aarch64 and arm).
> >
> > i did not see regressions on aarch64.
> >
> > 2015-05-20 Szabolcs Nagy <szabolcs.nagy@arm.com>
> >
> > [BZ #18234]
> > * sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat): Make
> > st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8.
>
> I like the idea of the change.
>
> Firstly it needs a test case.
I.e. adding
#if defined XOPEN2K8 || defined POSIX2008
element {struct stat} {struct timespec} st_atim
element {struct stat} {struct timespec} st_mtim
element {struct stat} {struct timespec} st_ctim
#endif
to conform/data/sys/stat.h-data (the conform/ data hasn't generally been
fully reviewed against current POSIX, hence such assertions being
missing).
> Secondly, it changes when these members are made available, and that
> might break applications unless you show that __USE_MISC is a subset
> of __USE_XOPEN2K8, which I don't think it is.
>
> Therefore you will have to use "__USE_MISC || __USE_XOPEN2K8" preceeded
> by a lengthy comment about the fact that in _DEFAULT_SOURCE you'll get
> these members, but in strict compliance you need to have POSIX Issue 7.
The API should be consistent across architectures.
Most widely-used cases use __USE_XOPEN2K8. The exceptions are: toplevel
bits/stat.h (not used in fact) doesn't have the timespec members;
sysdeps/nacl/bits/stat.h uses __USE_MISC || __USE_XOPEN2K8; as discussed,
linux/generic uses __USE_MISC; linux/ia64 uses __USE_MISC;
linux/microblaze uses __USE_MISC.
So, I think a change to use just __USE_XOPEN2K8 is most appropriate. This
would fix bugs with the elements not being made available when they should
be. The default API level includes __USE_XOPEN2K8. If __USE_MISC is
defined, so is __USE_XOPEN2K8: __USE_MISC is only defined when
_DEFAULT_SOURCE is defined (explicitly or implicitly), and _DEFAULT_SOURCE
implies __USE_XOPEN2K8. So __USE_MISC || __USE_XOPEN2K8 is entirely
redundant and means the same as __USE_XOPEN2K8.
Thus: fix nacl, linux/generic, linux/ia64 and linux/microblaze to use
__USE_XOPEN2K8 here (all in one patch, and the bug in Bugzilla might
reasonably be rescoped to cover all those cases).
linux/alpha does its own more complicated thing with a macro __ST_TIME; I
see no real reason for one architecture to do things differently from all
the test, but also no reason to change it for this bug since it's already
using __USE_XOPEN2K8.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH][BZ 18234] struct stat is not posix conform
2015-05-20 19:25 ` Joseph Myers
@ 2015-05-20 21:55 ` Szabolcs Nagy
2015-05-21 14:03 ` Siddhesh Poyarekar
0 siblings, 1 reply; 11+ messages in thread
From: Szabolcs Nagy @ 2015-05-20 21:55 UTC (permalink / raw)
To: Joseph Myers, Carlos O'Donell
Cc: GNU C Library, Marcus Shawcroft, Ramana Radhakrishnan
On 20/05/15 17:44, Joseph Myers wrote:
> Most widely-used cases use __USE_XOPEN2K8. The exceptions are: toplevel
> bits/stat.h (not used in fact) doesn't have the timespec members;
> sysdeps/nacl/bits/stat.h uses __USE_MISC || __USE_XOPEN2K8; as discussed,
> linux/generic uses __USE_MISC; linux/ia64 uses __USE_MISC;
> linux/microblaze uses __USE_MISC.
>
> So, I think a change to use just __USE_XOPEN2K8 is most appropriate. This
> would fix bugs with the elements not being made available when they should
> be. The default API level includes __USE_XOPEN2K8. If __USE_MISC is
> defined, so is __USE_XOPEN2K8: __USE_MISC is only defined when
> _DEFAULT_SOURCE is defined (explicitly or implicitly), and _DEFAULT_SOURCE
> implies __USE_XOPEN2K8. So __USE_MISC || __USE_XOPEN2K8 is entirely
> redundant and means the same as __USE_XOPEN2K8.
>
> Thus: fix nacl, linux/generic, linux/ia64 and linux/microblaze to use
> __USE_XOPEN2K8 here (all in one patch, and the bug in Bugzilla might
> reasonably be rescoped to cover all those cases).
>
ok,
i guess it's ok for consistency if i fix struct stat64
too to use __USE_XOPEN2K8.
i will run some tests and come back with a patch
> linux/alpha does its own more complicated thing with a macro __ST_TIME; I
> see no real reason for one architecture to do things differently from all
> the test, but also no reason to change it for this bug since it's already
> using __USE_XOPEN2K8.
>
> -- Joseph S. Myers joseph@codesourcery.com
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH][BZ 18234] struct stat is not posix conform
2015-05-20 21:55 ` Szabolcs Nagy
@ 2015-05-21 14:03 ` Siddhesh Poyarekar
2015-05-21 17:28 ` Szabolcs Nagy
0 siblings, 1 reply; 11+ messages in thread
From: Siddhesh Poyarekar @ 2015-05-21 14:03 UTC (permalink / raw)
To: Szabolcs Nagy
Cc: Joseph Myers, Carlos O'Donell, GNU C Library,
Marcus Shawcroft, Ramana Radhakrishnan
[-- Attachment #1: Type: text/plain, Size: 449 bytes --]
On Wed, May 20, 2015 at 06:55:02PM +0100, Szabolcs Nagy wrote:
> i guess it's ok for consistency if i fix struct stat64
> too to use __USE_XOPEN2K8.
>
> i will run some tests and come back with a patch
I also think it would be appropriate to change this code in other
architectures (microblaze and nacl IIRC) to make all of them
consistent. It is a mechanical enough change IMO that all arch
maintainer acks is not necessary.
Siddhesh
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH][BZ 18234] struct stat is not posix conform
2015-05-21 14:03 ` Siddhesh Poyarekar
@ 2015-05-21 17:28 ` Szabolcs Nagy
2015-05-21 17:39 ` Siddhesh Poyarekar
2015-05-21 21:17 ` Carlos O'Donell
0 siblings, 2 replies; 11+ messages in thread
From: Szabolcs Nagy @ 2015-05-21 17:28 UTC (permalink / raw)
To: Siddhesh Poyarekar
Cc: Joseph Myers, Carlos O'Donell, GNU C Library,
Marcus Shawcroft, Ramana Radhakrishnan
[-- Attachment #1: Type: text/plain, Size: 1159 bytes --]
On 21/05/15 05:29, Siddhesh Poyarekar wrote:
> On Wed, May 20, 2015 at 06:55:02PM +0100, Szabolcs Nagy wrote:
>> i guess it's ok for consistency if i fix struct stat64
>> too to use __USE_XOPEN2K8.
>>
>> i will run some tests and come back with a patch
>
> I also think it would be appropriate to change this code in other
> architectures (microblaze and nacl IIRC) to make all of them
> consistent. It is a mechanical enough change IMO that all arch
> maintainer acks is not necessary.
>
here is the patch with consistent __USE_XOPEN2K8
ok to commit?
2015-05-21 Szabolcs Nagy <szabolcs.nagy@arm.com>
[BZ #18234]
* conform/data/sys/stat.h-data (struct stat): Add tests for st_atim,
st_mtim and st_ctim members.
* sysdeps/nacl/bits/stat.h (struct stat, struct stat64): Make
st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8 only.
* sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat,):
(struct stat64): Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/stat.h (struct stat,):
(struct stat64): Likewise.
* sysdeps/unix/sysv/linux/microblaze/bits/stat.h (struct stat,):
(struct stat64): Likewise.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: stat2.diff --]
[-- Type: text/x-patch; name=stat2.diff, Size: 5232 bytes --]
diff --git a/conform/data/sys/stat.h-data b/conform/data/sys/stat.h-data
index 631daa4..f5b17a3 100644
--- a/conform/data/sys/stat.h-data
+++ b/conform/data/sys/stat.h-data
@@ -39,6 +39,11 @@ element {struct stat} off_t st_size
element {struct stat} time_t st_atime
element {struct stat} time_t st_mtime
element {struct stat} time_t st_ctime
+#if defined XOPEN2K8 || defined POSIX2008
+element {struct stat} {struct timespec} st_atim
+element {struct stat} {struct timespec} st_mtim
+element {struct stat} {struct timespec} st_ctim
+#endif
#if !defined POSIX && !defined POSIX2008
element {struct stat} blksize_t st_blksize
element {struct stat} blkcnt_t st_blocks
diff --git a/sysdeps/nacl/bits/stat.h b/sysdeps/nacl/bits/stat.h
index 0cd3500..9b89b15 100644
--- a/sysdeps/nacl/bits/stat.h
+++ b/sysdeps/nacl/bits/stat.h
@@ -42,7 +42,7 @@ struct stat
__off_t st_size; /* Size of file, in bytes. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-#if defined __USE_MISC || defined __USE_XOPEN2K8
+#if defined __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -81,7 +81,7 @@ struct stat64
__off_t st_size; /* Size of file, in bytes. */
__blksize_t st_blksize; /* Optimal block size for I/O. */
__blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-# if defined __USE_MISC || defined __USE_XOPEN2K8
+# if defined __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h
index 42cb198..4c32f66 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
@@ -66,7 +66,7 @@ struct stat
__blksize_t st_blksize; /* Optimal block size for I/O. */
int __pad2;
__field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */
-#ifdef __USE_MISC
+#ifdef __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -107,7 +107,7 @@ struct stat64
__blksize_t st_blksize; /* Optimal block size for I/O. */
int __pad2;
__blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#ifdef __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/stat.h b/sysdeps/unix/sysv/linux/ia64/bits/stat.h
index c14cd7b..ed79676 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/stat.h
@@ -41,7 +41,7 @@ struct stat
int pad0;
__dev_t st_rdev; /* Device number, if device. */
__off_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_MISC
+#ifdef __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
@@ -80,7 +80,7 @@ struct stat64
int pad0;
__dev_t st_rdev; /* Device number, if device. */
__off_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_MISC
+#ifdef __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
index d45b275..df2d306 100644
--- a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
@@ -50,7 +50,7 @@ struct stat
__blksize_t st_blksize; /* Optimal block size for I/O. */
int __pad3;
__blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#ifdef __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
* equivalent to 'struct timespec'. This is the type used
* whenever possible but the Unix namespace rules do not allow the
@@ -135,7 +135,7 @@ struct stat64
__blksize_t st_blksize; /* Optimal block size for I/O. */
int __pad3;
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
+#ifdef __USE_XOPEN2K8
/* Nanosecond resolution timestamps are stored in a format
* equivalent to 'struct timespec'. This is the type used
* whenever possible but the Unix namespace rules do not allow the
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH][BZ 18234] struct stat is not posix conform
2015-05-21 17:28 ` Szabolcs Nagy
@ 2015-05-21 17:39 ` Siddhesh Poyarekar
2015-05-22 14:22 ` Szabolcs Nagy
2015-05-21 21:17 ` Carlos O'Donell
1 sibling, 1 reply; 11+ messages in thread
From: Siddhesh Poyarekar @ 2015-05-21 17:39 UTC (permalink / raw)
To: Szabolcs Nagy
Cc: Joseph Myers, Carlos O'Donell, GNU C Library,
Marcus Shawcroft, Ramana Radhakrishnan
[-- Attachment #1: Type: text/plain, Size: 6931 bytes --]
On Thu, May 21, 2015 at 05:15:44PM +0100, Szabolcs Nagy wrote:
> On 21/05/15 05:29, Siddhesh Poyarekar wrote:
> > On Wed, May 20, 2015 at 06:55:02PM +0100, Szabolcs Nagy wrote:
> >> i guess it's ok for consistency if i fix struct stat64
> >> too to use __USE_XOPEN2K8.
> >>
> >> i will run some tests and come back with a patch
> >
> > I also think it would be appropriate to change this code in other
> > architectures (microblaze and nacl IIRC) to make all of them
> > consistent. It is a mechanical enough change IMO that all arch
> > maintainer acks is not necessary.
> >
>
> here is the patch with consistent __USE_XOPEN2K8
>
> ok to commit?
>
> 2015-05-21 Szabolcs Nagy <szabolcs.nagy@arm.com>
>
> [BZ #18234]
> * conform/data/sys/stat.h-data (struct stat): Add tests for st_atim,
> st_mtim and st_ctim members.
>
> * sysdeps/nacl/bits/stat.h (struct stat, struct stat64): Make
> st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8 only.
>
> * sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat,):
> (struct stat64): Likewise.
>
> * sysdeps/unix/sysv/linux/ia64/bits/stat.h (struct stat,):
> (struct stat64): Likewise.
>
> * sysdeps/unix/sysv/linux/microblaze/bits/stat.h (struct stat,):
> (struct stat64): Likewise.
The Changelog entry lines should not have the extra newlines. Looks
fine to me other than that. It doesn't look like you have commit
access, so I'll commit it tomorrow for you.
Siddhesh
> diff --git a/conform/data/sys/stat.h-data b/conform/data/sys/stat.h-data
> index 631daa4..f5b17a3 100644
> --- a/conform/data/sys/stat.h-data
> +++ b/conform/data/sys/stat.h-data
> @@ -39,6 +39,11 @@ element {struct stat} off_t st_size
> element {struct stat} time_t st_atime
> element {struct stat} time_t st_mtime
> element {struct stat} time_t st_ctime
> +#if defined XOPEN2K8 || defined POSIX2008
> +element {struct stat} {struct timespec} st_atim
> +element {struct stat} {struct timespec} st_mtim
> +element {struct stat} {struct timespec} st_ctim
> +#endif
> #if !defined POSIX && !defined POSIX2008
> element {struct stat} blksize_t st_blksize
> element {struct stat} blkcnt_t st_blocks
> diff --git a/sysdeps/nacl/bits/stat.h b/sysdeps/nacl/bits/stat.h
> index 0cd3500..9b89b15 100644
> --- a/sysdeps/nacl/bits/stat.h
> +++ b/sysdeps/nacl/bits/stat.h
> @@ -42,7 +42,7 @@ struct stat
> __off_t st_size; /* Size of file, in bytes. */
> __blksize_t st_blksize; /* Optimal block size for I/O. */
> __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
> -#if defined __USE_MISC || defined __USE_XOPEN2K8
> +#if defined __USE_XOPEN2K8
> /* Nanosecond resolution timestamps are stored in a format
> equivalent to 'struct timespec'. This is the type used
> whenever possible but the Unix namespace rules do not allow the
> @@ -81,7 +81,7 @@ struct stat64
> __off_t st_size; /* Size of file, in bytes. */
> __blksize_t st_blksize; /* Optimal block size for I/O. */
> __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
> -# if defined __USE_MISC || defined __USE_XOPEN2K8
> +# if defined __USE_XOPEN2K8
> /* Nanosecond resolution timestamps are stored in a format
> equivalent to 'struct timespec'. This is the type used
> whenever possible but the Unix namespace rules do not allow the
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h
> index 42cb198..4c32f66 100644
> --- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
> +++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
> @@ -66,7 +66,7 @@ struct stat
> __blksize_t st_blksize; /* Optimal block size for I/O. */
> int __pad2;
> __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */
> -#ifdef __USE_MISC
> +#ifdef __USE_XOPEN2K8
> /* Nanosecond resolution timestamps are stored in a format
> equivalent to 'struct timespec'. This is the type used
> whenever possible but the Unix namespace rules do not allow the
> @@ -107,7 +107,7 @@ struct stat64
> __blksize_t st_blksize; /* Optimal block size for I/O. */
> int __pad2;
> __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
> -#ifdef __USE_MISC
> +#ifdef __USE_XOPEN2K8
> /* Nanosecond resolution timestamps are stored in a format
> equivalent to 'struct timespec'. This is the type used
> whenever possible but the Unix namespace rules do not allow the
> diff --git a/sysdeps/unix/sysv/linux/ia64/bits/stat.h b/sysdeps/unix/sysv/linux/ia64/bits/stat.h
> index c14cd7b..ed79676 100644
> --- a/sysdeps/unix/sysv/linux/ia64/bits/stat.h
> +++ b/sysdeps/unix/sysv/linux/ia64/bits/stat.h
> @@ -41,7 +41,7 @@ struct stat
> int pad0;
> __dev_t st_rdev; /* Device number, if device. */
> __off_t st_size; /* Size of file, in bytes. */
> -#ifdef __USE_MISC
> +#ifdef __USE_XOPEN2K8
> /* Nanosecond resolution timestamps are stored in a format
> equivalent to 'struct timespec'. This is the type used
> whenever possible but the Unix namespace rules do not allow the
> @@ -80,7 +80,7 @@ struct stat64
> int pad0;
> __dev_t st_rdev; /* Device number, if device. */
> __off_t st_size; /* Size of file, in bytes. */
> -#ifdef __USE_MISC
> +#ifdef __USE_XOPEN2K8
> /* Nanosecond resolution timestamps are stored in a format
> equivalent to 'struct timespec'. This is the type used
> whenever possible but the Unix namespace rules do not allow the
> diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
> index d45b275..df2d306 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
> @@ -50,7 +50,7 @@ struct stat
> __blksize_t st_blksize; /* Optimal block size for I/O. */
> int __pad3;
> __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
> -#ifdef __USE_MISC
> +#ifdef __USE_XOPEN2K8
> /* Nanosecond resolution timestamps are stored in a format
> * equivalent to 'struct timespec'. This is the type used
> * whenever possible but the Unix namespace rules do not allow the
> @@ -135,7 +135,7 @@ struct stat64
> __blksize_t st_blksize; /* Optimal block size for I/O. */
> int __pad3;
> __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
> -#ifdef __USE_MISC
> +#ifdef __USE_XOPEN2K8
> /* Nanosecond resolution timestamps are stored in a format
> * equivalent to 'struct timespec'. This is the type used
> * whenever possible but the Unix namespace rules do not allow the
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH][BZ 18234] struct stat is not posix conform
2015-05-21 17:28 ` Szabolcs Nagy
2015-05-21 17:39 ` Siddhesh Poyarekar
@ 2015-05-21 21:17 ` Carlos O'Donell
1 sibling, 0 replies; 11+ messages in thread
From: Carlos O'Donell @ 2015-05-21 21:17 UTC (permalink / raw)
To: Szabolcs Nagy, Siddhesh Poyarekar
Cc: Joseph Myers, GNU C Library, Marcus Shawcroft, Ramana Radhakrishnan
On 05/21/2015 12:15 PM, Szabolcs Nagy wrote:
> On 21/05/15 05:29, Siddhesh Poyarekar wrote:
>> On Wed, May 20, 2015 at 06:55:02PM +0100, Szabolcs Nagy wrote:
>>> i guess it's ok for consistency if i fix struct stat64
>>> too to use __USE_XOPEN2K8.
>>>
>>> i will run some tests and come back with a patch
>>
>> I also think it would be appropriate to change this code in other
>> architectures (microblaze and nacl IIRC) to make all of them
>> consistent. It is a mechanical enough change IMO that all arch
>> maintainer acks is not necessary.
>>
>
> here is the patch with consistent __USE_XOPEN2K8
>
> ok to commit?
>
> 2015-05-21 Szabolcs Nagy <szabolcs.nagy@arm.com>
>
> [BZ #18234]
> * conform/data/sys/stat.h-data (struct stat): Add tests for st_atim,
> st_mtim and st_ctim members.
>
> * sysdeps/nacl/bits/stat.h (struct stat, struct stat64): Make
> st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8 only.
>
> * sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat,):
> (struct stat64): Likewise.
>
> * sysdeps/unix/sysv/linux/ia64/bits/stat.h (struct stat,):
> (struct stat64): Likewise.
>
> * sysdeps/unix/sysv/linux/microblaze/bits/stat.h (struct stat,):
> (struct stat64): Likewise.
>
Modulo the ChangeLog problem pointed out by Siddhesh this also looks good to me.
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH][BZ 18234] struct stat is not posix conform
2015-05-21 17:39 ` Siddhesh Poyarekar
@ 2015-05-22 14:22 ` Szabolcs Nagy
0 siblings, 0 replies; 11+ messages in thread
From: Szabolcs Nagy @ 2015-05-22 14:22 UTC (permalink / raw)
To: Siddhesh Poyarekar
Cc: Joseph Myers, Carlos O'Donell, GNU C Library,
Marcus Shawcroft, Ramana Radhakrishnan
On 21/05/15 17:23, Siddhesh Poyarekar wrote:
> On Thu, May 21, 2015 at 05:15:44PM +0100, Szabolcs Nagy wrote:
>> here is the patch with consistent __USE_XOPEN2K8
>>
>> ok to commit?
>>
>> 2015-05-21 Szabolcs Nagy <szabolcs.nagy@arm.com>
>>
>> [BZ #18234]
>> * conform/data/sys/stat.h-data (struct stat): Add tests for st_atim,
>> st_mtim and st_ctim members.
>>
>> * sysdeps/nacl/bits/stat.h (struct stat, struct stat64): Make
>> st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8 only.
>>
>> * sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat,):
>> (struct stat64): Likewise.
>>
>> * sysdeps/unix/sysv/linux/ia64/bits/stat.h (struct stat,):
>> (struct stat64): Likewise.
>>
>> * sysdeps/unix/sysv/linux/microblaze/bits/stat.h (struct stat,):
>> (struct stat64): Likewise.
>
> The Changelog entry lines should not have the extra newlines. Looks
> fine to me other than that. It doesn't look like you have commit
> access, so I'll commit it tomorrow for you.
>
thanks, that would be nice.
changelog, without empty lines:
2015-05-22 Szabolcs Nagy <szabolcs.nagy@arm.com>
[BZ #18234]
* conform/data/sys/stat.h-data (struct stat): Add tests for st_atim,
st_mtim and st_ctim members.
* sysdeps/nacl/bits/stat.h (struct stat, struct stat64): Make
st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8 only.
* sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat,):
(struct stat64): Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/stat.h (struct stat,):
(struct stat64): Likewise.
* sysdeps/unix/sysv/linux/microblaze/bits/stat.h (struct stat,):
(struct stat64): Likewise.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-05-22 9:24 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20 16:17 [PATCH][BZ 18234] struct stat is not posix conform Szabolcs Nagy
2015-05-20 16:24 ` Florian Weimer
2015-05-20 16:54 ` Carlos O'Donell
2015-05-20 17:55 ` Carlos O'Donell
2015-05-20 19:25 ` Joseph Myers
2015-05-20 21:55 ` Szabolcs Nagy
2015-05-21 14:03 ` Siddhesh Poyarekar
2015-05-21 17:28 ` Szabolcs Nagy
2015-05-21 17:39 ` Siddhesh Poyarekar
2015-05-22 14:22 ` Szabolcs Nagy
2015-05-21 21:17 ` Carlos O'Donell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).