public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] support: use 64-bit time_t (bug 30111)
@ 2023-02-23 15:55 Andreas Schwab
  2023-02-23 16:17 ` Adhemerval Zanella Netto
  2023-02-23 16:30 ` Adhemerval Zanella Netto
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Schwab @ 2023-02-23 15:55 UTC (permalink / raw)
  To: libc-alpha

Ensure to use 64-bit time_t in the test infrastructure.
---
 support/Makefile                            | 10 ++++++++++
 support/support_can_chroot.c                |  4 ++--
 support/support_copy_file.c                 |  2 +-
 support/support_descriptor_supports_holes.c |  2 +-
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/support/Makefile b/support/Makefile
index b29b7eb505..1df57d10fc 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -238,6 +238,16 @@ CFLAGS-support_paths.c = \
 CFLAGS-timespec.c += -fexcess-precision=standard
 CFLAGS-timespec-time64.c += -fexcess-precision=standard
 
+# Ensure that general support files use 64-bit time_t
+CFLAGS-support_can_chroot.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
+CFLAGS-support_copy_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
+CFLAGS-support_copy_file_range.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
+CFLAGS-support_descriptor_supports_holes.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
+CFLAGS-support_descriptors.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
+CFLAGS-support_stat_nanoseconds.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
+CFLAGS-support_test_main.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
+CFLAGS-test-container.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
+
 ifeq (,$(CXX))
 LINKS_DSO_PROGRAM = links-dso-program-c
 else
diff --git a/support/support_can_chroot.c b/support/support_can_chroot.c
index 7d9f91205d..7b4f491b53 100644
--- a/support/support_can_chroot.c
+++ b/support/support_can_chroot.c
@@ -29,14 +29,14 @@ static void
 callback (void *closure)
 {
   int *result = closure;
-  struct stat64 before;
+  struct stat before;
   xstat ("/dev", &before);
   if (chroot ("/dev") != 0)
     {
       *result = errno;
       return;
     }
-  struct stat64 after;
+  struct stat after;
   xstat ("/", &after);
   TEST_VERIFY (before.st_dev == after.st_dev);
   TEST_VERIFY (before.st_ino == after.st_ino);
diff --git a/support/support_copy_file.c b/support/support_copy_file.c
index 50ff87b9f1..f3e0a2d1b7 100644
--- a/support/support_copy_file.c
+++ b/support/support_copy_file.c
@@ -24,7 +24,7 @@
 void
 support_copy_file (const char *from, const char *to)
 {
-  struct stat64 st;
+  struct stat st;
   xstat (from, &st);
   int fd_from = xopen (from, O_RDONLY, 0);
   mode_t mode = st.st_mode & 0777;
diff --git a/support/support_descriptor_supports_holes.c b/support/support_descriptor_supports_holes.c
index 7af5934808..91db216bf0 100644
--- a/support/support_descriptor_supports_holes.c
+++ b/support/support_descriptor_supports_holes.c
@@ -40,7 +40,7 @@ support_descriptor_supports_holes (int fd)
       block_headroom = 32,
     };
 
-  struct stat64 st;
+  struct stat st;
   xfstat (fd, &st);
   if (!S_ISREG (st.st_mode))
     FAIL_EXIT1 ("descriptor %d does not refer to a regular file", fd);
-- 
2.39.1


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] support: use 64-bit time_t (bug 30111)
  2023-02-23 15:55 [PATCH] support: use 64-bit time_t (bug 30111) Andreas Schwab
@ 2023-02-23 16:17 ` Adhemerval Zanella Netto
  2023-02-23 16:30 ` Adhemerval Zanella Netto
  1 sibling, 0 replies; 3+ messages in thread
From: Adhemerval Zanella Netto @ 2023-02-23 16:17 UTC (permalink / raw)
  To: Andreas Schwab, libc-alpha



On 23/02/23 12:55, Andreas Schwab via Libc-alpha wrote:
> Ensure to use 64-bit time_t in the test infrastructure.

I sent a similar patchset some weeks ago [1].  It misses 
support_copy_file.c and support_descriptor_supports_holes.c, I can update
it to cover it as well.

[1] https://patchwork.sourceware.org/project/glibc/list/?series=17127

