Path: blob/main/conda-recipes/llvm15-remove-use-of-clonefile.patch
1154 views
From 492d4fdd963576cb796e29c3c160e17ea9acfbf8 Mon Sep 17 00:00:00 20011From: Siu Kwan Lam <[email protected]>2Date: Mon, 8 Apr 2024 10:28:24 -05003Subject: [PATCH] llvm15-remove-use-of-clonefile45---6llvm/lib/Support/Unix/Path.inc | 2 ++7llvm/unittests/Support/Path.cpp | 8 +++++---82 files changed, 7 insertions(+), 3 deletions(-)910diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc11index 2ae7c6dc4..ae93f7a1f 10064412--- a/llvm/lib/Support/Unix/Path.inc13+++ b/llvm/lib/Support/Unix/Path.inc14@@ -1476,6 +1476,7 @@ namespace fs {15std::error_code copy_file(const Twine &From, const Twine &To) {16std::string FromS = From.str();17std::string ToS = To.str();18+ /*19#if __has_builtin(__builtin_available)20if (__builtin_available(macos 10.12, *)) {21// Optimistically try to use clonefile() and handle errors, rather than22@@ -1504,6 +1505,7 @@ std::error_code copy_file(const Twine &From, const Twine &To) {23// cheaper.24}25#endif26+ */27if (!copyfile(FromS.c_str(), ToS.c_str(), /*State=*/NULL, COPYFILE_DATA))28return std::error_code();29return std::error_code(errno, std::generic_category());30diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp31index 6f0022765..822762952 10064432--- a/llvm/unittests/Support/Path.cpp33+++ b/llvm/unittests/Support/Path.cpp34@@ -2266,15 +2266,15 @@ TEST_F(FileSystemTest, permissions) {3536EXPECT_EQ(fs::setPermissions(TempPath, fs::set_uid_on_exe), NoError);37EXPECT_TRUE(CheckPermissions(fs::set_uid_on_exe));38-39+#if !defined(__APPLE__)40EXPECT_EQ(fs::setPermissions(TempPath, fs::set_gid_on_exe), NoError);41EXPECT_TRUE(CheckPermissions(fs::set_gid_on_exe));42-43+#endif44// Modern BSDs require root to set the sticky bit on files.45// AIX and Solaris without root will mask off (i.e., lose) the sticky bit46// on files.47#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && \48- !defined(_AIX) && !(defined(__sun__) && defined(__svr4__))49+ !defined(_AIX) && !(defined(__sun__) && defined(__svr4__)) && !defined(__APPLE__)50EXPECT_EQ(fs::setPermissions(TempPath, fs::sticky_bit), NoError);51EXPECT_TRUE(CheckPermissions(fs::sticky_bit));5253@@ -2296,10 +2296,12 @@ TEST_F(FileSystemTest, permissions) {54EXPECT_TRUE(CheckPermissions(fs::all_perms));55#endif // !FreeBSD && !NetBSD && !OpenBSD && !AIX5657+#if !defined(__APPLE__)58EXPECT_EQ(fs::setPermissions(TempPath, fs::all_perms & ~fs::sticky_bit),59NoError);60EXPECT_TRUE(CheckPermissions(fs::all_perms & ~fs::sticky_bit));61#endif62+#endif63}6465#ifdef _WIN3266--672.41.068697071