Bug#962676: libzstd FTBFS for alpha: libc doesn't #define st_mtime

Helmut Grohne <[email protected]>
Newsgroups gmane.linux.debian.ports.alpha
Message-ID <20200611193805.GA9267__16132.8469913983$1591908144$gmane$org@alf.mars>
Source: libzstd
Version: 1.4.5+dfsg-1
Tags: ftbfs patch
User: [email protected]
Usertags: rebootstrap

libzstd fails to build from source on alpha. programs/util.c has code
that checks whether st_mtime is defined as a macro. If yes, it uses a
struct timespec. Otherwise a struct utimebuf. alpha is the only Debian
architecture that does not define st_mtime (while still providing the
field). The code in libzstd selects the struct utimebuf path and fails,
because that isn't declared.

I don't think that st_mtime is guaranteed to be a macro anywhere.
Therefore libzstd should cope with it not being one. The attached patch
achieves that by special casing alpha. Do you have any better ideas?

Helmut
alpha.patch (text/x-diff, 772 B)
--- libzstd-1.4.5+dfsg.orig/programs/util.c
+++ libzstd-1.4.5+dfsg/programs/util.c
@@ -148,8 +148,10 @@
     /* We check that st_mtime is a macro here in order to give us confidence
      * that struct stat has a struct timespec st_mtim member. We need this
      * check because there are some platforms that claim to be POSIX 2008
-     * compliant but which do not have st_mtim... */
-#if (PLATFORM_POSIX_VERSION >= 200809L) && defined(st_mtime)
+     * compliant but which do not have st_mtim...
+     * And then there is alpha, which doesn't define st_mtime, but still has it.
+     */
+#if (PLATFORM_POSIX_VERSION >= 200809L) && (defined(st_mtime) || defined(__alpha__))
     {
         /* (atime, mtime) */
         struct timespec timebuf[2] = { {0, UTIME_NOW} };
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.