<pre style='margin:0'>
Rainer Müller (raimue) pushed a commit to branch release-2.4
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/b58d578a8e1aed0fa186ca059c337589a588e0af">https://github.com/macports/macports-base/commit/b58d578a8e1aed0fa186ca059c337589a588e0af</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit b58d578a8e1aed0fa186ca059c337589a588e0af
</span>Author: Rainer Müller <raimue@macports.org>
AuthorDate: Sat Mar 10 23:25:44 2018 +0100
<span style='display:block; white-space:pre;color:#404040;'> sip_copy_proc: Avoid COPYFILE_CLONE
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Apple broke the copyfile(3) interface with macOS 10.13.3 High Sierra as
</span><span style='display:block; white-space:pre;color:#404040;'> there is no way any more to make it follow symlinks when COPYFILE_CLONE
</span><span style='display:block; white-space:pre;color:#404040;'> is used. According to rdar://problem/36469208 this change was
</span><span style='display:block; white-space:pre;color:#404040;'> intentional.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Instead of adding more conditionals to check whether the file to clone
</span><span style='display:block; white-space:pre;color:#404040;'> is actually a symlink, just do not attempt to clone it at all but make
</span><span style='display:block; white-space:pre;color:#404040;'> a normal copy. This will usually only take a few megabytes of disk space
</span><span style='display:block; white-space:pre;color:#404040;'> anyway.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Closes: https://trac.macports.org/ticket/55575
</span><span style='display:block; white-space:pre;color:#404040;'> (cherry picked from commit 995dde8476c48580db4f6eedfde09e90dc5e8c99)
</span>---
src/pextlib1.0/sip_copy_proc.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/pextlib1.0/sip_copy_proc.c b/src/pextlib1.0/sip_copy_proc.c
</span><span style='display:block; white-space:pre;color:#808080;'>index b60f975..9cec94d 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/pextlib1.0/sip_copy_proc.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/pextlib1.0/sip_copy_proc.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -339,13 +339,11 @@ static char *lazy_copy(const char *path, struct stat *in_st) {
</span> goto lazy_copy_out;
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- // copyfile(3)/clonefile(2) will not preserve SF_RESTRICTED,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- // we can safely clone the source file with all metadata
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- copyfile_flags_t flags = COPYFILE_ALL;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#ifdef COPYFILE_CLONE
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- flags = COPYFILE_CLONE;
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#endif
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if (copyfile(path, target_path_temp, NULL, flags) != 0) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // copyfile(3) will not preserve SF_RESTRICTED,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // we can safely copy the source file with all metadata.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // This cannot use COPYFILE_CLONE as it does not follow symlinks,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // see https://trac.macports.org/ticket/55575
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (copyfile(path, target_path_temp, NULL, COPYFILE_ALL) != 0) {
</span> fprintf(stderr, "sip_copy_proc: copyfile(%s, %s): %s\n", path, target_path_temp, strerror(errno));
goto lazy_copy_out;
}
</pre><pre style='margin:0'>
</pre>