From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 808E620248 for ; Sat, 23 Mar 2019 20:40:46 +0000 (UTC) Received: from localhost ([127.0.0.1]:47857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7nRd-0005FH-Fy for normalperson@yhbt.net; Sat, 23 Mar 2019 16:40:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7nRZ-0005F0-79 for bug-gnulib@gnu.org; Sat, 23 Mar 2019 16:40:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h7nRY-0007vE-0V for bug-gnulib@gnu.org; Sat, 23 Mar 2019 16:40:41 -0400 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::9]:16123) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h7nRX-0007uF-6L for bug-gnulib@gnu.org; Sat, 23 Mar 2019 16:40:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1553373636; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=oofkZwsKbWL1AjaUYFK88McgexPLAur4a1NPN9n5unE=; b=oC/+djragq3hfX5Xup1aS9UO5jxkq6jVexr5wFleJKUjyVmUrw3/wW88maRXYOCc1n 2VD+/wrR7g/EXW0fsHqcWNt03tE4CvTOnhSjdjhDRm9IYR/Yk8csw6k8xQBQMINVfhWB SuvpAo/gu3cSd6yvUXekLghCke6FPkwR7BCaSG+x2dyLpcmyrcKmTpzQU1epdJbgNWY9 Nm+HGcpI8VZFvg3n80KoMVTkMataF01hL6APoCo18pwBEjcE565T7MzPPRgEVOQVLjwd /RvCT+7Vls5GeUbU7X2tTfE7CYQy8B3f6Xjvuq2GiKRB3ym7mJj7hB+/MVSdCqSYfRyg ySuQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOGKf3zZFW" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 44.16 DYNA|AUTH) with ESMTPSA id 5094e6v2NKeXnrl (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 23 Mar 2019 21:40:33 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org, Rich Felker Subject: futimens on musl libc Date: Sat, 23 Mar 2019 21:40:33 +0100 Message-ID: <4061903.SY8uJAIc8I@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::9 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" The gnulib configure test in m4/futimens.m4, when run on Alpine Linux 3.7, determines that the errno value is not as expected for a wrong fd. Let me document this in gnulib and update the cross-compilation guess accordingly. Rich, FYI: The test program is this one: #include #include #include #include #include int main () { struct timespec ts[2]; int fd = creat ("conftest.file", 0600); struct stat st; if (fd < 0) return 1; ts[0].tv_sec = 1; ts[0].tv_nsec = UTIME_OMIT; ts[1].tv_sec = 1; ts[1].tv_nsec = UTIME_NOW; errno = 0; if (futimens (AT_FDCWD, NULL) == 0) return 2; if (errno != EBADF) return 3; /* <== It fails here */ if (futimens (fd, ts)) return 4; sleep (1); ts[0].tv_nsec = UTIME_NOW; ts[1].tv_nsec = UTIME_OMIT; if (futimens (fd, ts)) return 5; if (fstat (fd, &st)) return 6; if (st.st_ctime < st.st_atime) return 7; return 0; } 2019-03-23 Bruno Haible futimens: Document musl libc bug. * doc/posix-functions/futimens.texi: Mention the bug. * m4/futimens.m4 (gl_FUNC_FUTIMENS): Require AC_CANONICAL_HOST. When cross-compiling guess no on glibc and musl systems. diff --git a/doc/posix-functions/futimens.texi b/doc/posix-functions/futimens.texi index 19fb84e..1e1c76c 100644 --- a/doc/posix-functions/futimens.texi +++ b/doc/posix-functions/futimens.texi @@ -29,7 +29,7 @@ Linux kernel 2.6.32, Solaris 11.1. @item Passing @code{AT_FDCWD} as the fd argument does not properly fail with @code{EBADF} on some systems: -glibc 2.11, Solaris 11. +glibc 2.11, musl libc, Solaris 11. @end itemize Portability problems not fixed by Gnulib: diff --git a/m4/futimens.m4 b/m4/futimens.m4 index 3cfa4a1..b5f4be9 100644 --- a/m4/futimens.m4 +++ b/m4/futimens.m4 @@ -1,4 +1,4 @@ -# serial 7 +# serial 8 # See if we need to provide futimens replacement. dnl Copyright (C) 2009-2019 Free Software Foundation, Inc. @@ -11,6 +11,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FUTIMENS], [ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_FUNCS_ONCE([futimens]) if test $ac_cv_func_futimens = no; then @@ -44,10 +45,21 @@ AC_DEFUN([gl_FUNC_FUTIMENS], ]])], [gl_cv_func_futimens_works=yes], [gl_cv_func_futimens_works=no], - [gl_cv_func_futimens_works="guessing yes"]) + [case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_func_futimens_works="guessing no" ;; + # Guess no on musl systems. + *-musl*) gl_cv_func_futimens_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_futimens_works="guessing yes" ;; + esac + ]) rm -f conftest.file]) - if test "$gl_cv_func_futimens_works" = no; then - REPLACE_FUTIMENS=1 - fi + case "$gl_cv_func_futimens_works" in + *yes) ;; + *) + REPLACE_FUTIMENS=1 + ;; + esac fi ])