> ---
>  support/Makefile                            | 10 ++++++++++
>  support/support_can_chroot.c                |  4 ++--
>  support/support_copy_file.c                 |  2 +-
>  support/support_descriptor_supports_holes.c |  2 +-
>  4 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/support/Makefile b/support/Makefile
> index b29b7eb505..1df57d10fc 100644
> --- a/support/Makefile
> +++ b/support/Makefile
> @@ -238,6 +238,16 @@ CFLAGS-support_paths.c = \
>  CFLAGS-timespec.c += -fexcess-precision=standard
>  CFLAGS-timespec-time64.c += -fexcess-precision=standard
>  
> +# Ensure that general support files use 64-bit time_t
> +CFLAGS-support_can_chroot.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_copy_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_copy_file_range.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_descriptor_supports_holes.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_descriptors.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_stat_nanoseconds.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_test_main.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-test-container.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +
>  ifeq (,$(CXX))
>  LINKS_DSO_PROGRAM = links-dso-program-c
>  else
> diff --git a/support/support_can_chroot.c b/support/support_can_chroot.c
> index 7d9f91205d..7b4f491b53 100644
> --- a/support/support_can_chroot.c
> +++ b/support/support_can_chroot.c
> @@ -29,14 +29,14 @@ static void
>  callback (void *closure)
>  {
>    int *result = closure;
> -  struct stat64 before;
> +  struct stat before;
>    xstat ("/dev", &before);
>    if (chroot ("/dev") != 0)
>      {
>        *result = errno;
>        return;
>      }
> -  struct stat64 after;
> +  struct stat after;
>    xstat ("/", &after);
>    TEST_VERIFY (before.st_dev == after.st_dev);
>    TEST_VERIFY (before.st_ino == after.st_ino);
> diff --git a/support/support_copy_file.c b/support/support_copy_file.c
> index 50ff87b9f1..f3e0a2d1b7 100644
> --- a/support/support_copy_file.c
> +++ b/support/support_copy_file.c
> @@ -24,7 +24,7 @@
>  void
>  support_copy_file (const char *from, const char *to)
>  {
> -  struct stat64 st;
> +  struct stat st;
>    xstat (from, &st);
>    int fd_from = xopen (from, O_RDONLY, 0);
>    mode_t mode = st.st_mode & 0777;
> diff --git a/support/support_descriptor_supports_holes.c b/support/support_descriptor_supports_holes.c
> index 7af5934808..91db216bf0 100644
> --- a/support/support_descriptor_supports_holes.c
> +++ b/support/support_descriptor_supports_holes.c
> @@ -40,7 +40,7 @@ support_descriptor_supports_holes (int fd)
>        block_headroom = 32,
>      };
>  
> -  struct stat64 st;
> +  struct stat st;
>    xfstat (fd, &st);
>    if (!S_ISREG (st.st_mode))
>      FAIL_EXIT1 ("descriptor %d does not refer to a regular file", fd);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] support: use 64-bit time_t (bug 30111)
  2023-02-23 15:55 [PATCH] support: use 64-bit time_t (bug 30111) Andreas Schwab
  2023-02-23 16:17 ` Adhemerval Zanella Netto
@ 2023-02-23 16:30 ` Adhemerval Zanella Netto
  1 sibling, 0 replies; 3+ messages in thread
From: Adhemerval Zanella Netto @ 2023-02-23 16:30 UTC (permalink / raw)
  To: libc-alpha, Andreas Schwab



On 23/02/23 12:55, Andreas Schwab via Libc-alpha wrote:
> Ensure to use 64-bit time_t in the test infrastructure.
> ---
>  support/Makefile                            | 10 ++++++++++
>  support/support_can_chroot.c                |  4 ++--
>  support/support_copy_file.c                 |  2 +-
>  support/support_descriptor_supports_holes.c |  2 +-
>  4 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/support/Makefile b/support/Makefile
> index b29b7eb505..1df57d10fc 100644
> --- a/support/Makefile
> +++ b/support/Makefile
> @@ -238,6 +238,16 @@ CFLAGS-support_paths.c = \
>  CFLAGS-timespec.c += -fexcess-precision=standard
>  CFLAGS-timespec-time64.c += -fexcess-precision=standard
>  
> +# Ensure that general support files use 64-bit time_t
> +CFLAGS-support_can_chroot.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_copy_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_copy_file_range.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_descriptor_supports_holes.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_descriptors.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_stat_nanoseconds.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-support_test_main.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
> +CFLAGS-test-container.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64

The shell-container.c should also use 64 bit time_t, although it already
defines _FILE_OFFSET_BITS=64.  I recommend to remove from .c file and
move it to Makefile.

The xmkdirp.c also uses stat; and the delayed_exit.c, support_subprocess.c, 
and support_process_state.c also uses nanosleep.  I would recommend to cover 
these as well.

The rest looks ok.


> +
>  ifeq (,$(CXX))
>  LINKS_DSO_PROGRAM = links-dso-program-c
>  else
> diff --git a/support/support_can_chroot.c b/support/support_can_chroot.c
> index 7d9f91205d..7b4f491b53 100644
> --- a/support/support_can_chroot.c
> +++ b/support/support_can_chroot.c
> @@ -29,14 +29,14 @@ static void
>  callback (void *closure)
>  {
>    int *result = closure;
> -  struct stat64 before;
> +  struct stat before;
>    xstat ("/dev", &before);
>    if (chroot ("/dev") != 0)
>      {
>        *result = errno;
>        return;
>      }
> -  struct stat64 after;
> +  struct stat after;
>    xstat ("/", &after);
>    TEST_VERIFY (before.st_dev == after.st_dev);
>    TEST_VERIFY (before.st_ino == after.st_ino);
> diff --git a/support/support_copy_file.c b/support/support_copy_file.c
> index 50ff87b9f1..f3e0a2d1b7 100644
> --- a/support/support_copy_file.c
> +++ b/support/support_copy_file.c
> @@ -24,7 +24,7 @@
>  void
>  support_copy_file (const char *from, const char *to)
>  {
> -  struct stat64 st;
> +  struct stat st;
>    xstat (from, &st);
>    int fd_from = xopen (from, O_RDONLY, 0);
>    mode_t mode = st.st_mode & 0777;
> diff --git a/support/support_descriptor_supports_holes.c b/support/support_descriptor_supports_holes.c
> index 7af5934808..91db216bf0 100644
> --- a/support/support_descriptor_supports_holes.c
> +++ b/support/support_descriptor_supports_holes.c
> @@ -40,7 +40,7 @@ support_descriptor_supports_holes (int fd)
>        block_headroom = 32,
>      };
>  
> -  struct stat64 st;
> +  struct stat st;
>    xfstat (fd, &st);
>    if (!S_ISREG (st.st_mode))
>      FAIL_EXIT1 ("descriptor %d does not refer to a regular file", fd);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-23 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-23 15:55 [PATCH] support: use 64-bit time_t (bug 30111) Andreas Schwab
2023-02-23 16:17 ` Adhemerval Zanella Netto
2023-02-23 16:30 ` Adhemerval Zanella Netto

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).