Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
numba
GitHub Repository: numba/llvmlite
Path: blob/main/conda-recipes/llvm15-remove-use-of-clonefile.patch
1154 views
1
From 492d4fdd963576cb796e29c3c160e17ea9acfbf8 Mon Sep 17 00:00:00 2001
2
From: Siu Kwan Lam <[email protected]>
3
Date: Mon, 8 Apr 2024 10:28:24 -0500
4
Subject: [PATCH] llvm15-remove-use-of-clonefile
5
6
---
7
llvm/lib/Support/Unix/Path.inc | 2 ++
8
llvm/unittests/Support/Path.cpp | 8 +++++---
9
2 files changed, 7 insertions(+), 3 deletions(-)
10
11
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
12
index 2ae7c6dc4..ae93f7a1f 100644
13
--- a/llvm/lib/Support/Unix/Path.inc
14
+++ b/llvm/lib/Support/Unix/Path.inc
15
@@ -1476,6 +1476,7 @@ namespace fs {
16
std::error_code copy_file(const Twine &From, const Twine &To) {
17
std::string FromS = From.str();
18
std::string ToS = To.str();
19
+ /*
20
#if __has_builtin(__builtin_available)
21
if (__builtin_available(macos 10.12, *)) {
22
// Optimistically try to use clonefile() and handle errors, rather than
23
@@ -1504,6 +1505,7 @@ std::error_code copy_file(const Twine &From, const Twine &To) {
24
// cheaper.
25
}
26
#endif
27
+ */
28
if (!copyfile(FromS.c_str(), ToS.c_str(), /*State=*/NULL, COPYFILE_DATA))
29
return std::error_code();
30
return std::error_code(errno, std::generic_category());
31
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
32
index 6f0022765..822762952 100644
33
--- a/llvm/unittests/Support/Path.cpp
34
+++ b/llvm/unittests/Support/Path.cpp
35
@@ -2266,15 +2266,15 @@ TEST_F(FileSystemTest, permissions) {
36
37
EXPECT_EQ(fs::setPermissions(TempPath, fs::set_uid_on_exe), NoError);
38
EXPECT_TRUE(CheckPermissions(fs::set_uid_on_exe));
39
-
40
+#if !defined(__APPLE__)
41
EXPECT_EQ(fs::setPermissions(TempPath, fs::set_gid_on_exe), NoError);
42
EXPECT_TRUE(CheckPermissions(fs::set_gid_on_exe));
43
-
44
+#endif
45
// Modern BSDs require root to set the sticky bit on files.
46
// AIX and Solaris without root will mask off (i.e., lose) the sticky bit
47
// on files.
48
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && \
49
- !defined(_AIX) && !(defined(__sun__) && defined(__svr4__))
50
+ !defined(_AIX) && !(defined(__sun__) && defined(__svr4__)) && !defined(__APPLE__)
51
EXPECT_EQ(fs::setPermissions(TempPath, fs::sticky_bit), NoError);
52
EXPECT_TRUE(CheckPermissions(fs::sticky_bit));
53
54
@@ -2296,10 +2296,12 @@ TEST_F(FileSystemTest, permissions) {
55
EXPECT_TRUE(CheckPermissions(fs::all_perms));
56
#endif // !FreeBSD && !NetBSD && !OpenBSD && !AIX
57
58
+#if !defined(__APPLE__)
59
EXPECT_EQ(fs::setPermissions(TempPath, fs::all_perms & ~fs::sticky_bit),
60
NoError);
61
EXPECT_TRUE(CheckPermissions(fs::all_perms & ~fs::sticky_bit));
62
#endif
63
+#endif
64
}
65
66
#ifdef _WIN32
67
--
68
2.41.0
69
70
71