diff --git a/Autoupdate/AppInstaller.m b/Autoupdate/AppInstaller.m index ead4e59a..b798df38 100644 --- a/Autoupdate/AppInstaller.m +++ b/Autoupdate/AppInstaller.m @@ -550,7 +550,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; NSString *installationPath = [self.installer installationPath]; NSError *thirdStageError = nil; - if (![self.installer performFinalInstallation:&thirdStageError]) { + if (![self.installer performFinalInstallationProgressBlock:nil error:&thirdStageError]) { SULog(SULogLevelError, @"Failed to finalize installation with error: %@", thirdStageError); self.installer = nil; diff --git a/Autoupdate/SUBinaryDeltaApply.m b/Autoupdate/SUBinaryDeltaApply.m index ea93b2be..46c4ee1a 100644 --- a/Autoupdate/SUBinaryDeltaApply.m +++ b/Autoupdate/SUBinaryDeltaApply.m @@ -28,7 +28,7 @@ static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFil return success; } -BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, BOOL verbose, void (^progressCallback)(double progress), NSError * __autoreleasing *error) +BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, BOOL verbose, void (^progressCallback)(double progress), NSError *__autoreleasing *error) { xar_t x = xar_open([patchFile fileSystemRepresentation], READ); if (!x) { @@ -37,71 +37,71 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi } return NO; } - + SUBinaryDeltaMajorVersion majorDiffVersion = FIRST_DELTA_DIFF_MAJOR_VERSION; - SUBinaryDeltaMinorVersion minorDiffVersion = FIRST_DELTA_DIFF_MINOR_VERSION; + int minorDiffVersion = 0; NSString *expectedBeforeHashv1 = nil; NSString *expectedAfterHashv1 = nil; - + NSString *expectedNewBeforeHash = nil; NSString *expectedNewAfterHash = nil; - + progressCallback(0/6.0); xar_subdoc_t subdoc; for (subdoc = xar_subdoc_first(x); subdoc; subdoc = xar_subdoc_next(subdoc)) { if (!strcmp(xar_subdoc_name(subdoc), BINARY_DELTA_ATTRIBUTES_KEY)) { const char *value = 0; - + // available in version 2.0 or later xar_subdoc_prop_get(subdoc, MAJOR_DIFF_VERSION_KEY, &value); if (value) majorDiffVersion = (SUBinaryDeltaMajorVersion)[@(value) intValue]; - + // available in version 2.0 or later xar_subdoc_prop_get(subdoc, MINOR_DIFF_VERSION_KEY, &value); if (value) - minorDiffVersion = (SUBinaryDeltaMinorVersion)[@(value) intValue]; - + minorDiffVersion = [@(value) intValue]; + // available in version 2.0 or later xar_subdoc_prop_get(subdoc, BEFORE_TREE_SHA1_KEY, &value); if (value) expectedNewBeforeHash = @(value); - + // available in version 2.0 or later xar_subdoc_prop_get(subdoc, AFTER_TREE_SHA1_KEY, &value); if (value) expectedNewAfterHash = @(value); - + // only available in version 1.0 xar_subdoc_prop_get(subdoc, BEFORE_TREE_SHA1_OLD_KEY, &value); if (value) expectedBeforeHashv1 = @(value); - + // only available in version 1.0 xar_subdoc_prop_get(subdoc, AFTER_TREE_SHA1_OLD_KEY, &value); if (value) expectedAfterHashv1 = @(value); } } - + if (majorDiffVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) { if (error != NULL) { *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to identify diff-version %u in delta. Giving up.", majorDiffVersion] }]; } return NO; } - + if (majorDiffVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) { if (error != NULL) { *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A later version is needed to apply this patch (on major version %u, but patch requests version %u).", LATEST_DELTA_DIFF_MAJOR_VERSION, majorDiffVersion] }]; } return NO; } - + BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion); - + NSString *expectedBeforeHash = usesNewTreeHash ? expectedNewBeforeHash : expectedBeforeHashv1; NSString *expectedAfterHash = usesNewTreeHash ? expectedNewAfterHash : expectedAfterHashv1; @@ -116,7 +116,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi fprintf(stderr, "Applying version %u.%u patch...\n", majorDiffVersion, minorDiffVersion); fprintf(stderr, "Verifying source..."); } - + progressCallback(1/6.0); NSString *beforeHash = hashOfTreeWithVersion(source, majorDiffVersion); @@ -143,7 +143,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi if (verbose) { fprintf(stderr, "\nCopying files..."); } - + progressCallback(2/6.0); if (!removeTree(destination)) { @@ -167,7 +167,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi } return NO; } - + progressCallback(4/6.0); BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion); @@ -186,10 +186,9 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi // Don't use -[NSFileManager fileExistsAtPath:] because it will follow symbolic links BOOL fileExisted = verbose && [fileManager attributesOfItemAtPath:destinationFilePath error:nil]; BOOL removedFile = NO; - + const char *value; - if (!xar_prop_get(file, DELETE_KEY, &value) || - (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) { + if (!xar_prop_get(file, DELETE_KEY, &value) || (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) { if (!removeTree(destinationFilePath)) { if (verbose) { fprintf(stderr, "\n"); @@ -205,7 +204,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi } continue; } - + removedFile = YES; } @@ -219,13 +218,12 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi } return NO; } - + if (verbose) { fprintf(stderr, "\n🔨 %s %s", VERBOSE_PATCHED, [path fileSystemRepresentation]); } - } else if ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) || - (!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist - + } else if ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) || (!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist + if (xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]) != 0) { if (verbose) { fprintf(stderr, "\n"); @@ -235,7 +233,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi } return NO; } - + if (verbose) { if (fileExisted) { fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [path fileSystemRepresentation]); @@ -246,7 +244,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi } else if (verbose && removedFile) { fprintf(stderr, "\n❌ %s %s", VERBOSE_DELETED, [path fileSystemRepresentation]); } - + if (!xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value)) { mode_t mode = (mode_t)[[NSString stringWithUTF8String:value] intValue]; if (!modifyPermissions(destinationFilePath, mode)) { @@ -258,7 +256,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi } return NO; } - + if (verbose) { fprintf(stderr, "\n👮 %s %s (0%o)", VERBOSE_MODIFIED, [path fileSystemRepresentation], mode); } diff --git a/Autoupdate/SUBinaryDeltaCommon.h b/Autoupdate/SUBinaryDeltaCommon.h index 3e7db6c6..c1e80812 100644 --- a/Autoupdate/SUBinaryDeltaCommon.h +++ b/Autoupdate/SUBinaryDeltaCommon.h @@ -57,16 +57,7 @@ typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion) SUBeigeMajorVersion = 2 }; -// Only keep track of the latest minor version for each major version -typedef NS_ENUM(uint16_t, SUBinaryDeltaMinorVersion) -{ - SUAzureMinorVersion = 1, - SUBeigeMinorVersion = 1, -}; - #define FIRST_DELTA_DIFF_MAJOR_VERSION SUAzureMajorVersion -#define FIRST_DELTA_DIFF_MINOR_VERSION ((SUBinaryDeltaMinorVersion)0) - #define LATEST_DELTA_DIFF_MAJOR_VERSION SUBeigeMajorVersion extern int compareFiles(const FTSENT **a, const FTSENT **b); @@ -80,5 +71,5 @@ extern NSString *pathRelativeToDirectory(NSString *directory, NSString *path); NSString *temporaryFilename(NSString *base); NSString *temporaryDirectory(NSString *base); NSString *stringWithFileSystemRepresentation(const char*); -SUBinaryDeltaMinorVersion latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion); +int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion); #endif diff --git a/Autoupdate/SUBinaryDeltaCommon.m b/Autoupdate/SUBinaryDeltaCommon.m index 8f4edb87..8415ca81 100644 --- a/Autoupdate/SUBinaryDeltaCommon.m +++ b/Autoupdate/SUBinaryDeltaCommon.m @@ -18,7 +18,6 @@ #include #include - #include "AppKitPrevention.h" int compareFiles(const FTSENT **a, const FTSENT **b) @@ -35,19 +34,20 @@ NSString *pathRelativeToDirectory(NSString *directory, NSString *path) return path; } -NSString *stringWithFileSystemRepresentation(const char *input) { +NSString *stringWithFileSystemRepresentation(const char *input) +{ return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:input length:strlen(input)]; } -SUBinaryDeltaMinorVersion latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion) +int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion) { switch (majorVersion) { case SUAzureMajorVersion: - return SUAzureMinorVersion; + return 1; case SUBeigeMajorVersion: - return SUBeigeMinorVersion; + return 2; } - return (SUBinaryDeltaMinorVersion)0; + return 0; } NSString *temporaryFilename(NSString *base) @@ -76,18 +76,18 @@ NSString *temporaryDirectory(NSString *base) NSString *template = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.XXXXXXXXXX", base]]; NSMutableData *data = [NSMutableData data]; [data appendBytes:template.fileSystemRepresentation length:strlen(template.fileSystemRepresentation) + 1]; - + char *buffer = data.mutableBytes; char *templateResult = mkdtemp(buffer); if (templateResult == NULL) { perror("mkdtemp"); return nil; } - + return stringWithFileSystemRepresentation(templateResult); } -static void _hashOfBuffer(unsigned char *hash, const char* buffer, ssize_t bufferLength) +static void _hashOfBuffer(unsigned char *hash, const char *buffer, ssize_t bufferLength) { assert(bufferLength >= 0 && bufferLength <= UINT32_MAX); CC_SHA1_CTX hashContext; @@ -96,7 +96,7 @@ static void _hashOfBuffer(unsigned char *hash, const char* buffer, ssize_t buffe CC_SHA1_Final(hash, &hashContext); } -static BOOL _hashOfFileContents(unsigned char* hash, FTSENT *ent) +static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent) { if (ent->fts_info == FTS_SL) { char linkDestination[MAXPATHLEN + 1]; @@ -119,12 +119,12 @@ static BOOL _hashOfFileContents(unsigned char* hash, FTSENT *ent) _hashOfBuffer(hash, NULL, 0); } else { void *buffer = mmap(0, (size_t)fileSize, PROT_READ, MAP_FILE | MAP_PRIVATE, fileDescriptor, 0); - if (buffer == (void*)-1) { + if (buffer == (void *)-1) { close(fileDescriptor); perror("mmap"); return NO; } - + _hashOfBuffer(hash, buffer, fileSize); munmap(buffer, (size_t)fileSize); } @@ -148,12 +148,12 @@ NSData *hashOfFileContents(FTSENT *ent) NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion) { - char pathBuffer[PATH_MAX] = {0}; + char pathBuffer[PATH_MAX] = { 0 }; if (![path getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]) { return nil; } - char * const sourcePaths[] = {pathBuffer, 0}; + char *const sourcePaths[] = { pathBuffer, 0 }; FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles); if (!fts) { perror("fts_open"); @@ -163,16 +163,19 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion) CC_SHA1_CTX hashContext; CC_SHA1_Init(&hashContext); + // Ensure the path uses filesystem-specific Unicode normalization #1017 + NSString *normalizedPath = stringWithFileSystemRepresentation(pathBuffer); + FTSENT *ent = 0; while ((ent = fts_read(fts))) { if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) continue; - + if (ent->fts_info == FTS_D && !MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) { continue; } - - NSString *relativePath = pathRelativeToDirectory(path, stringWithFileSystemRepresentation(ent->fts_path)); + + NSString *relativePath = pathRelativeToDirectory(normalizedPath, stringWithFileSystemRepresentation(ent->fts_path)); if (relativePath.length == 0) continue; @@ -184,12 +187,12 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion) const char *relativePathBytes = [relativePath fileSystemRepresentation]; CC_SHA1_Update(&hashContext, relativePathBytes, (CC_LONG)strlen(relativePathBytes)); - + if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) { uint16_t mode = ent->fts_statp->st_mode; uint16_t type = ent->fts_info; uint16_t permissions = mode & PERMISSION_FLAGS; - + CC_SHA1_Update(&hashContext, &type, sizeof(type)); CC_SHA1_Update(&hashContext, &permissions, sizeof(permissions)); } diff --git a/Autoupdate/SUBinaryDeltaCreate.m b/Autoupdate/SUBinaryDeltaCreate.m index b0dfa3ef..2f3b3fdf 100644 --- a/Autoupdate/SUBinaryDeltaCreate.m +++ b/Autoupdate/SUBinaryDeltaCreate.m @@ -21,7 +21,6 @@ #include #include - #include "AppKitPrevention.h" extern int bsdiff(int argc, const char **argv); @@ -59,7 +58,7 @@ extern int bsdiff(int argc, const char **argv); - (void)main { NSString *temporaryFile = temporaryFilename(@"BinaryDelta"); - const char *argv[] = {"/usr/bin/bsdiff", [self._fromPath fileSystemRepresentation], [self._toPath fileSystemRepresentation], [temporaryFile fileSystemRepresentation]}; + const char *argv[] = { "/usr/bin/bsdiff", [self._fromPath fileSystemRepresentation], [self._toPath fileSystemRepresentation], [temporaryFile fileSystemRepresentation] }; int result = bsdiff(4, argv); if (!result) self.resultPath = temporaryFile; @@ -78,14 +77,17 @@ static NSDictionary *infoForFile(FTSENT *ent) if (!hash) { return nil; } - + off_t size = (ent->fts_info != FTS_D) ? ent->fts_statp->st_size : 0; - + assert(ent->fts_statp != NULL); - + mode_t permissions = ent->fts_statp->st_mode & PERMISSION_FLAGS; - - return @{INFO_HASH_KEY: hash, INFO_TYPE_KEY: @(ent->fts_info), INFO_PERMISSIONS_KEY : @(permissions), INFO_SIZE_KEY: @(size)}; + + return @{ INFO_HASH_KEY: hash, + INFO_TYPE_KEY: @(ent->fts_info), + INFO_PERMISSIONS_KEY: @(permissions), + INFO_SIZE_KEY: @(size) }; } static bool aclExists(const FTSENT *ent) @@ -94,7 +96,7 @@ static bool aclExists(const FTSENT *ent) if (ent->fts_info == FTS_SL) { return NO; } - + acl_t acl = acl_get_link_np(ent->fts_path, ACL_TYPE_EXTENDED); if (acl != NULL) { acl_entry_t entry; @@ -112,28 +114,26 @@ static bool codeSignatureExtendedAttributeExists(const FTSENT *ent) if (listSize == -1) { return false; } - + char *buffer = malloc((size_t)listSize); assert(buffer != NULL); - + ssize_t sizeBack = listxattr(ent->fts_path, buffer, (size_t)listSize, options); assert(sizeBack == listSize); - + size_t startCharacterIndex = 0; for (size_t characterIndex = 0; characterIndex < (size_t)listSize; characterIndex++) { if (buffer[characterIndex] == '\0') { char *attribute = &buffer[startCharacterIndex]; size_t length = characterIndex - startCharacterIndex; - if (strncmp(APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY, attribute, length) == 0 || - strncmp(APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY, attribute, length) == 0 || - strncmp(APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY, attribute, length) == 0) { + if (strncmp(APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY, attribute, length) == 0 || strncmp(APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY, attribute, length) == 0 || strncmp(APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY, attribute, length) == 0) { free(buffer); return true; } startCharacterIndex = characterIndex + 1; } } - + free(buffer); return false; } @@ -141,7 +141,7 @@ static bool codeSignatureExtendedAttributeExists(const FTSENT *ent) static NSString *absolutePath(NSString *path) { NSURL *url = [[NSURL alloc] initFileURLWithPath:path]; - return [[url absoluteURL] path]; + return [[url absoluteURL] path]; } static NSString *temporaryPatchFile(NSString *patchFile) @@ -154,7 +154,7 @@ static NSString *temporaryPatchFile(NSString *patchFile) #define MIN_FILE_SIZE_FOR_CREATING_DELTA 4096 -static BOOL shouldSkipDeltaCompression(NSDictionary* originalInfo, NSDictionary *newInfo) +static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary *newInfo) { unsigned long long fileSize = [newInfo[INFO_SIZE_KEY] unsignedLongLongValue]; if (fileSize < MIN_FILE_SIZE_FOR_CREATING_DELTA) { @@ -168,7 +168,7 @@ static BOOL shouldSkipDeltaCompression(NSDictionary* originalInfo, NSDictionary if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) { return YES; } - + if ([originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) { // this is possible if just the permissions have changed return YES; @@ -177,7 +177,7 @@ static BOOL shouldSkipDeltaCompression(NSDictionary* originalInfo, NSDictionary return NO; } -static BOOL shouldDeleteThenExtract(NSDictionary* originalInfo, NSDictionary *newInfo) +static BOOL shouldDeleteThenExtract(NSDictionary *originalInfo, NSDictionary *newInfo) { if (!originalInfo) { return NO; @@ -195,15 +195,15 @@ static BOOL shouldSkipExtracting(NSDictionary *originalInfo, NSDictionary *newIn if (!originalInfo) { return NO; } - + if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) { return NO; } - + if (![originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) { return NO; } - + return YES; } @@ -212,30 +212,30 @@ static BOOL shouldChangePermissions(NSDictionary *originalInfo, NSDictionary *ne if (!originalInfo) { return NO; } - + if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) { return NO; } - + if ([originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) { return NO; } - + return YES; } -BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, BOOL verbose, NSError * __autoreleasing *error) +BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, BOOL verbose, NSError *__autoreleasing *error) { assert(source); assert(destination); assert(patchFile); assert(majorVersion >= FIRST_DELTA_DIFF_MAJOR_VERSION && majorVersion <= LATEST_DELTA_DIFF_MAJOR_VERSION); - - SUBinaryDeltaMinorVersion minorVersion = latestMinorVersionForMajorVersion(majorVersion); - + + int minorVersion = latestMinorVersionForMajorVersion(majorVersion); + NSMutableDictionary *originalTreeState = [NSMutableDictionary dictionary]; - char pathBuffer[PATH_MAX] = {0}; + char pathBuffer[PATH_MAX] = { 0 }; if (![source getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]) { if (error != NULL) { *error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to retrieve file system path representation from source %@", source] }]; @@ -243,7 +243,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF return NO; } - char *sourcePaths[] = {pathBuffer, 0}; + char *sourcePaths[] = { pathBuffer, 0 }; FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles); if (!fts) { if (error != NULL) { @@ -256,7 +256,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF fprintf(stderr, "Creating version %u.%u patch...\n", majorVersion, minorVersion); fprintf(stderr, "Processing %s...", [source fileSystemRepresentation]); } - + FTSENT *ent = 0; while ((ent = fts_read(fts))) { if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) { @@ -279,7 +279,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF return NO; } originalTreeState[key] = info; - + if (aclExists(ent)) { if (verbose) { fprintf(stderr, "\n"); @@ -289,7 +289,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } return NO; } - + if (codeSignatureExtendedAttributeExists(ent)) { if (verbose) { fprintf(stderr, "\n"); @@ -301,7 +301,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } } fts_close(fts); - + NSString *beforeHash = hashOfTreeWithVersion(source, majorVersion); if (!beforeHash) { @@ -315,8 +315,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } NSMutableDictionary *newTreeState = [NSMutableDictionary dictionary]; - for (NSString *key in originalTreeState) - { + for (NSString *key in originalTreeState) { newTreeState[key] = [NSNull null]; } @@ -334,7 +333,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } return NO; } - + sourcePaths[0] = pathBuffer; fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles); if (!fts) { @@ -344,7 +343,6 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF return NO; } - while ((ent = fts_read(fts))) { if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) { continue; @@ -365,13 +363,13 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } return NO; } - + // We should validate permissions and ACLs even if we don't store the info in the diff in the case of ACLs, // or in the case of permissions if the patch version is 1 - + // We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these // inside an application, and since we don't preserve extended attribitutes anyway - + mode_t permissions = [info[INFO_PERMISSIONS_KEY] unsignedShortValue]; if (!IS_VALID_PERMISSIONS(permissions)) { if (verbose) { @@ -382,7 +380,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } return NO; } - + if (aclExists(ent)) { if (verbose) { fprintf(stderr, "\n"); @@ -392,7 +390,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } return NO; } - + if (codeSignatureExtendedAttributeExists(ent)) { if (verbose) { fprintf(stderr, "\n"); @@ -402,14 +400,14 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } return NO; } - + NSDictionary *oldInfo = originalTreeState[key]; if ([info isEqual:oldInfo]) { [newTreeState removeObjectForKey:key]; } else { newTreeState[key] = info; - + if (oldInfo && [oldInfo[INFO_TYPE_KEY] unsignedShortValue] == FTS_D && [info[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) { NSArray *parentPathComponents = key.pathComponents; @@ -435,7 +433,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } return NO; } - + if (verbose) { fprintf(stderr, "\nGenerating delta..."); } @@ -451,20 +449,18 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } return NO; } - + xar_opt_set(x, XAR_OPT_COMPRESSION, "bzip2"); - + xar_subdoc_t attributes = xar_subdoc_new(x, BINARY_DELTA_ATTRIBUTES_KEY); - + xar_subdoc_prop_set(attributes, MAJOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", majorVersion] UTF8String]); xar_subdoc_prop_set(attributes, MINOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", minorVersion] UTF8String]); - + // Version 1 patches don't have a major or minor version field, so we need to differentiate between the hash keys - const char *beforeHashKey = - MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY; - const char *afterHashKey = - MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY; - + const char *beforeHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY; + const char *afterHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY; + xar_subdoc_prop_set(attributes, beforeHashKey, [beforeHash UTF8String]); xar_subdoc_prop_set(attributes, afterHashKey, [afterHash UTF8String]); @@ -474,21 +470,21 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF // Sort the keys by preferring the ones from the original tree to appear first // We want to enforce deleting before extracting in the case paths differ only by case NSArray *keys = [[newTreeState allKeys] sortedArrayUsingComparator:^NSComparisonResult(NSString *key1, NSString *key2) { - NSComparisonResult insensitiveCompareResult = [key1 caseInsensitiveCompare:key2]; - if (insensitiveCompareResult != NSOrderedSame) { - return insensitiveCompareResult; - } + NSComparisonResult insensitiveCompareResult = [key1 caseInsensitiveCompare:key2]; + if (insensitiveCompareResult != NSOrderedSame) { + return insensitiveCompareResult; + } - return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending; + return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending; }]; - for (NSString* key in keys) { + for (NSString *key in keys) { id value = [newTreeState valueForKey:key]; if ([value isEqual:[NSNull null]]) { xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1); assert(newFile); xar_prop_set(newFile, DELETE_KEY, "true"); - + if (verbose) { fprintf(stderr, "\n❌ %s %s", VERBOSE_REMOVED, [key fileSystemRepresentation]); } @@ -503,7 +499,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1); assert(newFile); xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]); - + if (verbose) { fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [key fileSystemRepresentation], [originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue], [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]); } @@ -512,7 +508,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF NSString *path = [destination stringByAppendingPathComponent:key]; xar_file_t newFile = xar_add_frompath(x, 0, [key fileSystemRepresentation], [path fileSystemRepresentation]); assert(newFile); - + if (shouldDeleteThenExtract(originalInfo, newInfo)) { if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) { xar_prop_set(newFile, DELETE_KEY, "true"); @@ -520,11 +516,11 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF xar_prop_set(newFile, DELETE_THEN_EXTRACT_OLD_KEY, "true"); } } - + if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) { xar_prop_set(newFile, EXTRACT_KEY, "true"); } - + if (verbose) { if (originalInfo) { fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [key fileSystemRepresentation]); @@ -557,19 +553,19 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF } return NO; } - + if (verbose) { fprintf(stderr, "\n🔨 %s %s", VERBOSE_DIFFED, [[operation relativePath] fileSystemRepresentation]); } - + xar_file_t newFile = xar_add_frompath(x, 0, [[operation relativePath] fileSystemRepresentation], [resultPath fileSystemRepresentation]); assert(newFile); xar_prop_set(newFile, BINARY_DELTA_KEY, "true"); unlink([resultPath fileSystemRepresentation]); - + if (operation.permissions) { xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [operation.permissions unsignedShortValue]] UTF8String]); - + if (verbose) { fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [[operation relativePath] fileSystemRepresentation], operation.oldPermissions.unsignedShortValue, operation.permissions.unsignedShortValue); } @@ -581,7 +577,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF unlink([patchFile fileSystemRepresentation]); link([temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]); unlink([temporaryFile fileSystemRepresentation]); - + if (verbose) { fprintf(stderr, "\nDone!\n"); } diff --git a/Autoupdate/SUBinaryDeltaTool.m b/Autoupdate/SUBinaryDeltaTool.m index fae14ed1..64b06162 100644 --- a/Autoupdate/SUBinaryDeltaTool.m +++ b/Autoupdate/SUBinaryDeltaTool.m @@ -36,7 +36,7 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args) printUsage(programName); return NO; } - + NSUInteger numberOflagsFound = 0; NSUInteger verboseIndex = [args indexOfObject:VERBOSE_FLAG]; NSUInteger versionIndex = NSNotFound; @@ -46,22 +46,22 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args) break; } } - + if (verboseIndex != NSNotFound) { ++numberOflagsFound; } if (versionIndex != NSNotFound) { ++numberOflagsFound; } - + if (args.count - numberOflagsFound < 3) { printUsage(programName); return NO; } - + BOOL verbose = (verboseIndex != NSNotFound); NSString *versionField = (versionIndex != NSNotFound) ? args[versionIndex] : nil; - + NSArray *versionComponents = nil; if (versionField) { versionComponents = [versionField componentsSeparatedByString:@"="]; @@ -70,17 +70,17 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args) return NO; } } - + SUBinaryDeltaMajorVersion patchVersion = !versionComponents ? LATEST_DELTA_DIFF_MAJOR_VERSION : (SUBinaryDeltaMajorVersion)[[versionComponents[1] componentsSeparatedByString:@"."][0] intValue]; // ignore minor version if provided - + if (patchVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) { fprintf(stderr, "Version provided (%u) is not valid\n", patchVersion); return NO; } - + if (patchVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) { fprintf(stderr, "This program is too old to create a version %u patch, or the version number provided is invalid\n", patchVersion); return NO; @@ -92,12 +92,12 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args) [fileArgs addObject:argument]; } } - + if (fileArgs.count != 3) { printUsage(programName); return NO; } - + NSString *sourcePath = fileArgs[0]; NSString *destPath = fileArgs[1]; NSString *patchPath = fileArgs[2]; @@ -108,19 +108,19 @@ static BOOL runCreateCommand(NSString *programName, NSArray *args) fprintf(stderr, "Error: before-tree must be a directory\n"); return NO; } - + if (![[NSFileManager defaultManager] fileExistsAtPath:destPath isDirectory:&isDirectory] || !isDirectory) { printUsage(programName); fprintf(stderr, "Error: after-tree must be a directory\n"); return NO; } - + NSError *createDiffError = nil; if (!createBinaryDelta(sourcePath, destPath, patchPath, patchVersion, verbose, &createDiffError)) { fprintf(stderr, "%s\n", [createDiffError.localizedDescription UTF8String]); return NO; } - + return YES; } @@ -130,45 +130,45 @@ static BOOL runApplyCommand(NSString *programName, NSArray *args) printUsage(programName); return NO; } - + BOOL verbose = [args containsObject:VERBOSE_FLAG]; - + if (args.count == 4 && !verbose) { printUsage(programName); return NO; } - + NSMutableArray *fileArgs = [NSMutableArray array]; for (NSString *argument in args) { if (![argument isEqualToString:VERBOSE_FLAG]) { [fileArgs addObject:argument]; } } - + if (fileArgs.count != 3) { printUsage(programName); return NO; } - + BOOL isDirectory; if (![[NSFileManager defaultManager] fileExistsAtPath:fileArgs[0] isDirectory:&isDirectory] || !isDirectory) { printUsage(programName); fprintf(stderr, "Error: before-tree must be a directory\n"); return NO; } - + if (![[NSFileManager defaultManager] fileExistsAtPath:fileArgs[2] isDirectory:&isDirectory] || isDirectory) { printUsage(programName); fprintf(stderr, "Error: patch-file must be a file %d\n", isDirectory); return NO; } - + NSError *applyDiffError = nil; if (!applyBinaryDelta(fileArgs[0], fileArgs[1], fileArgs[2], verbose, ^(__unused double x){}, &applyDiffError)) { fprintf(stderr, "%s\n", [applyDiffError.localizedDescription UTF8String]); return NO; } - + return YES; } @@ -178,7 +178,7 @@ static BOOL runVersionCommand(NSString *programName, NSArray *args) printUsage(programName); return NO; } - + if (args.count == 0) { fprintf(stdout, "%u.%u\n", LATEST_DELTA_DIFF_MAJOR_VERSION, latestMinorVersionForMajorVersion(LATEST_DELTA_DIFF_MAJOR_VERSION)); } else { @@ -188,30 +188,30 @@ static BOOL runVersionCommand(NSString *programName, NSArray *args) fprintf(stderr, "Unable to open patch %s\n", [patchFile fileSystemRepresentation]); return NO; } - + SUBinaryDeltaMajorVersion majorDiffVersion = FIRST_DELTA_DIFF_MAJOR_VERSION; - SUBinaryDeltaMinorVersion minorDiffVersion = FIRST_DELTA_DIFF_MINOR_VERSION; - + int minorDiffVersion = 0; + xar_subdoc_t subdoc; for (subdoc = xar_subdoc_first(x); subdoc; subdoc = xar_subdoc_next(subdoc)) { if (!strcmp(xar_subdoc_name(subdoc), BINARY_DELTA_ATTRIBUTES_KEY)) { const char *value = 0; - + // available in version 2.0 or later xar_subdoc_prop_get(subdoc, MAJOR_DIFF_VERSION_KEY, &value); if (value) majorDiffVersion = (SUBinaryDeltaMajorVersion)[@(value) intValue]; - + // available in version 2.0 or later xar_subdoc_prop_get(subdoc, MINOR_DIFF_VERSION_KEY, &value); if (value) - minorDiffVersion = (SUBinaryDeltaMinorVersion)[@(value) intValue]; + minorDiffVersion = [@(value) intValue]; } } - + fprintf(stdout, "%u.%u\n", majorDiffVersion, minorDiffVersion); } - + return YES; } @@ -220,7 +220,7 @@ int main(int __unused argc, char __unused *argv[]) @autoreleasepool { NSArray *args = [[NSProcessInfo processInfo] arguments]; NSString *programName = [args[0] lastPathComponent]; - + if (args.count < 2) { printUsage(programName); return 1; @@ -228,7 +228,7 @@ int main(int __unused argc, char __unused *argv[]) NSString *command = args[1]; NSArray *commandArguments = [args subarrayWithRange:NSMakeRange(2, args.count - 2)]; - + BOOL result; if ([command isEqualToString:CREATE_COMMAND]) { result = runCreateCommand(programName, commandArguments); @@ -240,7 +240,7 @@ int main(int __unused argc, char __unused *argv[]) result = NO; printUsage(programName); } - + return result ? 0 : 1; } } diff --git a/Autoupdate/SUGuidedPackageInstaller.m b/Autoupdate/SUGuidedPackageInstaller.m index c23924d3..cd43bbf4 100644 --- a/Autoupdate/SUGuidedPackageInstaller.m +++ b/Autoupdate/SUGuidedPackageInstaller.m @@ -40,7 +40,7 @@ return YES; } -- (BOOL)performFinalInstallation:(NSError * __autoreleasing *)error +- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))__unused cb error:(NSError * __autoreleasing *)error { // This command *must* be run as root NSString *installerPath = @"/usr/sbin/installer"; diff --git a/Autoupdate/SUInstaller.m b/Autoupdate/SUInstaller.m index ec1a2079..bede6aa1 100644 --- a/Autoupdate/SUInstaller.m +++ b/Autoupdate/SUInstaller.m @@ -177,8 +177,10 @@ assert(bundle != nil); NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey], [[bundle bundlePath] pathExtension]]]; - - return normalizedAppPath; + + // Roundtrip string through fileSystemRepresentation to ensure it uses filesystem's Unicode normalization + // rather than arbitrary Unicode form from Info.plist - #1017 + return [NSString stringWithUTF8String:[normalizedAppPath fileSystemRepresentation]]; } @end diff --git a/Autoupdate/SUInstallerProtocol.h b/Autoupdate/SUInstallerProtocol.h index 3d788ff4..316ab46a 100644 --- a/Autoupdate/SUInstallerProtocol.h +++ b/Autoupdate/SUInstallerProtocol.h @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN // Any installation work after the user application has has been terminated. This is where the final installation work can be done. // After this stage is done, the user application may be relaunched. // Should be able to be called from non-main thread -- (BOOL)performFinalInstallation:(NSError **)error; +- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError **)error; // Indicates whether or not this installer can install the update silently in the background, without hindering the user // If this returns NO, then the installation can fail if the user did not directly request for the install to occur. diff --git a/Autoupdate/SUPackageInstaller.m b/Autoupdate/SUPackageInstaller.m index 92654742..251a0561 100644 --- a/Autoupdate/SUPackageInstaller.m +++ b/Autoupdate/SUPackageInstaller.m @@ -49,7 +49,7 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open"; return YES; } -- (BOOL)performFinalInstallation:(NSError * __autoreleasing *)error +- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))__unused cb error:(NSError *__autoreleasing*)error { // Run installer using the "open" command to ensure it is launched in front of current application. // -W = wait until the app has quit. diff --git a/Autoupdate/SUPlainInstaller.m b/Autoupdate/SUPlainInstaller.m index 5ea74426..96e69237 100644 --- a/Autoupdate/SUPlainInstaller.m +++ b/Autoupdate/SUPlainInstaller.m @@ -59,7 +59,7 @@ return trimmedVersion.length > 0 ? trimmedVersion : nil; } -- (BOOL)startInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host error:(NSError * __autoreleasing *)error +- (BOOL)startInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host progressBlock:(nullable void(^)(double))progress error:(NSError * __autoreleasing *)error { if (installationURL == nil || newURL == nil) { // this really shouldn't happen but just in case @@ -70,8 +70,9 @@ return NO; } + progress(1/10.0); SUFileManager *fileManager = [[SUFileManager alloc] init]; - + // Update the access time of our entire application before moving it into a temporary directory // The system periodically cleans up files by looking at the mod & access times, so we have to make sure they're up to date // They could be potentially be preserved when archiving an application, but also an update could just be sitting on the system for a long time @@ -91,6 +92,8 @@ return NO; } + progress(2/10.0); + // Move the new app to our temporary directory NSString *newURLLastPathComponent = newURL.lastPathComponent; NSURL *newTempURL = [tempNewDirectoryURL URLByAppendingPathComponent:newURLLastPathComponent]; @@ -100,6 +103,8 @@ return NO; } + progress(3/10.0); + // Release our new app from quarantine NSError *quarantineError = nil; if (![fileManager releaseItemFromQuarantineAtRootURL:newTempURL error:&quarantineError]) { @@ -107,6 +112,8 @@ SULog(SULogLevelError, @"Failed to release quarantine at %@ with error %@", newTempURL.path, quarantineError); } + progress(4/10.0); + NSURL *oldURL = [NSURL fileURLWithPath:host.bundlePath]; if (oldURL == nil) { // this really shouldn't happen but just in case @@ -126,6 +133,8 @@ return NO; } + progress(5/10.0); + NSError *touchError = nil; if (![fileManager updateModificationAndAccessTimeOfItemAtURL:newTempURL error:&touchError]) { // Not a fatal error, but a pretty unfortunate one @@ -133,10 +142,12 @@ SULog(SULogLevelError, @"Error: %@", touchError); } + progress(6/10.0); + // Decide on a destination name we should use for the older app when we move it around the file system NSString *oldDestinationName = oldURL.lastPathComponent.stringByDeletingPathExtension; NSString *oldDestinationNameWithPathExtension = oldURL.lastPathComponent; - + // Create a temporary directory for our old app that resides on its volume NSURL *oldDirectoryURL = oldURL.URLByDeletingLastPathComponent; NSURL *tempOldDirectoryURL = (oldDirectoryURL != nil) ? [fileManager makeTemporaryDirectoryWithPreferredName:oldDestinationName appropriateForDirectoryURL:oldDirectoryURL error:error] : nil; @@ -146,6 +157,8 @@ return NO; } + progress(7/10.0); + // Move the old app to the temporary directory NSURL *oldTempURL = [tempOldDirectoryURL URLByAppendingPathComponent:oldDestinationNameWithPathExtension]; if (![fileManager moveItemAtURL:oldURL toURL:oldTempURL error:error]) { @@ -158,6 +171,8 @@ return NO; } + progress(8/10.0); + // Move the new app to its final destination if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:error]) { SULog(SULogLevelError, @"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path); @@ -172,10 +187,14 @@ return NO; } + progress(9/10.0); + // Cleanup [fileManager removeItemAtURL:tempOldDirectoryURL error:NULL]; [fileManager removeItemAtURL:tempNewDirectoryURL error:NULL]; + progress(10/10.0); + return YES; } @@ -208,11 +227,11 @@ return YES; } -- (BOOL)performFinalInstallation:(NSError * __autoreleasing *)error +- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError *__autoreleasing*)error { // Note: we must do most installation work in the third stage due to relying on our application sitting in temporary directories. // It must not be possible for our update to sit in temporary directories for a very long time. - return [self startInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host error:error]; + return [self startInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host progressBlock:cb error:error]; } - (BOOL)canInstallSilently diff --git a/CHANGELOG b/CHANGELOG index 0683644b..d2d44059 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,23 @@ +# 1.17.0 + + * Added Touch Bar support (Bi11) + * Upgraded SULog to use logging APIs that Apple provides built-in (Zorg) + * Skip buttons are disabled if the update is marked as critical (Kornel Lesiński) + * Background updates ask OS for lower-priority networking (Kornel Lesiński) + * Refactorings to sync with upcoming 2.0 + * Added kqueue based termination listener (Zorg) + * Added AppKit prevention guards to modules that shouldn't import it (Zorg) + * Added Obj-C generics where applicable (Zorg) + * Made SUBundleIcon & SUApplicationInfo take SUHost, not NSBundle (Zorg) + * Improved -[SUHost objectForInfoDictionaryKey:] (Zorg) + * Detect and fail if any two-way dependencies exist in the project (Zorg) + * generate_appcast: + * fixed handling of multiple directories in an archive + * percent encode the filename used in the delta url (Brett Walker) + * Update Sparkle.strings (BR Lingo) + * Improved handling of non-ASCII names in delta archives (Kornel Lesiński) + * Don't touch Info.plist unless git version changes (Václav Slavík) + # 1.16.0 * Guided package installs are now the default for updating packages (Zorg) @@ -7,7 +27,6 @@ * Made manual check resume pending automatic updates instead of starting a new update (Kornel Lesiński) * Started using `length` value from RSS if HTTP doesn't give one (Zorg) * Hidden automatic updates checkbox for information only updates (Bi11) - * Fixed UI update scheduler not prompting for install & relaunch (Zorg) * Added progressbar for DMG and binary delta extraction (Kornel Lesiński) * Fixed showing of download status if we attempt a 2nd download (Zorg) * Refactorings to sync with upcoming 2.0 diff --git a/Configurations/ConfigCommon.xcconfig b/Configurations/ConfigCommon.xcconfig index 3d338bcd..14d30f79 100644 --- a/Configurations/ConfigCommon.xcconfig +++ b/Configurations/ConfigCommon.xcconfig @@ -16,7 +16,7 @@ SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0 SPARKLE_ICON_NAME = AppIcon SPARKLE_VERSION_MAJOR = 1 -SPARKLE_VERSION_MINOR = 16 +SPARKLE_VERSION_MINOR = 17 SPARKLE_VERSION_PATCH = 0 SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH) diff --git a/Configurations/set-git-version-info.sh b/Configurations/set-git-version-info.sh index f1f31624..2f2a0860 100755 --- a/Configurations/set-git-version-info.sh +++ b/Configurations/set-git-version-info.sh @@ -30,5 +30,11 @@ fi # and use it to set the CFBundleShortVersionString value export PATH="$PATH:/usr/libexec" -PlistBuddy -c "Set :CFBundleShortVersionString '$version'" \ - "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH" + +if [ -f "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH" ] ; then + oldversion=$(PlistBuddy -c "Print :CFBundleShortVersionString" "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH") +fi +if [ "$version" != "$oldversion" ] ; then + PlistBuddy -c "Set :CFBundleShortVersionString '$version'" \ + "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH" +fi diff --git a/LICENSE b/LICENSE index f4020f8d..1e9b1c6e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ Copyright (c) 2006-2013 Andy Matuschak. Copyright (c) 2009-2013 Elgato Systems GmbH. Copyright (c) 2011-2014 Kornel Lesiński. +Copyright (c) 2015-2017 Mayur Pawashe. Copyright (c) 2014 C.W. Betts. Copyright (c) 2014 Petroules Corporation. Copyright (c) 2014 Big Nerd Ranch. diff --git a/Makefile b/Makefile index 2a866944..aa89d64f 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ build: test: xcodebuild -scheme Distribution -configuration Debug test + ./objc_dep/objc_dep.py -t . uitest: xcodebuild -scheme UITests -configuration Debug test diff --git a/README.markdown b/README.markdown index 3e1c0138..49a3a0d1 100644 --- a/README.markdown +++ b/README.markdown @@ -67,12 +67,18 @@ New Sparkle classes are now prefixed with `SPU` rather than `SU`. Older classes * Build: Not sure. I have been using Xcode 7. * HTTPS server for serving updates (see [App Transport Security](http://sparkle-project.org/documentation/app-transport-security/)) -## API Visibility +## Usage + +See [getting started guide](https://sparkle-project.org/documentation/). No code is necessary, but a bit of Xcode configuration is required. + +## Development + +### API symbols Sparkle is built with `-fvisibility=hidden -fvisibility-inlines-hidden` which means no symbols are exported by default. If you are adding a symbol to the public API you must decorate the declaration with the `SU_EXPORT` macro (grep the source code for examples). -## Building the distribution package +### Building the distribution package `cd` to the root of the Sparkle source tree and run `make release`. Sparkle-*VERSION*.tar.bz2 will be created in a temporary directory and revealed in Finder after the build has completed. diff --git a/Sparkle.podspec b/Sparkle.podspec index 6a778f4f..16e7378d 100644 --- a/Sparkle.podspec +++ b/Sparkle.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Sparkle" - s.version = "1.16.0" + s.version = "1.17.0" s.summary = "A software update framework for macOS" s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers." s.homepage = "http://sparkle-project.org" diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 9815af51..e58d6cde 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -2490,7 +2490,7 @@ attributes = { CLASSPREFIX = SU; LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0830; ORGANIZATIONNAME = "Sparkle Project"; TargetAttributes = { 612279D80DB5470200AB99EA = { diff --git a/Sparkle.xcodeproj/xcshareddata/xcschemes/Distribution.xcscheme b/Sparkle.xcodeproj/xcshareddata/xcschemes/Distribution.xcscheme index 328e2254..ffa56e90 100644 --- a/Sparkle.xcodeproj/xcshareddata/xcschemes/Distribution.xcscheme +++ b/Sparkle.xcodeproj/xcshareddata/xcschemes/Distribution.xcscheme @@ -1,6 +1,6 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sparkle/CheckLocalizations.swift b/Sparkle/CheckLocalizations.swift index 431e8348..0f8e4e82 100755 --- a/Sparkle/CheckLocalizations.swift +++ b/Sparkle/CheckLocalizations.swift @@ -2,21 +2,21 @@ import Foundation -func die(msg: String) { +func die(_ msg: String) { print("ERROR: \(msg)") exit(1) } -extension NSXMLElement { +extension XMLElement { convenience init(name: String, attributes: [String: String], stringValue string: String? = nil) { self.init(name: name, stringValue: string) - setAttributesWithDictionary(attributes) + setAttributesWith(attributes) } } -let ud = NSUserDefaults.standardUserDefaults() -let sparkleRoot = ud.objectForKey("root") as? String -let htmlPath = ud.objectForKey("htmlPath") as? String +let ud = UserDefaults.standard +let sparkleRoot = ud.object(forKey: "root") as? String +let htmlPath = ud.object(forKey: "htmlPath") as? String if sparkleRoot == nil || htmlPath == nil { die("Missing arguments") } @@ -29,36 +29,36 @@ if enStringsDict == nil { let enStringsDictKeys = enStringsDict!.allKeys let dirPath = NSString(string: sparkleRoot! + "/Sparkle") -let dirContents = try! NSFileManager.defaultManager().contentsOfDirectoryAtPath(dirPath as String) +let dirContents = try! FileManager.default.contentsOfDirectory(atPath: dirPath as String) let css = "body { font-family: sans-serif; font-size: 10pt; }" + "h1 { font-size: 12pt; }" + ".missing { background-color: #FFBABA; color: #D6010E; white-space: pre; }" + ".unused { background-color: #BDE5F8; color: #00529B; white-space: pre; }" + ".unlocalized { background-color: #FEEFB3; color: #9F6000; white-space: pre; }" -var html = NSXMLDocument(rootElement: NSXMLElement(name: "html")) -html.DTD = NSXMLDTD() -html.DTD!.name = html.rootElement()!.name +var html = XMLDocument(rootElement: XMLElement(name: "html")) +html.dtd = XMLDTD() +html.dtd!.name = html.rootElement()!.name html.characterEncoding = "UTF-8" -html.documentContentKind = NSXMLDocumentContentKind.XHTMLKind -var body = NSXMLElement(name: "body") -var head = NSXMLElement(name: "head") +html.documentContentKind = XMLDocument.ContentKind.xhtml +var body = XMLElement(name: "body") +var head = XMLElement(name: "head") html.rootElement()!.addChild(head) html.rootElement()!.addChild(body) -head.addChild(NSXMLElement(name: "meta", attributes: ["charset": html.characterEncoding!])) -head.addChild(NSXMLElement(name: "title", stringValue: "Sparkle Localizations Report")) -head.addChild(NSXMLElement(name: "style", stringValue: css)) +head.addChild(XMLElement(name: "meta", attributes: ["charset": html.characterEncoding!])) +head.addChild(XMLElement(name: "title", stringValue: "Sparkle Localizations Report")) +head.addChild(XMLElement(name: "style", stringValue: css)) -let locale = NSLocale.currentLocale() +let locale = Locale.current for dirEntry in dirContents { if NSString(string: dirEntry).pathExtension != "lproj" || dirEntry == "en.lproj" { continue } - let lang = locale.displayNameForKey(NSLocaleLanguageCode, value: NSString(string: dirEntry).stringByDeletingPathExtension) - body.addChild(NSXMLElement(name: "h1", stringValue: "\(dirEntry) (\(lang!))")) + let lang = (locale as NSLocale).displayName(forKey: NSLocale.Key.languageCode, value: NSString(string: dirEntry).deletingPathExtension) + body.addChild(XMLElement(name: "h1", stringValue: "\(dirEntry) (\(lang!))")) - let stringsPath = NSString(string: dirPath.stringByAppendingPathComponent(dirEntry)).stringByAppendingPathComponent("Sparkle.strings") + let stringsPath = NSString(string: dirPath.appendingPathComponent(dirEntry)).appendingPathComponent("Sparkle.strings") let stringsDict = NSDictionary(contentsOfFile: stringsPath) if stringsDict == nil { die("Invalid strings file \(dirEntry)") @@ -70,10 +70,10 @@ for dirEntry in dirContents { var unused: [String] = [] for key in enStringsDictKeys { - let str = stringsDict?.objectForKey(key) as? String + let str = stringsDict?.object(forKey: key) as? String if str == nil { missing.append(key as! String) - } else if let enStr = enStringsDict?.objectForKey(key) as? String { + } else if let enStr = enStringsDict?.object(forKey: key) as? String { if enStr == str { unlocalized.append(key as! String) } @@ -82,7 +82,7 @@ for dirEntry in dirContents { let stringsDictKeys = stringsDict!.allKeys for key in stringsDictKeys { - if enStringsDict?.objectForKey(key) == nil { + if enStringsDict?.object(forKey: key) == nil { unused.append(key as! String) } } @@ -90,12 +90,12 @@ for dirEntry in dirContents { let sorter = { (s1: String, s2: String) -> Bool in return s1 < s2 } - missing.sortInPlace(sorter) - unlocalized.sortInPlace(sorter) - unused.sortInPlace(sorter) + missing.sort(by: sorter) + unlocalized.sort(by: sorter) + unused.sort(by: sorter) let addRow = { (prefix: String, cssClass: String, key: String) -> Void in - body.addChild(NSXMLElement(name: "span", attributes: ["class": cssClass], stringValue: [prefix, key].joinWithSeparator(" ") + "\n")) + body.addChild(XMLElement(name: "span", attributes: ["class": cssClass], stringValue: [prefix, key].joined(separator: " ") + "\n")) } for key in missing { @@ -110,6 +110,6 @@ for dirEntry in dirContents { } var err: NSError? -if !html.XMLData.writeToFile(htmlPath!, atomically: true) { - die("Can't write report: \(err)") +if !((try? html.xmlData.write(to: URL(fileURLWithPath: htmlPath!), options: [.atomic])) != nil) { + die("Can't write report: \(err!)") } diff --git a/Sparkle/SUConstants.h b/Sparkle/SUConstants.h index 8215f22d..05cc54d2 100644 --- a/Sparkle/SUConstants.h +++ b/Sparkle/SUConstants.h @@ -49,7 +49,6 @@ extern NSString *const SUEnableSystemProfilingKey; extern NSString *const SUSendProfileInfoKey; extern NSString *const SULastProfileSubmitDateKey; extern NSString *const SUPromptUserOnFirstLaunchKey; -extern NSString *const SUKeepDownloadOnFailedInstallKey; extern NSString *const SUDefaultsDomainKey; extern NSString *const SUEnableJavaScriptKey; extern NSString *const SUFixedHTMLDisplaySizeKey __attribute__((deprecated("This key is obsolete and has no effect."))); diff --git a/Sparkle/SUConstants.m b/Sparkle/SUConstants.m index f0ec3754..f5b501b5 100644 --- a/Sparkle/SUConstants.m +++ b/Sparkle/SUConstants.m @@ -46,7 +46,6 @@ NSString *const SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate"; NSString *const SUPromptUserOnFirstLaunchKey = @"SUPromptUserOnFirstLaunch"; NSString *const SUEnableJavaScriptKey = @"SUEnableJavaScript"; NSString *const SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize"; -NSString *const SUKeepDownloadOnFailedInstallKey = @"SUKeepDownloadOnFailedInstall"; NSString *const SUDefaultsDomainKey = @"SUDefaultsDomain"; NSString *const SUSparkleErrorDomain = @"SUSparkleErrorDomain"; diff --git a/Sparkle/SUFileManager.h b/Sparkle/SUFileManager.h index 9a6ac75f..e465eeda 100644 --- a/Sparkle/SUFileManager.h +++ b/Sparkle/SUFileManager.h @@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN * @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 moved successfully, otherwise NO along with a populated error object - * + * * If sourceURL and destinationURL reside on the same volume, this operation will be an atomic move operation. * Otherwise this will be equivalent to a copy & remove which will be a nonatomic operation. */ diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index a1af8216..acef794f 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -140,7 +140,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { { static const int removeXAttrOptions = XATTR_NOFOLLOW; BOOL success = YES; - + // First remove quarantine on the root item NSString *rootURLPath = rootURL.path; if ([self _getXAttr:SUAppleQuarantineIdentifier fromFile:rootURLPath options:removeXAttrOptions] >= 0) { @@ -227,13 +227,13 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { #pragma clang diagnostic ignored "-Wdeprecated-declarations" OSStatus copyResult = FSCopyObjectSync(&sourceRef, &destinationParentRef, (__bridge CFStringRef)(destinationURL.lastPathComponent), NULL, kFSFileOperationDefaultOptions); #pragma clang diagnostic pop - + if (copyResult != noErr) { if (error != NULL) { *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:copyResult userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to copy file (%@)", sourceURL.lastPathComponent] }]; } } - + return YES; } @@ -305,7 +305,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { if (foundSourceVolume && foundDestinationVolume && sourceVolume != destinationVolume) { return ([self copyItemAtURL:sourceURL toURL:destinationURL error:error] && [self removeItemAtURL:sourceURL error:error]); } - + return [_fileManager moveItemAtURL:sourceURL toURL:destinationURL error:error]; } @@ -429,7 +429,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { } return NO; } - + int fileDescriptor = open(path, O_RDONLY | O_SYMLINK); if (fileDescriptor == -1) { if (error != NULL) { @@ -446,7 +446,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { close(fileDescriptor); return NO; } - + // Preserve the modification time struct timeval modTime; TIMESPEC_TO_TIMEVAL(&modTime, &statInfo.st_mtimespec); @@ -485,7 +485,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { } return NO; } - + // Only recurse if it's actually a directory. Don't recurse into a // root-level symbolic link. NSString *rootURLPath = targetURL.path; @@ -495,7 +495,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { if (![self _updateItemAtURL:targetURL withAccessTime:currentTime error:error]) { return NO; } - + if ([rootType isEqualToString:NSFileTypeDirectory]) { // The NSDirectoryEnumerator will avoid recursing into any contained // symbolic links, so no further type checks are needed. @@ -581,7 +581,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { } return NO; } - + return YES; } @@ -622,7 +622,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { } return NO; } - + return YES; } diff --git a/Sparkle/SUInstallerProtocol.h b/Sparkle/SUInstallerProtocol.h index 4e07bbd2..75312c47 100644 --- a/Sparkle/SUInstallerProtocol.h +++ b/Sparkle/SUInstallerProtocol.h @@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN // Any installation work after the user application has been terminated. This is where the final installation work can be done. // After this stage is done, the user application may be relaunched. // Should be able to be called from non-main thread -- (BOOL)performFinalInstallation:(NSError **)error; +- (BOOL)performFinalInstallationProgressBlock:(nullable void(^)(double))cb error:(NSError **)error; // Indicates whether or not this installer can install the update silently in the background, without hindering the user // Should be thread safe diff --git a/Sparkle/SUUpdateAlert.h b/Sparkle/SUUpdateAlert.h index cc7152b8..09f9cbf7 100644 --- a/Sparkle/SUUpdateAlert.h +++ b/Sparkle/SUUpdateAlert.h @@ -32,6 +32,7 @@ - (IBAction)installUpdate:sender; - (IBAction)skipThisVersion:sender; - (IBAction)remindMeLater:sender; +- (void)disableKeyboardShortcutForInstallButton; @end diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 4d20e9fd..c239124c 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -137,6 +137,9 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE - (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [self.host bundlePath]]; } +- (void)disableKeyboardShortcutForInstallButton { + self.installButton.keyEquivalent = @""; +} - (void)endWithSelection:(SPUUpdateAlertChoice)choice { diff --git a/Sparkle/SUUpdater.h b/Sparkle/SUUpdater.h index d46ea615..39174ce0 100644 --- a/Sparkle/SUUpdater.h +++ b/Sparkle/SUUpdater.h @@ -25,7 +25,7 @@ /*! The main API in Sparkle for controlling the update mechanism. - + This class is used to configure the update paramters as well as manually and automatically schedule and control checks for updates. @@ -58,12 +58,12 @@ SU_EXPORT @interface SUUpdater : NSObject /*! Explicitly checks for updates and displays a progress dialog while doing so. - + This method is meant for a main menu item. Connect any menu item to this action in Interface Builder, and Sparkle will check for updates and report back its findings verbosely when it is invoked. - + This will find updates that the user has opted into skipping. */ - (IBAction)checkForUpdates:(id)sender; @@ -75,22 +75,22 @@ SU_EXPORT @interface SUUpdater : NSObject /*! Checks for updates, but does not display any UI unless an update is found. - + This is meant for programmatically initating a check for updates. That is, it will display no UI unless it actually finds an update, in which case it proceeds as usual. - + If automatic downloading of updates it turned on and allowed, however, this will invoke that behavior, and if an update is found, it will be downloaded in the background silently and will be prepped for installation. - + This will not find updates that the user has opted into skipping. */ - (void)checkForUpdatesInBackground; /*! A property indicating whether or not to check for updates automatically. - + Setting this property will persist in the host bundle's user defaults. The update schedule cycle will be reset in a short delay after the property's new value is set. This is to allow reverting this property without kicking off a schedule change immediately @@ -99,17 +99,17 @@ SU_EXPORT @interface SUUpdater : NSObject /*! A property indicating whether or not updates can be automatically downloaded in the background. - + Note that automatic downloading of updates can be disallowed by the developer. In this case, -automaticallyDownloadsUpdates will return NO regardless of how this property is set. - + Setting this property will persist in the host bundle's user defaults. */ @property (nonatomic) BOOL automaticallyDownloadsUpdates; /*! A property indicating the current automatic update check interval. - + Setting this property will persist in the host bundle's user defaults. The update schedule cycle will be reset in a short delay after the property's new value is set. This is to allow reverting this property without kicking off a schedule change immediately @@ -119,23 +119,23 @@ SU_EXPORT @interface SUUpdater : NSObject /*! Begins a "probing" check for updates which will not actually offer to update to that version. - + However, the delegate methods SUUpdaterDelegate::updater:didFindValidUpdate: and SUUpdaterDelegate::updaterDidNotFindUpdate: will be called, so you can use that information in your UI. - + Updates that have been skipped by the user will not be found. */ - (void)checkForUpdateInformation; /*! The URL of the appcast used to download update information. - + Setting this property will persist in the host bundle's user defaults. If you don't want persistence, you may want to consider instead implementing SUUpdaterDelegate::feedURLStringForUpdater: or SUUpdaterDelegate::feedParametersForUpdater:sendingSystemProfile: - + This property must be called on the main thread. */ @property (nonatomic, copy) NSURL *feedURL; @@ -152,14 +152,14 @@ SU_EXPORT @interface SUUpdater : NSObject /*! The user agent used when checking for updates. - + The default implementation can be overrided. */ @property (nonatomic, copy) NSString *userAgentString; /*! The HTTP headers used when checking for updates. - + The keys of this dictionary are HTTP header fields (NSString) and values are corresponding values (NSString) */ #if __has_feature(objc_generics) @@ -170,7 +170,7 @@ SU_EXPORT @interface SUUpdater : NSObject /*! A property indicating whether or not the user's system profile information is sent when checking for updates. - + Setting this property will persist in the host bundle's user defaults. */ @property (nonatomic) BOOL sendsSystemProfile; @@ -182,7 +182,7 @@ SU_EXPORT @interface SUUpdater : NSObject /*! Returns the date of last update check. - + \returns \c nil if no check has been performed. */ @property (nonatomic, readonly, copy) NSDate *lastUpdateCheckDate; @@ -190,7 +190,7 @@ SU_EXPORT @interface SUUpdater : NSObject /*! Appropriately schedules or cancels the update checking timer according to the preferences for time interval and automatic checks. - + This call does not change the date of the next check, but only the internal NSTimer. */ @@ -198,7 +198,7 @@ SU_EXPORT @interface SUUpdater : NSObject /*! A property indicating whether or not an update is in progress. - + Note this property is not indicative of whether or not user initiated updates can be performed. Use SUUpdater::validateMenuItem: for that instead. */ diff --git a/Sparkle/ja.lproj/SUUpdatePermissionPrompt.xib b/Sparkle/ja.lproj/SUUpdatePermissionPrompt.xib index ad6d43de..2c314c7c 100644 --- a/Sparkle/ja.lproj/SUUpdatePermissionPrompt.xib +++ b/Sparkle/ja.lproj/SUUpdatePermissionPrompt.xib @@ -145,10 +145,10 @@ Gw - - 匿名のシステムプロファイル情報は、今後我が社の企画開発を計画する上で参考にさせていただきます。この件に関してご質問があれば、ご連絡下さい。 + + 匿名のシステムプロファイル情報は、今後の開発の参考にさせていただきます。この件に関してご質問があればご連絡下さい。 -以下の情報を送信してください: +以下の情報が送信されます: @@ -158,7 +158,7 @@ Gw - + @@ -202,7 +202,6 @@ Gw -