From 9b74309eb588191ebde44bce1b8583badf0f5dc4 Mon Sep 17 00:00:00 2001 From: Zorg Date: Fri, 9 Oct 2015 17:49:46 -0400 Subject: [PATCH 01/11] Make allowsAuthorization apply to all of SUFileManager's methods --- Sparkle/SUBasicUpdateDriver.m | 2 +- Sparkle/SUFileManager.h | 17 +++++++++++------ Sparkle/SUFileManager.m | 28 +++++++++++++--------------- Sparkle/SUPlainInstaller.m | 2 +- Tests/SUFileManagerTest.swift | 18 ++++++++++++------ 5 files changed, 38 insertions(+), 29 deletions(-) diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 4e19024f..1a01436f 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -461,7 +461,7 @@ // We probably don't need to release the quarantine, but we'll do it just in case it's necessary. // Perhaps in a sandboxed environment this matters more. Note that this may not be a fatal error. NSError *quarantineError = nil; - if (![[[SUFileManager alloc] init] releaseItemFromQuarantineWithoutAuthenticationAtRootURL:[NSURL fileURLWithPath:targetPath] error:&quarantineError]) { + if (![[[SUFileManager alloc] initAllowingAuthorization:NO] releaseItemFromQuarantineAtRootURL:[NSURL fileURLWithPath:targetPath] error:&quarantineError]) { SULog(@"Failed to release quarantine on %@ with error %@", targetPath, quarantineError); } self.relaunchPath = targetPath; diff --git a/Sparkle/SUFileManager.h b/Sparkle/SUFileManager.h index 1a362808..5a390d89 100644 --- a/Sparkle/SUFileManager.h +++ b/Sparkle/SUFileManager.h @@ -9,12 +9,22 @@ #import /** - * A class used for performing file operations that may also perform authentication if permission is denied when trying to + * A class used for performing file operations that may also perform authentication if allowed and if permission is denied when trying to * perform them normally as the running user. All operations on this class may be used on thread other than the main thread. * This class provides basic file operations and stays away from including much application-level logic. */ @interface SUFileManager : NSObject +/** + * Initializes a file manager + * @param allowsAuthorization Specifies whether operations invoked on this instance are allowed to acquire authorization in order + * to perform file operations when read or write access is denied + * @return A new file manager instance + * + * This method just initializes the file manager. It doesn't acquire authorization immediately if allowsAuthorization is YES + */ +- (id)initAllowingAuthorization:(BOOL)allowsAuthorization; + /** * Creates a temporary directory on the same volume as a provided URL * @param preferredName A name that may be used when creating the temporary directory. Note that in the uncommon case this name is used, the temporary directory will be created inside the directory pointed by appropriateURL @@ -110,9 +120,4 @@ */ - (BOOL)releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL error:(NSError **)error; -/** - * Behaves as -releaseItemFromQuarantineAtRootURL:error: does, except without the capability of authenticating when permission is denied - */ -- (BOOL)releaseItemFromQuarantineWithoutAuthenticationAtRootURL:(NSURL *)rootURL error:(NSError **)error; - @end diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 2d4e3ba4..db25a782 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -52,13 +52,15 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza { AuthorizationRef _auth; NSFileManager *_fileManager; + BOOL _allowsAuthorization; } -- (id)init +- (id)initAllowingAuthorization:(BOOL)allowsAuthorization { self = [super init]; if (self != nil) { _fileManager = [[NSFileManager alloc] init]; + _allowsAuthorization = allowsAuthorization; } return self; } @@ -71,6 +73,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza return YES; } + if (!_allowsAuthorization) { + if (error != NULL) { + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey: @"Unable to grant authorization to perform action because it is explicitly turned off" }]; + } + return NO; + } + OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &_auth); if (status != errAuthorizationSuccess) { if (error != NULL) { @@ -177,7 +186,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza return success; } -- (BOOL)_releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL allowingAuthentication:(BOOL)allowsAuthentication withQuarantineRetrieval:(BOOL (^)(NSURL *))quarantineRetrieval quarantineRemoval:(BOOL (^)(NSURL *, NSError * __autoreleasing *))quarantineRemoval isAccessError:(BOOL (^)(NSError *))isAccessError error:(NSError * __autoreleasing *)error +- (BOOL)_releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL withQuarantineRetrieval:(BOOL (^)(NSURL *))quarantineRetrieval quarantineRemoval:(BOOL (^)(NSURL *, NSError * __autoreleasing *))quarantineRemoval isAccessError:(BOOL (^)(NSError *))isAccessError error:(NSError * __autoreleasing *)error { if (![self _itemExistsAtURL:rootURL]) { if (error != NULL) { @@ -195,7 +204,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza if (quarantineRemoval(fileURL, &removalError)) { removedQuarantine = YES; } else { - if (allowsAuthentication && isAccessError(removalError)) { + if (isAccessError(removalError)) { removedQuarantine = [self _removeXAttrWithAuthentication:SUAppleQuarantineIdentifier fromRootURL:rootURL error:error]; attemptedAuthentication = YES; } else { @@ -269,14 +278,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza // We used to have code similar to the method below that used -[NSURL getResourceValue:forKey:error:] and -[NSURL setResourceValue:forKey:error:] // However, those methods *really suck* - you can't rely on the return value from getting the resource value and if you set the resource value // when the key isn't present, errors are spewed out to the console -- (BOOL)_releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL allowingAuthentication:(BOOL)allowsAuthentication error:(NSError *__autoreleasing *)error +- (BOOL)releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL error:(NSError *__autoreleasing *)error { static const int removeXAttrOptions = XATTR_NOFOLLOW; return [self _releaseItemFromQuarantineAtRootURL:rootURL - allowingAuthentication:allowsAuthentication withQuarantineRetrieval:^BOOL(NSURL *fileURL) { return ([self _getXAttr:SUAppleQuarantineIdentifier fromFile:fileURL.path options:removeXAttrOptions] >= 0); } @@ -293,16 +301,6 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza error:error]; } -- (BOOL)releaseItemFromQuarantineAtRootURL:(NSURL *)rootURL error:(NSError * __autoreleasing *)error -{ - return [self _releaseItemFromQuarantineAtRootURL:rootURL allowingAuthentication:YES error:error]; -} - -- (BOOL)releaseItemFromQuarantineWithoutAuthenticationAtRootURL:(NSURL *)rootURL error:(NSError * __autoreleasing *)error -{ - return [self _releaseItemFromQuarantineAtRootURL:rootURL allowingAuthentication:NO error:error]; -} - - (BOOL)moveItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError *__autoreleasing *)error { if (![self _itemExistsAtURL:sourceURL]) { diff --git a/Sparkle/SUPlainInstaller.m b/Sparkle/SUPlainInstaller.m index a8a90a1f..e6a922b7 100644 --- a/Sparkle/SUPlainInstaller.m +++ b/Sparkle/SUPlainInstaller.m @@ -42,7 +42,7 @@ return NO; } - SUFileManager *fileManager = [[SUFileManager alloc] init]; + SUFileManager *fileManager = [[SUFileManager alloc] initAllowingAuthorization:YES]; // Create a temporary directory for our new app that resides on our destination's volume NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:[installationURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingString:@" (Incomplete Update)"] appropriateForDirectoryURL:installationURL.URLByDeletingLastPathComponent error:error]; diff --git a/Tests/SUFileManagerTest.swift b/Tests/SUFileManagerTest.swift index 76e66882..ecc38bd0 100644 --- a/Tests/SUFileManagerTest.swift +++ b/Tests/SUFileManagerTest.swift @@ -12,7 +12,7 @@ class SUFileManagerTest: XCTestCase { func makeTempFiles(testBlock: (SUFileManager, NSURL, NSURL, NSURL, NSURL) -> Void) { - let fileManager = SUFileManager() + let fileManager = SUFileManager(allowingAuthorization: false) let tempDirectoryURL = try! fileManager.makeTemporaryDirectoryWithPreferredName("Sparkle Unit Test Data", appropriateForDirectoryURL: NSURL(fileURLWithPath: NSHomeDirectory())) @@ -95,8 +95,8 @@ class SUFileManagerTest: XCTestCase func testReleaseFilesFromQuarantine() { makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in - try! fileManager.releaseItemFromQuarantineWithoutAuthenticationAtRootURL(ordinaryFileURL) - try! fileManager.releaseItemFromQuarantineWithoutAuthenticationAtRootURL(directoryURL) + try! fileManager.releaseItemFromQuarantineAtRootURL(ordinaryFileURL) + try! fileManager.releaseItemFromQuarantineAtRootURL(directoryURL) let quarantineData = "does not really matter what is here".cStringUsingEncoding(NSUTF8StringEncoding)! let quarantineDataLength = Int(strlen(quarantineData)) @@ -104,7 +104,7 @@ class SUFileManagerTest: XCTestCase XCTAssertEqual(0, setxattr(ordinaryFileURL.path!, SUAppleQuarantineIdentifier, quarantineData, quarantineDataLength, 0, XATTR_CREATE)) XCTAssertGreaterThan(getxattr(ordinaryFileURL.path!, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW), 0) - try! fileManager.releaseItemFromQuarantineWithoutAuthenticationAtRootURL(ordinaryFileURL) + try! fileManager.releaseItemFromQuarantineAtRootURL(ordinaryFileURL) XCTAssertEqual(-1, getxattr(ordinaryFileURL.path!, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW)) XCTAssertEqual(0, setxattr(directoryURL.path!, SUAppleQuarantineIdentifier, quarantineData, quarantineDataLength, 0, XATTR_CREATE)) @@ -113,7 +113,7 @@ class SUFileManagerTest: XCTestCase XCTAssertEqual(0, setxattr(fileInDirectoryURL.path!, SUAppleQuarantineIdentifier, quarantineData, quarantineDataLength, 0, XATTR_CREATE)) XCTAssertGreaterThan(getxattr(fileInDirectoryURL.path!, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW), 0) - try! fileManager.releaseItemFromQuarantineWithoutAuthenticationAtRootURL(directoryURL) + try! fileManager.releaseItemFromQuarantineAtRootURL(directoryURL) XCTAssertEqual(-1, getxattr(directoryURL.path!, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW)) XCTAssertEqual(-1, getxattr(fileInDirectoryURL.path!, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW)) @@ -244,7 +244,13 @@ class SUFileManagerTest: XCTestCase // This alone shouldn't prompt a password dialog and should always succeed func testAcquireAuthorization() { - let fileManager = SUFileManager() + let fileManager = SUFileManager(allowingAuthorization: true) try! fileManager._acquireAuthorization() } + + func testAcquireBadAuthorization() + { + let fileManager = SUFileManager(allowingAuthorization: false) + XCTAssertNil(try? fileManager._acquireAuthorization()) + } } From ee72ec3dab88b09dd9281d5d63245c876c0a2c01 Mon Sep 17 00:00:00 2001 From: Zorg Date: Fri, 9 Oct 2015 23:58:23 -0400 Subject: [PATCH 02/11] Fix issues with copying files from different mounted drives The move operation now does an explict copy & remove. We also copy items using FSCopyObjectSync due to issues existing in copyfile (and NSFileManager). Both of these fix bugs in some cases where items cannot be moved from one network drive to another. In my testing before this patch, I was unable to get the test application to launch and was unable to move the old installation to the trash. --- Sparkle/SUBasicUpdateDriver.m | 9 +- Sparkle/SUFileManager.h | 11 ++ Sparkle/SUFileManager.m | 154 ++++++++++++++++++++ TestApplication/SUTestApplicationDelegate.m | 11 +- Tests/SUFileManagerTest.swift | 20 +++ 5 files changed, 197 insertions(+), 8 deletions(-) diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 1a01436f..2b52ea8a 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -452,16 +452,19 @@ if (relaunchPathToCopy != nil) { NSString *targetPath = [self.host.appCachePath stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]]; - NSFileManager *fileManager = [[NSFileManager alloc] init]; + SUFileManager *fileManager = [[SUFileManager alloc] initAllowingAuthorization:NO]; NSError *error = nil; + NSURL *relaunchURLToCopy = [NSURL fileURLWithPath:relaunchPathToCopy]; + NSURL *targetURL = [NSURL fileURLWithPath:targetPath]; + // We only need to run our copy of the app by spawning a task // Since we are copying the app to a directory that is write-accessible, we don't need to muck with owner/group IDs - if ([self preparePathForRelaunchTool:targetPath error:&error] && [fileManager copyItemAtPath:relaunchPathToCopy toPath:targetPath error:&error]) { + if ([self preparePathForRelaunchTool:targetPath error:&error] && [fileManager copyItemAtURL:relaunchURLToCopy toURL:targetURL error:&error]) { // We probably don't need to release the quarantine, but we'll do it just in case it's necessary. // Perhaps in a sandboxed environment this matters more. Note that this may not be a fatal error. NSError *quarantineError = nil; - if (![[[SUFileManager alloc] initAllowingAuthorization:NO] releaseItemFromQuarantineAtRootURL:[NSURL fileURLWithPath:targetPath] error:&quarantineError]) { + if (![fileManager releaseItemFromQuarantineAtRootURL:targetURL error:&quarantineError]) { SULog(@"Failed to release quarantine on %@ with error %@", targetPath, quarantineError); } self.relaunchPath = targetPath; diff --git a/Sparkle/SUFileManager.h b/Sparkle/SUFileManager.h index 5a390d89..7dde8cab 100644 --- a/Sparkle/SUFileManager.h +++ b/Sparkle/SUFileManager.h @@ -49,6 +49,17 @@ */ - (BOOL)moveItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError **)error; +/** + * Copies an item from a source to a destination + * @param sourceURL A URL pointing to the item to move. The item at this URL must exist. + * @param destinationURL A URL pointing to the destination the item will be moved at. An item must not already exist at this URL. + * @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL. + * @return YES if the item was copied successfully, otherwise NO along with a populated error object + * + * This is not an atomic operation. + */ +- (BOOL)copyItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError **)error; + /** * Moves an item at a specified URL to the running user's trash directory * @param url A URL pointing to the item to move to the trash. The item at this URL must exist. diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index db25a782..3a57f827 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -301,6 +301,145 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza error:error]; } +/* + * Copies an item from one location to another + * This intentionally does *not* use copyfile() or any API that uses it such as NSFileManager's copy item method + * This is because copyfile() fails to copy symbolic links from one network mount to another, which will affect copying apps + * This failure has been reproduced on 10.11.0 and a VM running 10.8, so the issue has existed for a while. + * For more info, see the bug report at http://openradar.appspot.com/radar?id=4925873463492608 + */ +- (BOOL)copyItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError * __autoreleasing *)error +{ + if (![self _itemExistsAtURL:sourceURL]) { + if (error != NULL) { + *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Source file to copy (%@) does not exist.", sourceURL.lastPathComponent] }]; + } + return NO; + } + + if ([self _itemExistsAtURL:destinationURL]) { + if (error != NULL) { + *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteFileExistsError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination file to copy to (%@) already exists.", destinationURL.lastPathComponent] }]; + } + return NO; + } + + char sourcePath[PATH_MAX] = {0}; + if (![sourceURL.path getFileSystemRepresentation:sourcePath maxLength:sizeof(sourcePath)]) { + if (error != NULL) { + *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"File to copy (%@) cannot be represented as a valid file name.", sourceURL.lastPathComponent] }]; + } + return NO; + } + + FSRef sourceRef; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + OSStatus makeSourceResult = FSPathMakeRefWithOptions((const UInt8 *)sourcePath, kFSPathMakeRefDoNotFollowLeafSymlink, &sourceRef, NULL); +#pragma clang diagnostic pop + if (makeSourceResult != noErr) { + if (error != NULL) { + *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:makeSourceResult userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create file system reference for source %@.", sourceURL.lastPathComponent] }]; + } + return NO; + } + + char destinationParentPath[PATH_MAX] = {0}; + if (![destinationURL.URLByDeletingLastPathComponent.path getFileSystemRepresentation:destinationParentPath maxLength:sizeof(destinationParentPath)]) { + if (error != NULL) { + *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination parent directory to copy file into (%@) cannot be represented as a valid file name.", destinationURL.URLByDeletingLastPathComponent.lastPathComponent] }]; + } + return NO; + } + + FSRef destinationParentRef; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + OSStatus makeDestinationParentResult = FSPathMakeRefWithOptions((const UInt8 *)destinationParentPath, kFSPathMakeRefDoNotFollowLeafSymlink, &destinationParentRef, NULL); +#pragma clang diagnostic pop + if (makeDestinationParentResult != noErr) { + if (error != NULL) { + *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:makeDestinationParentResult userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create file system reference for parent directory %@.", destinationURL.URLByDeletingLastPathComponent.lastPathComponent] }]; + } + return NO; + } + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + OSStatus copyResult = FSCopyObjectSync(&sourceRef, &destinationParentRef, (__bridge CFStringRef)(destinationURL.lastPathComponent), NULL, kFSFileOperationDefaultOptions); +#pragma clang diagnostic pop + if (copyResult == noErr) { + return YES; + } + + if (copyResult != permErr) { + if (error != NULL) { + *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:copyResult userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to copy file (%@)", sourceURL.lastPathComponent] }]; + } + return NO; + } + + if (![self _acquireAuthorizationWithError:error]) { + return NO; + } + + char destinationPath[PATH_MAX] = {0}; + if (![destinationURL.path getFileSystemRepresentation:destinationPath maxLength:sizeof(destinationPath)]) { + if (error != NULL) { + *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination to copy file to (%@) cannot be represented as a valid file name.", destinationURL.lastPathComponent] }]; + } + return NO; + } + + if (!AuthorizationExecuteWithPrivilegesAndWait(_auth, "/bin/cp", kAuthorizationFlagDefaults, (char *[]){ "-Rf", sourcePath, destinationPath, NULL })) { + if (error != NULL) { + NSString *errorMessage = [NSString stringWithFormat:@"Failed to perform authenticated file copy for %@.", sourceURL.lastPathComponent]; + *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{ NSLocalizedDescriptionKey:errorMessage }]; + } + return NO; + } + + return YES; +} + +/* + * Retrieves the volume ID that a particular url resides on + * The url must point to a file that exists + * There is no cocoa equivalent for obtaining the volume ID + * Although NSURLVolumeURLForRemountingKey exists as a resource key for NSURL, + * that will not return a URL if the mount is not re-mountable and I otherwise don't trust the API + */ +- (BOOL)_getVolumeID:(FSVolumeRefNum *)volumeID ofItemAtURL:(NSURL *)url +{ + char path[PATH_MAX] = {0}; + if (![url.path getFileSystemRepresentation:path maxLength:sizeof(path)]) { + return NO; + } + + FSRef pathRef; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + if (FSPathMakeRefWithOptions((const UInt8*)path, kFSPathMakeRefDoNotFollowLeafSymlink, &pathRef, NULL) != noErr) { +#pragma clang diagnostic pop + return NO; + } + + FSCatalogInfo catalogInfo; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + OSErr catalogError = FSGetCatalogInfo(&pathRef, kFSCatInfoVolume, &catalogInfo, NULL, NULL, NULL); +#pragma clang diagnostic pop + if (catalogError != noErr) { + return NO; + } + + if (volumeID != NULL) { + *volumeID = catalogInfo.volume; + } + + return YES; +} + - (BOOL)moveItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError *__autoreleasing *)error { if (![self _itemExistsAtURL:sourceURL]) { @@ -317,6 +456,21 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza return NO; } + // If the source and destination are on different volumes, we should not do a move; + // from my experience a move may fail when moving particular files from + // one network mount to another one. This is possibly related to the fact that + // moving a file will try to preserve ownership but copying won't + + FSVolumeRefNum sourceVolume = 0; + BOOL foundSourceVolume = [self _getVolumeID:&sourceVolume ofItemAtURL:sourceURL]; + + FSVolumeRefNum destinationVolume = 0; + BOOL foundDestinationVolume = [self _getVolumeID:&destinationVolume ofItemAtURL:destinationURL.URLByDeletingLastPathComponent]; + + if (foundSourceVolume && foundDestinationVolume && sourceVolume != destinationVolume) { + return ([self copyItemAtURL:sourceURL toURL:destinationURL error:error] && [self removeItemAtURL:sourceURL error:error]); + } + NSError *moveError = nil; if ([_fileManager moveItemAtURL:sourceURL toURL:destinationURL error:&moveError]) { return YES; diff --git a/TestApplication/SUTestApplicationDelegate.m b/TestApplication/SUTestApplicationDelegate.m index 9296073f..a4c83e16 100644 --- a/TestApplication/SUTestApplicationDelegate.m +++ b/TestApplication/SUTestApplicationDelegate.m @@ -8,6 +8,7 @@ #import "SUTestApplicationDelegate.h" #import "SUUpdateSettingsWindowController.h" +#import "SUFileManager.h" @interface SUTestApplicationDelegate () @@ -37,11 +38,11 @@ static NSString * const UPDATED_VERSION = @"2.0"; [[NSApplication sharedApplication] terminate:nil]; } - NSFileManager *fileManager = [NSFileManager defaultManager]; + SUFileManager *fileManager = [[SUFileManager alloc] initAllowingAuthorization:NO]; // Locate user's cache directory NSError *cacheError = nil; - NSURL *cacheDirectoryURL = [fileManager URLForDirectory:NSCachesDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:&cacheError]; + NSURL *cacheDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSCachesDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:&cacheError]; if (cacheDirectoryURL == nil) { NSLog(@"Failed to locate cache directory with error: %@", cacheError); @@ -62,7 +63,7 @@ static NSString * const UPDATED_VERSION = @"2.0"; } NSError *createDirectoryError = nil; - if (![fileManager createDirectoryAtURL:serverDirectoryURL withIntermediateDirectories:YES attributes:nil error:&createDirectoryError]) { + if (![[NSFileManager defaultManager] createDirectoryAtURL:serverDirectoryURL withIntermediateDirectories:YES attributes:nil error:&createDirectoryError]) { NSLog(@"Failed creating directory at %@ with error %@", serverDirectoryURL.path, createDirectoryError); assert(NO); } @@ -137,7 +138,7 @@ static NSString * const UPDATED_VERSION = @"2.0"; // Obtain the file attributes to get the file size of our update later NSError *fileAttributesError = nil; - NSDictionary *archiveFileAttributes = [fileManager attributesOfItemAtPath:archiveURL.path error:&fileAttributesError]; + NSDictionary *archiveFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:archiveURL.path error:&fileAttributesError]; if (archiveFileAttributes == nil) { NSLog(@"Failed to retrieve file attributes from archive with error %@", fileAttributesError); assert(NO); @@ -178,7 +179,7 @@ static NSString * const UPDATED_VERSION = @"2.0"; // Finally start the server NSTask *serverTask = [[NSTask alloc] init]; serverTask.launchPath = @"/usr/bin/python"; - assert([fileManager fileExistsAtPath:serverTask.launchPath]); + assert([[NSFileManager defaultManager] fileExistsAtPath:serverTask.launchPath]); serverTask.arguments = @[@"-m", @"SimpleHTTPServer", @"1337"]; serverTask.currentDirectoryPath = serverDirectoryPath; [serverTask launch]; diff --git a/Tests/SUFileManagerTest.swift b/Tests/SUFileManagerTest.swift index ecc38bd0..75553278 100644 --- a/Tests/SUFileManagerTest.swift +++ b/Tests/SUFileManagerTest.swift @@ -77,6 +77,26 @@ class SUFileManagerTest: XCTestCase try! fileManager.removeItemAtURL(directoryTrashURL) } } + + func testCopyFiles() + { + makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in + XCTAssertNil(try? fileManager.copyItemAtURL(ordinaryFileURL, toURL: directoryURL)) + XCTAssertNil(try? fileManager.copyItemAtURL(rootURL.URLByAppendingPathComponent("does not exist"), toURL: directoryURL)) + + let newFileURL = (ordinaryFileURL.URLByDeletingLastPathComponent?.URLByAppendingPathComponent("new file"))! + try! fileManager.copyItemAtURL(ordinaryFileURL, toURL: newFileURL) + XCTAssertTrue(fileManager._itemExistsAtURL(ordinaryFileURL)) + XCTAssertTrue(fileManager._itemExistsAtURL(newFileURL)) + + let newDirectoryURL = (ordinaryFileURL.URLByDeletingLastPathComponent?.URLByAppendingPathComponent("new directory"))! + try! fileManager.copyItemAtURL(directoryURL, toURL: newDirectoryURL) + XCTAssertTrue(fileManager._itemExistsAtURL(directoryURL)) + XCTAssertTrue(fileManager._itemExistsAtURL(newDirectoryURL)) + XCTAssertTrue(fileManager._itemExistsAtURL(fileInDirectoryURL)) + XCTAssertTrue(fileManager._itemExistsAtURL(newDirectoryURL.URLByAppendingPathComponent(fileInDirectoryURL.lastPathComponent!))) + } + } func testRemoveFiles() { From 6818d1f180b23b4d9fbe74e7b533e94ff67d0515 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 10 Oct 2015 00:12:58 -0400 Subject: [PATCH 03/11] Verify existence of destination parent directory for moving/copying --- Sparkle/SUFileManager.m | 18 ++++++++++++++++-- Tests/SUFileManagerTest.swift | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 3a57f827..cbbb8121 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -317,6 +317,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza return NO; } + if (![self _itemExistsAtURL:destinationURL.URLByDeletingLastPathComponent]) { + if (error != NULL) { + *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteFileExistsError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination parent directory to copy into (%@) does not exist.", destinationURL.URLByDeletingLastPathComponent.lastPathComponent] }]; + } + return NO; + } + if ([self _itemExistsAtURL:destinationURL]) { if (error != NULL) { *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteFileExistsError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination file to copy to (%@) already exists.", destinationURL.lastPathComponent] }]; @@ -444,14 +451,21 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza { if (![self _itemExistsAtURL:sourceURL]) { if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Source file to move (%@) does not exist.", sourceURL.path.lastPathComponent] }]; + *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Source file to move (%@) does not exist.", sourceURL.lastPathComponent] }]; + } + return NO; + } + + if (![self _itemExistsAtURL:destinationURL.URLByDeletingLastPathComponent]) { + if (error != NULL) { + *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination parent directory to move into (%@) does not exist.", destinationURL.URLByDeletingLastPathComponent.lastPathComponent] }]; } return NO; } if ([self _itemExistsAtURL:destinationURL]) { if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteFileExistsError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination file to move (%@) already exists.", destinationURL.path.lastPathComponent] }]; + *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteFileExistsError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination file to move (%@) already exists.", destinationURL.lastPathComponent] }]; } return NO; } diff --git a/Tests/SUFileManagerTest.swift b/Tests/SUFileManagerTest.swift index 75553278..260ff2f1 100644 --- a/Tests/SUFileManagerTest.swift +++ b/Tests/SUFileManagerTest.swift @@ -36,6 +36,7 @@ class SUFileManagerTest: XCTestCase { makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in XCTAssertNil(try? fileManager.moveItemAtURL(ordinaryFileURL, toURL: directoryURL)) + XCTAssertNil(try? fileManager.moveItemAtURL(ordinaryFileURL, toURL: directoryURL.URLByAppendingPathComponent("foo").URLByAppendingPathComponent("bar"))) XCTAssertNil(try? fileManager.moveItemAtURL(rootURL.URLByAppendingPathComponent("does not exist"), toURL: directoryURL)) let newFileURL = (ordinaryFileURL.URLByDeletingLastPathComponent?.URLByAppendingPathComponent("new file"))! @@ -82,6 +83,7 @@ class SUFileManagerTest: XCTestCase { makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL in XCTAssertNil(try? fileManager.copyItemAtURL(ordinaryFileURL, toURL: directoryURL)) + XCTAssertNil(try? fileManager.copyItemAtURL(ordinaryFileURL, toURL: directoryURL.URLByAppendingPathComponent("foo").URLByAppendingPathComponent("bar"))) XCTAssertNil(try? fileManager.copyItemAtURL(rootURL.URLByAppendingPathComponent("does not exist"), toURL: directoryURL)) let newFileURL = (ordinaryFileURL.URLByDeletingLastPathComponent?.URLByAppendingPathComponent("new file"))! From 9d06f5bc4d54f9ccb0af238a306759a7549c56ff Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 10 Oct 2015 00:28:12 -0400 Subject: [PATCH 04/11] Meant to use NSFileNoSuchFileError here --- Sparkle/SUFileManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index cbbb8121..243e0f5b 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -319,7 +319,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza if (![self _itemExistsAtURL:destinationURL.URLByDeletingLastPathComponent]) { if (error != NULL) { - *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteFileExistsError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination parent directory to copy into (%@) does not exist.", destinationURL.URLByDeletingLastPathComponent.lastPathComponent] }]; + *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination parent directory to copy into (%@) does not exist.", destinationURL.URLByDeletingLastPathComponent.lastPathComponent] }]; } return NO; } From 3c957096c64de93c93c9c49e7ebd3bbe254ee2a8 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 10 Oct 2015 17:42:27 -0400 Subject: [PATCH 05/11] Use class constructor instead of an init method for SUFileManager I think it's more natural this way --- Sparkle/SUBasicUpdateDriver.m | 2 +- Sparkle/SUFileManager.h | 6 +++--- Sparkle/SUFileManager.m | 8 +++++++- Sparkle/SUPlainInstaller.m | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 2b52ea8a..173ce204 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -452,7 +452,7 @@ if (relaunchPathToCopy != nil) { NSString *targetPath = [self.host.appCachePath stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]]; - SUFileManager *fileManager = [[SUFileManager alloc] initAllowingAuthorization:NO]; + SUFileManager *fileManager = [SUFileManager fileManagerAllowingAuthorization:NO]; NSError *error = nil; NSURL *relaunchURLToCopy = [NSURL fileURLWithPath:relaunchPathToCopy]; diff --git a/Sparkle/SUFileManager.h b/Sparkle/SUFileManager.h index 7dde8cab..f6897ced 100644 --- a/Sparkle/SUFileManager.h +++ b/Sparkle/SUFileManager.h @@ -16,14 +16,14 @@ @interface SUFileManager : NSObject /** - * Initializes a file manager + * Creates a file manager that allows or disallows authorizing for file operations * @param allowsAuthorization Specifies whether operations invoked on this instance are allowed to acquire authorization in order * to perform file operations when read or write access is denied * @return A new file manager instance * - * This method just initializes the file manager. It doesn't acquire authorization immediately if allowsAuthorization is YES + * This method just creates the file manager. It doesn't acquire authorization immediately if allowsAuthorization is YES */ -- (id)initAllowingAuthorization:(BOOL)allowsAuthorization; ++ (instancetype)fileManagerAllowingAuthorization:(BOOL)allowsAuthorization; /** * Creates a temporary directory on the same volume as a provided URL diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 243e0f5b..fa36a997 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -55,7 +55,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza BOOL _allowsAuthorization; } -- (id)initAllowingAuthorization:(BOOL)allowsAuthorization +- (instancetype)initAllowingAuthorization:(BOOL)allowsAuthorization { self = [super init]; if (self != nil) { @@ -65,6 +65,12 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza return self; } + ++ (instancetype)fileManagerAllowingAuthorization:(BOOL)allowsAuthorization +{ + return [[self alloc] initAllowingAuthorization:allowsAuthorization]; +} + // Acquires an authorization reference which is intended to be used for future authorized file operations - (BOOL)_acquireAuthorizationWithError:(NSError *__autoreleasing *)error { diff --git a/Sparkle/SUPlainInstaller.m b/Sparkle/SUPlainInstaller.m index e6a922b7..70a7ded9 100644 --- a/Sparkle/SUPlainInstaller.m +++ b/Sparkle/SUPlainInstaller.m @@ -42,7 +42,7 @@ return NO; } - SUFileManager *fileManager = [[SUFileManager alloc] initAllowingAuthorization:YES]; + SUFileManager *fileManager = [SUFileManager fileManagerAllowingAuthorization:YES]; // Create a temporary directory for our new app that resides on our destination's volume NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:[installationURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingString:@" (Incomplete Update)"] appropriateForDirectoryURL:installationURL.URLByDeletingLastPathComponent error:error]; From ccf4f81ea03a6b719e8a3298e55e0ef3f37cd56d Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 10 Oct 2015 17:58:44 -0400 Subject: [PATCH 06/11] Use SUFileManager for copyTree in BinaryDelta Fixes app not being able to be patched because the original app was on a network mounted volume --- Sparkle.xcodeproj/project.pbxproj | 10 ++++++++++ Sparkle/SUBinaryDeltaCommon.m | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 189859cb..511aa939 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -170,6 +170,11 @@ 721CF1AB1AD764EB00D9AC09 /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D06E8FB0FD68D61005AE3F6 /* libbz2.dylib */; }; 7223E7631AD1AEFF008E3161 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; }; 7268AC631AD634C200C3E0C1 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */; }; + 726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; + 726F2CDF1BC9C093001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; + 726F2CE01BC9C0EF001971A4 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; }; + 726F2CE11BC9C100001971A4 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; + 726F2CE21BC9C133001971A4 /* SUSystemProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A2279B0D1CEE7600430CCD /* SUSystemProfiler.m */; }; 7275F9C11B5F1F2900B1D19E /* SUFileManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */; }; 7275F9C21B5F1F2900B1D19E /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; 7275F9C31B5F1F2900B1D19E /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; @@ -1473,6 +1478,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 726F2CE21BC9C133001971A4 /* SUSystemProfiler.m in Sources */, + 726F2CE11BC9C100001971A4 /* SULog.m in Sources */, + 726F2CE01BC9C0EF001971A4 /* SUHost.m in Sources */, + 726F2CDF1BC9C093001971A4 /* SUConstants.m in Sources */, + 726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */, 5D06E8E90FD68CDB005AE3F6 /* bsdiff.c in Sources */, 14652F7E19A9728A00959E44 /* bspatch.c in Sources */, 7223E7631AD1AEFF008E3161 /* sais.c in Sources */, diff --git a/Sparkle/SUBinaryDeltaCommon.m b/Sparkle/SUBinaryDeltaCommon.m index 7395c0e6..be3966ce 100644 --- a/Sparkle/SUBinaryDeltaCommon.m +++ b/Sparkle/SUBinaryDeltaCommon.m @@ -7,6 +7,7 @@ // #include "SUBinaryDeltaCommon.h" +#import "SUFileManager.h" #include #include #include @@ -220,7 +221,7 @@ BOOL removeTree(NSString *path) BOOL copyTree(NSString *source, NSString *dest) { - return [[NSFileManager defaultManager] copyItemAtPath:source toPath:dest error:nil]; + return [[SUFileManager fileManagerAllowingAuthorization:NO] copyItemAtURL:[NSURL fileURLWithPath:source] toURL:[NSURL fileURLWithPath:dest] error:NULL]; } BOOL modifyPermissions(NSString *path, mode_t desiredPermissions) From c850146ef6b3d186aaa9914f191034a406039008 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 10 Oct 2015 18:10:24 -0400 Subject: [PATCH 07/11] Forgot to update SUFileManager constuctor in Test App --- TestApplication/SUTestApplicationDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestApplication/SUTestApplicationDelegate.m b/TestApplication/SUTestApplicationDelegate.m index a4c83e16..3c6cc82b 100644 --- a/TestApplication/SUTestApplicationDelegate.m +++ b/TestApplication/SUTestApplicationDelegate.m @@ -38,7 +38,7 @@ static NSString * const UPDATED_VERSION = @"2.0"; [[NSApplication sharedApplication] terminate:nil]; } - SUFileManager *fileManager = [[SUFileManager alloc] initAllowingAuthorization:NO]; + SUFileManager *fileManager = [SUFileManager fileManagerAllowingAuthorization:NO]; // Locate user's cache directory NSError *cacheError = nil; From 8a208ce520572bf5111d603c69812b16c2fd1028 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 10 Oct 2015 18:14:06 -0400 Subject: [PATCH 08/11] Move OS methods from SUHost to SUOperatingSystem This reduces the bloat that BinaryDelta and SUFileManager need to include --- Sparkle.xcodeproj/project.pbxproj | 22 ++++++++----- Sparkle/SUBasicUpdateDriver.m | 5 +-- Sparkle/SUFileManager.m | 4 +-- Sparkle/SUHost.h | 4 --- Sparkle/SUHost.m | 39 ----------------------- Sparkle/SUOperatingSystem.h | 16 ++++++++++ Sparkle/SUOperatingSystem.m | 51 +++++++++++++++++++++++++++++++ Sparkle/SUSystemProfiler.m | 3 +- Sparkle/SUUIBasedUpdateDriver.m | 3 +- 9 files changed, 90 insertions(+), 57 deletions(-) create mode 100644 Sparkle/SUOperatingSystem.h create mode 100644 Sparkle/SUOperatingSystem.m diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 511aa939..df84dc9f 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -171,10 +171,11 @@ 7223E7631AD1AEFF008E3161 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; }; 7268AC631AD634C200C3E0C1 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */; }; 726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; - 726F2CDF1BC9C093001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; - 726F2CE01BC9C0EF001971A4 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; }; - 726F2CE11BC9C100001971A4 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; - 726F2CE21BC9C133001971A4 /* SUSystemProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A2279B0D1CEE7600430CCD /* SUSystemProfiler.m */; }; + 726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */; settings = {ASSET_TAGS = (); }; }; + 726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; settings = {ASSET_TAGS = (); }; }; + 726F2CE71BC9C3E2001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; + 726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; + 726F2CE91BC9C499001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 7275F9C11B5F1F2900B1D19E /* SUFileManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */; }; 7275F9C21B5F1F2900B1D19E /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; 7275F9C31B5F1F2900B1D19E /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; @@ -574,6 +575,8 @@ 7223E7621AD1AEFF008E3161 /* sais.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sais.h; sourceTree = ""; }; 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBinaryDeltaCreate.m; sourceTree = ""; }; 7268AC641AD634E400C3E0C1 /* SUBinaryDeltaCreate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBinaryDeltaCreate.h; sourceTree = ""; }; + 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUOperatingSystem.h; sourceTree = ""; }; + 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUOperatingSystem.m; sourceTree = ""; }; 7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUFileManager.h; sourceTree = ""; }; 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUFileManager.m; sourceTree = ""; }; 72A4A23F1BB6567D00E7820D /* SUFileManagerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUFileManagerTest.swift; sourceTree = ""; }; @@ -959,6 +962,8 @@ 14652F8319A9759F00959E44 /* SUExport.h */, 61EF67580E25C5B400F754E0 /* SUHost.h */, 61EF67550E25B58D00F754E0 /* SUHost.m */, + 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */, + 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */, 55C14F04136EF6DB00649790 /* SULog.h */, 55C14F05136EF6DB00649790 /* SULog.m */, ); @@ -1090,6 +1095,7 @@ 61EF67590E25C5B400F754E0 /* SUHost.h in Headers */, 618FA5010DAE88B40026945C /* SUInstaller.h in Headers */, 55C14F06136EF6DB00649790 /* SULog.h in Headers */, + 726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */, 618FA5220DAE8E8A0026945C /* SUPackageInstaller.h in Headers */, 6102FE460E077FCE00F85D09 /* SUPipedUnarchiver.h in Headers */, 618FA5050DAE8AB80026945C /* SUPlainInstaller.h in Headers */, @@ -1457,6 +1463,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 726F2CE71BC9C3E2001971A4 /* SUOperatingSystem.m in Sources */, 55C14BD4136EEFCE00649790 /* Autoupdate.m in Sources */, F8761EB61ADC5E7A000C9034 /* SUCodeSigningVerifier.m in Sources */, 55C14F00136EF6B700649790 /* SUConstants.m in Sources */, @@ -1478,10 +1485,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 726F2CE21BC9C133001971A4 /* SUSystemProfiler.m in Sources */, - 726F2CE11BC9C100001971A4 /* SULog.m in Sources */, - 726F2CE01BC9C0EF001971A4 /* SUHost.m in Sources */, - 726F2CDF1BC9C093001971A4 /* SUConstants.m in Sources */, + 726F2CE91BC9C499001971A4 /* SUOperatingSystem.m in Sources */, + 726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */, 726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */, 5D06E8E90FD68CDB005AE3F6 /* bsdiff.c in Sources */, 14652F7E19A9728A00959E44 /* bspatch.c in Sources */, @@ -1550,6 +1555,7 @@ 618FA5060DAE8AB80026945C /* SUPlainInstaller.m in Sources */, 6101347C0DD2541A0049ACDF /* SUProbingUpdateDriver.m in Sources */, 61B93C0A0DD112FF00DCD2F8 /* SUScheduledUpdateDriver.m in Sources */, + 726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */, 61A225A50D1C4AC000430CCD /* SUStandardVersionComparator.m in Sources */, 6196CFFA09C72149000DC222 /* SUStatusController.m in Sources */, 61A2279D0D1CEE7600430CCD /* SUSystemProfiler.m in Sources */, diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 173ce204..bbda2e3a 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -9,6 +9,7 @@ #import "SUBasicUpdateDriver.h" #import "SUHost.h" +#import "SUOperatingSystem.h" #import "SUDSAVerifier.h" #import "SUInstaller.h" #import "SUStandardVersionComparator.h" @@ -96,10 +97,10 @@ // Check minimum and maximum System Version if ([ui minimumSystemVersion] != nil && ![[ui minimumSystemVersion] isEqualToString:@""]) { - minimumVersionOK = [[SUStandardVersionComparator defaultComparator] compareVersion:[ui minimumSystemVersion] toVersion:[SUHost systemVersionString]] != NSOrderedDescending; + minimumVersionOK = [[SUStandardVersionComparator defaultComparator] compareVersion:[ui minimumSystemVersion] toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedDescending; } if ([ui maximumSystemVersion] != nil && ![[ui maximumSystemVersion] isEqualToString:@""]) { - maximumVersionOK = [[SUStandardVersionComparator defaultComparator] compareVersion:[ui maximumSystemVersion] toVersion:[SUHost systemVersionString]] != NSOrderedAscending; + maximumVersionOK = [[SUStandardVersionComparator defaultComparator] compareVersion:[ui maximumSystemVersion] toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedAscending; } return minimumVersionOK && maximumVersionOK; diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index fa36a997..3cdf5f65 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -7,7 +7,7 @@ // #import "SUFileManager.h" -#import "SUHost.h" +#import "SUOperatingSystem.h" #include #include @@ -846,7 +846,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza NSURL *trashURL = nil; BOOL canUseNewTrashAPI = YES; #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1080 - canUseNewTrashAPI = [SUHost isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 8, 0}]; + canUseNewTrashAPI = [SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 8, 0}]; if (!canUseNewTrashAPI) { FSRef trashRef; if (FSFindFolder(kUserDomain, kTrashFolderType, kDontCreateFolder, &trashRef) == noErr) { diff --git a/Sparkle/SUHost.h b/Sparkle/SUHost.h index 127f2d99..5f73f955 100644 --- a/Sparkle/SUHost.h +++ b/Sparkle/SUHost.h @@ -23,10 +23,6 @@ typedef struct { @property (strong, readonly) NSBundle *bundle; -+ (NSOperatingSystemVersion)operatingSystemVersion; -+ (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version; -+ (NSString *)systemVersionString; - - (instancetype)initWithBundle:(NSBundle *)aBundle; @property (readonly, copy) NSString *bundlePath; @property (readonly) BOOL allowsAutomaticUpdates; diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index 57bd8f25..c49ba368 100644 --- a/Sparkle/SUHost.m +++ b/Sparkle/SUHost.m @@ -284,43 +284,4 @@ return [self objectForUserDefaultsKey:key] ? [self boolForUserDefaultsKey:key] : [self boolForInfoDictionaryKey:key]; } -+ (NSOperatingSystemVersion)operatingSystemVersion -{ -#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101000 -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wselector" - // Xcode 5.1.1: operatingSystemVersion is clearly declared, must warn due to a compiler bug? - if (![NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) -#pragma clang diagnostic pop - { - NSOperatingSystemVersion version = { 0, 0, 0 }; - NSURL *coreServices = [[NSFileManager defaultManager] URLForDirectory:NSCoreServiceDirectory inDomain:NSSystemDomainMask appropriateForURL:nil create:NO error:nil]; - NSArray *components = [[NSDictionary dictionaryWithContentsOfURL:[coreServices URLByAppendingPathComponent:@"SystemVersion.plist"]][@"ProductVersion"] componentsSeparatedByString:@"."]; - version.majorVersion = components.count > 0 ? [components[0] integerValue] : 0; - version.minorVersion = components.count > 1 ? [components[1] integerValue] : 0; - version.patchVersion = components.count > 2 ? [components[2] integerValue] : 0; - return version; - } -#endif - return [[NSProcessInfo processInfo] operatingSystemVersion]; -} - -+ (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version -{ - const NSOperatingSystemVersion systemVersion = self.operatingSystemVersion; - if (systemVersion.majorVersion == version.majorVersion) { - if (systemVersion.minorVersion == version.minorVersion) { - return systemVersion.patchVersion >= version.patchVersion; - } - return systemVersion.minorVersion >= version.minorVersion; - } - return systemVersion.majorVersion >= version.majorVersion; -} - -+ (NSString *)systemVersionString -{ - NSOperatingSystemVersion version = self.operatingSystemVersion; - return [NSString stringWithFormat:@"%ld.%ld.%ld", (long)version.majorVersion, (long)version.minorVersion, (long)version.patchVersion]; -} - @end diff --git a/Sparkle/SUOperatingSystem.h b/Sparkle/SUOperatingSystem.h new file mode 100644 index 00000000..bd65275f --- /dev/null +++ b/Sparkle/SUOperatingSystem.h @@ -0,0 +1,16 @@ +// +// SUOperatingSystem.h +// Sparkle +// +// Copyright © 2015 Sparkle Project. All rights reserved. +// + +#import + +@interface SUOperatingSystem : NSObject + ++ (NSOperatingSystemVersion)operatingSystemVersion; ++ (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version; ++ (NSString *)systemVersionString; + +@end diff --git a/Sparkle/SUOperatingSystem.m b/Sparkle/SUOperatingSystem.m new file mode 100644 index 00000000..85c18ebc --- /dev/null +++ b/Sparkle/SUOperatingSystem.m @@ -0,0 +1,51 @@ +// +// SUOperatingSystem.m +// Sparkle +// +// Copyright © 2015 Sparkle Project. All rights reserved. +// + +#import "SUOperatingSystem.h" + +@implementation SUOperatingSystem + ++ (NSOperatingSystemVersion)operatingSystemVersion +{ +#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101000 +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wselector" + // Xcode 5.1.1: operatingSystemVersion is clearly declared, must warn due to a compiler bug? + if (![NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) +#pragma clang diagnostic pop + { + NSOperatingSystemVersion version = { 0, 0, 0 }; + NSURL *coreServices = [[NSFileManager defaultManager] URLForDirectory:NSCoreServiceDirectory inDomain:NSSystemDomainMask appropriateForURL:nil create:NO error:nil]; + NSArray *components = [[NSDictionary dictionaryWithContentsOfURL:[coreServices URLByAppendingPathComponent:@"SystemVersion.plist"]][@"ProductVersion"] componentsSeparatedByString:@"."]; + version.majorVersion = components.count > 0 ? [components[0] integerValue] : 0; + version.minorVersion = components.count > 1 ? [components[1] integerValue] : 0; + version.patchVersion = components.count > 2 ? [components[2] integerValue] : 0; + return version; + } +#endif + return [[NSProcessInfo processInfo] operatingSystemVersion]; +} + ++ (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version +{ + const NSOperatingSystemVersion systemVersion = self.operatingSystemVersion; + if (systemVersion.majorVersion == version.majorVersion) { + if (systemVersion.minorVersion == version.minorVersion) { + return systemVersion.patchVersion >= version.patchVersion; + } + return systemVersion.minorVersion >= version.minorVersion; + } + return systemVersion.majorVersion >= version.majorVersion; +} + ++ (NSString *)systemVersionString +{ + NSOperatingSystemVersion version = self.operatingSystemVersion; + return [NSString stringWithFormat:@"%ld.%ld.%ld", (long)version.majorVersion, (long)version.minorVersion, (long)version.patchVersion]; +} + +@end diff --git a/Sparkle/SUSystemProfiler.m b/Sparkle/SUSystemProfiler.m index 26bbfe9a..1a155e83 100644 --- a/Sparkle/SUSystemProfiler.m +++ b/Sparkle/SUSystemProfiler.m @@ -11,6 +11,7 @@ #import "SUSystemProfiler.h" #import "SUHost.h" +#import "SUOperatingSystem.h" #include static NSString *const SUSystemProfilerApplicationNameKey = @"appName"; @@ -53,7 +54,7 @@ static NSString *const SUSystemProfilerPreferredLanguageKey = @"lang"; size_t length = sizeof(value); // OS version - NSString *currentSystemVersion = [SUHost systemVersionString]; + NSString *currentSystemVersion = [SUOperatingSystem systemVersionString]; if (currentSystemVersion != nil) { [profileArray addObject:[NSDictionary dictionaryWithObjects:@[SUSystemProfilerOperatingSystemVersionKey, @"OS Version", currentSystemVersion, currentSystemVersion] forKeys:profileDictKeys]]; } diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index 11bbc044..261e84c5 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -11,6 +11,7 @@ #import "SUUpdateAlert.h" #import "SUUpdater_Private.h" #import "SUHost.h" +#import "SUOperatingSystem.h" #import "SUStatusController.h" #import "SUConstants.h" @@ -143,7 +144,7 @@ - (NSString *)localizedStringFromByteCount:(long long)value { - if (![SUHost isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 8, 0}]) { + if (![SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 8, 0}]) { if (value < 1000) { return [NSString stringWithFormat:@"%.0lf %@", value / 1.0, SULocalizedString(@"B", @"the unit for bytes")]; From 9f1884f100ae5f9694eae66f31208c33f314435d Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 10 Oct 2015 18:23:45 -0400 Subject: [PATCH 09/11] Add compile sources to Test App to fix building issues --- Sparkle.xcodeproj/project.pbxproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index df84dc9f..1f43d726 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -176,6 +176,9 @@ 726F2CE71BC9C3E2001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; 726F2CE91BC9C499001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; + 726F2CEA1BC9C708001971A4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; + 726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; + 726F2CEC1BC9C74F001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 7275F9C11B5F1F2900B1D19E /* SUFileManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */; }; 7275F9C21B5F1F2900B1D19E /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; 7275F9C31B5F1F2900B1D19E /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; @@ -1521,6 +1524,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 726F2CEC1BC9C74F001971A4 /* SUOperatingSystem.m in Sources */, + 726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */, + 726F2CEA1BC9C708001971A4 /* SUFileManager.m in Sources */, 61B5F93009C4CFDC00B25A18 /* main.m in Sources */, 72E45CF31B640CDD005C701A /* SUTestApplicationDelegate.m in Sources */, 72E45CF71B640DAE005C701A /* SUUpdateSettingsWindowController.m in Sources */, From 9cf74373925df293b5af34518814982836821324 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 17 Oct 2015 14:47:16 -0400 Subject: [PATCH 10/11] Update explanation of why copyfile() is insufficient --- Sparkle/SUFileManager.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 3cdf5f65..bb989240 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -310,9 +310,10 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza /* * Copies an item from one location to another * This intentionally does *not* use copyfile() or any API that uses it such as NSFileManager's copy item method - * This is because copyfile() fails to copy symbolic links from one network mount to another, which will affect copying apps - * This failure has been reproduced on 10.11.0 and a VM running 10.8, so the issue has existed for a while. - * For more info, see the bug report at http://openradar.appspot.com/radar?id=4925873463492608 + * This is because copyfile() can fail to copy symbolic links from one network mount to another, which will affect copying apps + * This failure occurs because the system may think symbolic links on a SMB mount are zero bytes in size + * For more info, see bug reports at http://openradar.appspot.com/radar?id=4925873463492608 + * and http://openradar.appspot.com/radar?id=5024037222744064 */ - (BOOL)copyItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError * __autoreleasing *)error { From 896a01cd409a3a65ee2fba20ca50c185148adc6b Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 8 Nov 2015 17:00:27 -0500 Subject: [PATCH 11/11] Remove compiled classes in the Test App that exist in the framework This removes run-time warnings that SUFileManager and SUOperatingSystem are defined in both the test app and the framework, and which one is used is undefined. --- Sparkle.xcodeproj/project.pbxproj | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 849a60fe..654ceaaa 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -171,14 +171,12 @@ 7223E7631AD1AEFF008E3161 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; }; 7268AC631AD634C200C3E0C1 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */; }; 726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; - 726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */; settings = {ASSET_TAGS = (); }; }; - 726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; settings = {ASSET_TAGS = (); }; }; + 726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */; }; + 726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 726F2CE71BC9C3E2001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; 726F2CE91BC9C499001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; - 726F2CEA1BC9C708001971A4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; 726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; - 726F2CEC1BC9C74F001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 7275F9C11B5F1F2900B1D19E /* SUFileManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */; }; 7275F9C21B5F1F2900B1D19E /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; 7275F9C31B5F1F2900B1D19E /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; @@ -199,7 +197,7 @@ 767B61AC1972D488004E0C3C /* SUGuidedPackageInstaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 767B61AA1972D488004E0C3C /* SUGuidedPackageInstaller.h */; }; 767B61AD1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; }; 767B61AE1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; }; - A5BF4F1D1BC7668B007A052A /* SUTestWebServer.m in Sources */ = {isa = PBXBuildFile; fileRef = A5BF4F1C1BC7668B007A052A /* SUTestWebServer.m */; settings = {ASSET_TAGS = (); }; }; + A5BF4F1D1BC7668B007A052A /* SUTestWebServer.m in Sources */ = {isa = PBXBuildFile; fileRef = A5BF4F1C1BC7668B007A052A /* SUTestWebServer.m */; }; F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */; }; F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */ = {isa = PBXBuildFile; fileRef = F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */; }; F8761EB61ADC5E7A000C9034 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; }; @@ -1529,9 +1527,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 726F2CEC1BC9C74F001971A4 /* SUOperatingSystem.m in Sources */, 726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */, - 726F2CEA1BC9C708001971A4 /* SUFileManager.m in Sources */, 61B5F93009C4CFDC00B25A18 /* main.m in Sources */, A5BF4F1D1BC7668B007A052A /* SUTestWebServer.m in Sources */, 72E45CF31B640CDD005C701A /* SUTestApplicationDelegate.m in Sources */,