You've already forked macports-base
mirror of
https://github.com/macports/macports-base.git
synced 2026-07-12 18:18:43 -07:00
sip_copy_proc: Avoid COPYFILE_CLONE
Apple broke the copyfile(3) interface with macOS 10.13.3 High Sierra as there is no way any more to make it follow symlinks when COPYFILE_CLONE is used. According to rdar://problem/36469208 this change was intentional. Instead of adding more conditionals to check whether the file to clone is actually a symlink, just do not attempt to clone it at all but make a normal copy. This will usually only take a few megabytes of disk space anyway. Closes: https://trac.macports.org/ticket/55575
This commit is contained in:
@@ -339,13 +339,11 @@ static char *lazy_copy(const char *path, struct stat *in_st) {
|
||||
goto lazy_copy_out;
|
||||
}
|
||||
|
||||
// copyfile(3)/clonefile(2) will not preserve SF_RESTRICTED,
|
||||
// we can safely clone the source file with all metadata
|
||||
copyfile_flags_t flags = COPYFILE_ALL;
|
||||
#ifdef COPYFILE_CLONE
|
||||
flags = COPYFILE_CLONE;
|
||||
#endif
|
||||
if (copyfile(path, target_path_temp, NULL, flags) != 0) {
|
||||
// copyfile(3) will not preserve SF_RESTRICTED,
|
||||
// we can safely copy the source file with all metadata.
|
||||
// This cannot use COPYFILE_CLONE as it does not follow symlinks,
|
||||
// see https://trac.macports.org/ticket/55575
|
||||
if (copyfile(path, target_path_temp, NULL, COPYFILE_ALL) != 0) {
|
||||
fprintf(stderr, "sip_copy_proc: copyfile(%s, %s): %s\n", path, target_path_temp, strerror(errno));
|
||||
goto lazy_copy_out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user