Project

General

Profile

Actions

Bug #19034

closed

Ruby 3.2.0 build failure on macOS 10.12.6, which does not have utimensat

Added by debo (David Bohman) 2 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.0dev (2022-10-01T09:53:41Z master-mod 88c12a2937) [x86_64-darwin16]
[ruby-core:110165]

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) 2 months 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)
Actions #2

Updated by debo (David Bohman) 2 months ago

You are correct. Sorry about that. Your fix is superior. It builds and works for me.

Will you be making that change?

Actions #3

Updated by hsbt (Hiroshi SHIBATA) 2 months ago

macOS 10.12.6 is already EOL by Apple. Should we support this version?

Actions #4

Updated by debo (David Bohman) 2 months ago

Does that matter? This is a regression from 3.1, and the fix is trivial.

Actions #5

Updated by hsbt (Hiroshi SHIBATA) 2 months 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.

Actions #6

Updated by debo (David Bohman) 2 months 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) 2 months 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.

Actions #8

Updated by nobu (Nobuyoshi Nakada) 2 months ago

  • Status changed from Open to Closed

Applied in changeset git|8218cb73ba0b4c07d977fbf6e9fd02e1928288b7.


[Bug #19034] No runtime check for utimensat if unavailable

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0