Bug #19034
closedRuby 3.2.0 build failure on macOS 10.12.6, which does not have utimensat
Description
Ruby 3.2.0 does not build on macOS 10.12.6 due to the lack of utimensat() on that system. I have opened a pull request on GitHub.
Updated by nobu (Nobuyoshi Nakada) over 2 years ago
This seems unmatched #if
/#endif
.
commit b893b976c820f1f3c9ddfe26d1b84d2aefd5464f
Author: David Bohman <debohman@gmail.com>
AuthorDate: 2022-10-02 09:40:48 +0900
Commit: David Bohman <debohman@gmail.com>
CommitDate: 2022-10-02 09:40:48 +0900
File build failure on macOS 10.12.6, which does not have utimensat.
diff --git a/file.c b/file.c
index 709c33cca7c..7815de53409 100644
--- a/file.c
+++ b/file.c
@@ -2876,6 +2876,7 @@ utime_failed(struct apply_arg *aa)
# if defined(__APPLE__) && \
(!defined(MAC_OS_X_VERSION_13_0) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_13_0))
+# if defined(HAVE_UTIMENSAT)
# if defined(__has_attribute) && __has_attribute(availability)
typedef int utimensat_func(int, const char *, const struct timespec [2], int);
@@ -2887,6 +2888,7 @@ rb_utimensat(void)
return &utimensat;
}
RBIMPL_WARNING_POP()
+# endif
# define utimensat rb_utimensat()
# else /* __API_AVAILABLE macro does nothing on gcc */
Does this work?
diff --git a/file.c b/file.c
index 709c33cca7c..6d248afc39b 100644
--- a/file.c
+++ b/file.c
@@ -2873,7 +2873,9 @@ utime_failed(struct apply_arg *aa)
#if defined(HAVE_UTIMES)
-# if defined(__APPLE__) && \
+# if !defined(HAVE_UTIMENSAT)
+/* utimensat() is not found, runtime check is not needed */
+# elif defined(__APPLE__) && \
(!defined(MAC_OS_X_VERSION_13_0) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_13_0))
# if defined(__has_attribute) && __has_attribute(availability)
Updated by debo (David Bohman) over 2 years ago
You are correct. Sorry about that. Your fix is superior. It builds and works for me.
Will you be making that change?
Updated by hsbt (Hiroshi SHIBATA) over 2 years ago
macOS 10.12.6 is already EOL by Apple. Should we support this version?
Updated by debo (David Bohman) over 2 years ago
Does that matter? This is a regression from 3.1, and the fix is trivial.
Updated by hsbt (Hiroshi SHIBATA) over 2 years ago
In 2021 the release year of Ruby 3.1, macOS 10.12 is already EOL. We don't have macOS 10.12 for testing.
I wonder why you say this as "regression" with non-supported platform/versions. I don't have any strong opinion; this is totally maintainer's conveniences.
Updated by debo (David Bohman) over 2 years ago
In 2021 the release year of Ruby 3.1, macOS 10.12 is already EOL. We don't have macOS 10.12 for testing.
One way of looking at it is that I tested it. I encountered this with 3.2.0-preview2.
I wonder why you say this as "regression" with non-supported platform/versions. I don't have any strong opinion; this is totally maintainer's conveniences.
I said that because the most recent source release 3.1.2p20 builds without error on this platform.
Updated by nobu (Nobuyoshi Nakada) over 2 years ago
- Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED
I can't remember for what purpose git|b6b9a6190def, but it was not an intentional error when HAVE_UTIMENSAT
was not defined.
So I'm going to fix this case.
Updated by nobu (Nobuyoshi Nakada) over 2 years ago
- Status changed from Open to Closed
Applied in changeset git|8218cb73ba0b4c07d977fbf6e9fd02e1928288b7.
[Bug #19034] No runtime check for utimensat
if unavailable