This is the mail archive of the libc-alpha@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]

[PATCH RESEND] zic, various tests: use LFS I/O functions explicitly where needed


From: Nick Alcock <nick.alcock@oracle.com>

This fixes this compilation failure when testing a 32-bit glibc on a
system using a 64-bit-inode XFS filesystem, and a variety of related
test failures of dirent/list, io/bug-ftw2, and posix/tst-regex:

env GCONV_PATH=/usr/src/glibc/i686-loom/iconvdata LOCPATH=/usr/src/glibc/i686-loom/localedata LC_ALL=C  /usr/src/glibc/i686-loom/elf/ld-linux.so.2 --library-path /usr/src/glibc/i686-loom:/usr/src/glibc/i686-loom/math:/usr/src/glibc/i686-loom/elf:/usr/src/glibc/i686-loom/dlfcn:/usr/src/glibc/i686-loom/nss:/usr/src/glibc/i686-loom/nis:/usr/src/glibc/i686-loom/rt:/usr/src/glibc/i686-loom/resolv:/usr/src/glibc/i686-loom/crypt:/usr/src/glibc/i686-loom/mathvec:/usr/src/glibc/i686-loom/support:/usr/src/glibc/i686-loom/nptl /usr/src/glibc/i686-loom/timezone/zic -d /usr/src/glibc/i686-loom/timezone/testdata -y ./yearistype australasia; ../scripts/evaluate-test.sh timezone/testdata/Australia/Melbourne $? false false > /usr/src/glibc/i686-loom/timezone/testdata/Australia/Melbourne.test-result
warning: "etcetera", line 13: /usr/src/glibc/i686-loom/timezone/zic: Can't create directory /usr/src: File exists
/bin/sh: /usr/src/glibc/i686-loom/timezone/testdata/Etc/UTC.test-result: No such file or directory
make[2]: *** [Makefile:98: /usr/src/glibc/i686-loom/timezone/testdata/Etc/UTC] Error 1

This happens because itsdir() in timezone/zic.c does a stat() of each
element of the path in turn, and this returns -EOVERFLOW because on this
system /usr has an inode number of 7516193792 and we did not compile zic
with -D_FILE_OFFSET_BITS=64 or use stat64().  So do the latter, as other
tools in glibc do.

We have to do similar things to fix the other test failures (though they
only appear at test-runtime, so do not cause make check to abort).

This at least allows a 32-bit libc on a 64-bit-inode fs to pass make
check for me. It may well not be the minimum required for successful
operations, though nothing else in glibc's tools is obviously
troublesome that I can see. (There is one test that calls ftw ("/")
which is unlikely to have an inode number > 2^32 on any current
filesystem, and one that calls it on a directory under /tmp which I
cannot easily test a fix for because my /tmp is a tmpfs with 32-bit
inodes. I can fix these two as well if you like, though.)

	* timezone/zic.c (itsdir): Use stat64.
	* posix/tst-regex.c (do_test): Use fstat64.
	* dirent/list.c (list): Use dirent64/readdir64.
	* io/bug-ftw.c (main): Use ftw64.

diff --git a/dirent/list.c b/dirent/list.c
index e99b253808..f792084243 100644
--- a/dirent/list.c
+++ b/dirent/list.c
@@ -26,7 +26,7 @@ static int
 test (const char *name)
 {
   DIR *dirp;
-  struct dirent *entp;
+  struct dirent64 *entp;
   int retval = 0;
 
   puts (name);
@@ -39,7 +39,7 @@ test (const char *name)
     }
 
   errno = 0;
-  while ((entp = readdir (dirp)) != NULL)
+  while ((entp = readdir64 (dirp)) != NULL)
     printf ("%s\tfile number %lu\n",
 	    entp->d_name, (unsigned long int) entp->d_fileno);
 
diff --git a/io/bug-ftw2.c b/io/bug-ftw2.c
index ce8823d28e..d6cc6a160d 100644
--- a/io/bug-ftw2.c
+++ b/io/bug-ftw2.c
@@ -69,7 +69,7 @@ main (void)
 {
   mtrace ();
 
-  ftw (".", callback, 10);
+  ftw64 (".", callback, 10);
 
   if (! sawcur)
     {
diff --git a/posix/tst-regex.c b/posix/tst-regex.c
index df2c108be5..ab9a854d98 100644
--- a/posix/tst-regex.c
+++ b/posix/tst-regex.c
@@ -57,7 +57,7 @@ do_test (void)
 {
   const char *file;
   int fd;
-  struct stat st;
+  struct stat64 st;
   int result;
   char *inmem;
   char *outmem;
@@ -72,7 +72,7 @@ do_test (void)
   if (fd == -1)
     error (EXIT_FAILURE, errno, "cannot open %s", basename (file));
 
-  if (fstat (fd, &st) != 0)
+  if (fstat64 (fd, &st) != 0)
     error (EXIT_FAILURE, errno, "cannot stat %s", basename (file));
   memlen = st.st_size;
 
diff --git a/timezone/zic.c b/timezone/zic.c
index 068fb43318..ae3e8dc041 100644
--- a/timezone/zic.c
+++ b/timezone/zic.c
@@ -950,8 +950,8 @@ static const zic_t early_time = (WORK_AROUND_GNOME_BUG_730332
 static bool
 itsdir(char const *name)
 {
-	struct stat st;
-	int res = stat(name, &st);
+	struct stat64 st;
+	int res = stat64(name, &st);
 #ifdef S_ISDIR
 	if (res == 0)
 		return S_ISDIR(st.st_mode) != 0;


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