diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index c4449780..f3bc48a2 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -337,9 +337,17 @@ static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installa - (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler { dispatch_async(dispatch_get_main_queue(), ^{ - NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath]; BOOL needsSystemAuthorization = SPUNeedsSystemAuthorizationAccess(hostBundlePath, installationType); + NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath]; + if (hostBundle == nil) { + SULog(SULogLevelError, @"InstallerLauncher failed to create bundle at %@", hostBundlePath); + SULog(SULogLevelError, @"Please make sure InstallerLauncher is not sandboxed and do not sign your app by passing --deep. Check: codesign -d --entitlements :- \"%@\"", NSBundle.mainBundle.bundlePath); + SULog(SULogLevelError, @"More information regarding sandboxing: https://sparkle-project.org/documentation/sandboxing/"); + completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization); + return; + } + if (needsSystemAuthorization && !allowingUpdaterInteraction) { SULog(SULogLevelError, @"Updater is not allowing interaction to the launcher."); completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization); @@ -419,6 +427,7 @@ static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installa } } else if (installerStatus == SUInstallerLauncherFailure) { SULog(SULogLevelError, @"Failed to submit installer job"); + SULog(SULogLevelError, @"If your application is sandboxed please follow steps at: https://sparkle-project.org/documentation/sandboxing/"); } if (installerStatus == SUInstallerLauncherCanceled) { diff --git a/Sparkle.xcodeproj/xcshareddata/xcschemes/Sparkle Test App.xcscheme b/Sparkle.xcodeproj/xcshareddata/xcschemes/Sparkle Test App.xcscheme index 42120a39..a783d078 100644 --- a/Sparkle.xcodeproj/xcshareddata/xcschemes/Sparkle Test App.xcscheme +++ b/Sparkle.xcodeproj/xcshareddata/xcschemes/Sparkle Test App.xcscheme @@ -37,9 +37,11 @@ launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" + debugDocumentVersioning = "NO" debugServiceExtension = "internal" - allowLocationSimulation = "YES"> + enableGPUFrameCaptureMode = "3" + enableGPUValidationMode = "1" + allowLocationSimulation = "NO"> */ - (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(nullable id)delegate; +/*! + Use initWithHostBundle:delegate: instead. + */ +- (instancetype)init NS_UNAVAILABLE; + @end NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUAppcastDriver.m b/Sparkle/SUAppcastDriver.m index 34aa4f17..22ed5568 100644 --- a/Sparkle/SUAppcastDriver.m +++ b/Sparkle/SUAppcastDriver.m @@ -191,6 +191,7 @@ { SUAppcastItem *item = nil; for(SUAppcastItem *candidate in appcastItems) { + // Note if two items are equal, we must select the first matching one if (!item || [comparator compareVersion:item.versionString toVersion:candidate.versionString] == NSOrderedAscending) { item = candidate; } diff --git a/Sparkle/SUStandardVersionComparator.m b/Sparkle/SUStandardVersionComparator.m index a2958e82..77491e9a 100644 --- a/Sparkle/SUStandardVersionComparator.m +++ b/Sparkle/SUStandardVersionComparator.m @@ -33,12 +33,15 @@ typedef NS_ENUM(NSInteger, SUCharacterType) { kNumberType, kStringType, kSeparatorType, + kDashType, }; - (SUCharacterType)typeOfCharacter:(NSString *)character { if ([character isEqualToString:@"."]) { return kSeparatorType; + } else if ([character isEqualToString:@"-"]) { + return kDashType; } else if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[character characterAtIndex:0]]) { return kNumberType; } else if ([[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[character characterAtIndex:0]]) { @@ -67,6 +70,9 @@ typedef NS_ENUM(NSInteger, SUCharacterType) { for (i = 1; i <= n; ++i) { character = [version substringWithRange:NSMakeRange(i, 1)]; newType = [self typeOfCharacter:character]; + if (newType == kDashType) { + break; + } if (oldType != newType || oldType == kSeparatorType) { // We've reached a new segment NSString *aPart = [[NSString alloc] initWithString:s]; diff --git a/Sparkle/SUUpdatePermissionResponse.h b/Sparkle/SUUpdatePermissionResponse.h index e53f866f..affa087e 100644 --- a/Sparkle/SUUpdatePermissionResponse.h +++ b/Sparkle/SUUpdatePermissionResponse.h @@ -29,6 +29,11 @@ SU_EXPORT @interface SUUpdatePermissionResponse : NSObject */ - (instancetype)initWithAutomaticUpdateChecks:(BOOL)automaticUpdateChecks sendSystemProfile:(BOOL)sendSystemProfile; +/* + Use -initWithAutomaticUpdateChecks:sendSystemProfile: instead. + */ +- (instancetype)init NS_UNAVAILABLE; + /*! A read-only property indicating whether automatic update checks are allowed or not. */ diff --git a/Tests/SUVersionComparisonTest.m b/Tests/SUVersionComparisonTest.m index 6db03746..b53b8c64 100644 --- a/Tests/SUVersionComparisonTest.m +++ b/Tests/SUVersionComparisonTest.m @@ -33,6 +33,15 @@ SUAssertAscending(comparator, @"0.1", @"0.1.2"); } +- (void)testCommitSHAs +{ + SUStandardVersionComparator *comparator = [[SUStandardVersionComparator alloc] init]; + + SUAssertAscending(comparator, @"1.5.5-335d3e2", @"1.5.6-b252311"); + SUAssertEqual(comparator, @"1.5.5-335d3e2", @"1.5.5-a655360"); + SUAssertDescending(comparator, @"1.5.6-b252311", @"1.5.5-335d3e2"); +} + - (void)testPrereleases { SUStandardVersionComparator *comparator = [[SUStandardVersionComparator alloc] init];