Modified: trunk/darwinup/Depot.cpp (996 => 997)
--- trunk/darwinup/Depot.cpp 2012-01-21 18:07:29 UTC (rev 996)
+++ trunk/darwinup/Depot.cpp 2012-01-23 18:55:08 UTC (rev 997)
@@ -434,7 +434,7 @@
"aborting to avoid damaging darwinup metadata.\n");
return DEPOT_ERROR;
}
-
+
// Perform a three-way-diff between the file to be installed (file),
// the file we last installed in this location (preceding),
// and the file that actually exists in this location (actual).
@@ -706,6 +706,12 @@
InstallContext* context = (InstallContext*)ctx;
int res = 0;
+ // Strip the quarantine xattr off all files to avoid them being rendered useless.
+ if (file->unquarantine(context->depot->m_archives_path) != 0) {
+ fprintf(stderr, "Error: unable to unquarantine file in staging area.\n");
+ return DEPOT_ERROR;
+ }
+
if (INFO_TEST(file->info(), FILE_INFO_INSTALL_DATA)) {
++context->files_modified;
Modified: trunk/darwinup/File.cpp (996 => 997)
--- trunk/darwinup/File.cpp 2012-01-21 18:07:29 UTC (rev 996)
+++ trunk/darwinup/File.cpp 2012-01-23 18:55:08 UTC (rev 997)
@@ -42,6 +42,7 @@
#include <string.h>
#include <unistd.h>
#include <removefile.h>
+#include <sys/xattr.h>
File::File() {
m_serial = 0;
@@ -244,6 +245,26 @@
return -1;
}
+int File::unquarantine(const char *prefix) {
+ int res = 0;
+ Archive *archive = this->archive();
+ const char *srcpath = archive->directory_name(prefix);
+ char path[PATH_MAX];
+ snprintf(path, sizeof(path), "%s/%s", srcpath, this->path());
+
+ res = removexattr(path, "com.apple.quarantine", XATTR_NOFOLLOW);
+ IF_DEBUG("[unquarantine] removexattr %s\n", path);
+ if (res == -1 && errno == ENOATTR) {
+ // Safely ignore ENOATTR, we didn't have the quarantine
+ // xattr set on this file.
+ res = 0;
+ } else if (res != 0) {
+ fprintf(stderr, "%s:%d: %s: %s (%d)\n",
+ __FILE__, __LINE__, m_path, strerror(errno), errno);
+ }
+ return res;
+}
+
int File::install_info(const char* dest) {
int res = 0;
char* path;
Modified: trunk/darwinup/File.h (996 => 997)
--- trunk/darwinup/File.h 2012-01-21 18:07:29 UTC (rev 996)
+++ trunk/darwinup/File.h 2012-01-23 18:55:08 UTC (rev 997)
@@ -183,6 +183,9 @@
// Removes the file
virtual int remove();
+ // Removes any quarantine xattrs present
+ int unquarantine(const char *prefix);
+
// Prints one line to the output stream indicating
// the file mode, ownership, digest and name.
virtual void print(FILE* stream);