bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

test-utimensat failure on Linux/hppa


From: Bruno Haible
Subject: test-utimensat failure on Linux/hppa
Date: Sat, 1 Oct 2011 10:33:01 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Hi Eric,

On a Linux/hppa machine I'm seeing this test failure:

  test-utimens.h:73: assertion failed
  FAIL: test-utimensat

and then when this is fixed:

  test-utimens.h:79: assertion failed

But POSIX:2008 really wants an EINVAL failure for invalid tv_nsec values[1].

On this platform, the wrapper in gnulib/lib/utimensat.c is enabled, and
utimensat_works_really gets set to 1.

This patch fixes it for me. OK to commit?

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/utimensat.html


2011-10-01  Bruno Haible  <address@hidden>

        utimensat: Work around problem on Linux/hppa.
        * lib/utimensat.c (rpl_utimensat) [Linux/hppa]: Reject invalid tv_nsec 
values.
        * doc/posix-functions/utimensat.texi: Mention the problem on Linux/hppa.

--- doc/posix-functions/utimensat.texi.orig     Sat Oct  1 10:26:32 2011
+++ doc/posix-functions/utimensat.texi  Sat Oct  1 10:26:26 2011
@@ -34,6 +34,10 @@
 When using @code{UTIME_OMIT} for the modification time, but specifying
 an access time, some systems fail to update the change time:
 Linux kernel 2.6.32.
address@hidden
+Out-of-range values of @code{tv_nsec} do not lead to a failure on some
+platforms:
+Linux kernel 2.6.22.19 on hppa.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- lib/utimensat.c.orig        Sat Oct  1 10:26:32 2011
+++ lib/utimensat.c     Sat Oct  1 10:22:24 2011
@@ -84,6 +84,21 @@
             ts[1] = times[1];
           times = ts;
         }
+#  ifdef __hppa__
+      /* Linux kernel 2.6.22.19 on hppa does not reject invalid tv_nsec
+         values.  */
+      else if (times
+               && ((times[0].tv_nsec != UTIME_NOW
+                    && (times[0].tv_nsec < 0
+                        || times[0].tv_nsec >= 1000000000))
+                   || (times[1].tv_nsec != UTIME_NOW
+                       && (times[1].tv_nsec < 0
+                           || times[1].tv_nsec >= 1000000000))))
+        {
+          errno = EINVAL;
+          return -1;
+        }
+#  endif
 # endif /* __linux__ */
       result = utimensat (fd, file, times, flag);
       /* Linux kernel 2.6.25 has a bug where it returns EINVAL for


-- 
In memoriam Max Ehrlich <http://en.wikipedia.org/wiki/Max_Ehrlich>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]