From patchwork Sun Jun 25 21:17:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nix X-Patchwork-Id: 21258 Received: (qmail 129794 invoked by alias); 25 Jun 2017 21:18:08 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 129764 invoked by uid 89); 25 Jun 2017 21:18:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=RESEND, nis, Etc, unlikely X-HELO: aserp1040.oracle.com From: Nick Alcock To: libc-alpha@sourceware.org Subject: [PATCH RESEND] zic, various tests: use LFS I/O functions explicitly where needed Date: Sun, 25 Jun 2017 22:17:59 +0100 Message-ID: <87zicvkbqw.fsf@esperi.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 From: Nick Alcock 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;