Compare commits

..
36 Commits
Author SHA1 Message Date
Sparkle-Bot ac2def288c Update Package management files for version 2.9.6 2026-08-16 23:18:38 +00:00
Zorg de8eb17d17 Update CHANGELOG for 2.9.6 2026-08-16 15:52:51 -07:00
Zorg f6bc73a38c Harden safety of installer moving the download archive 2026-08-16 15:29:48 -07:00
Zorg 51245ef5b9 Reject package based installs when signing validation failed (#2895)
Package updates require EdDSA signing, therefore there is no code signing mechanism to fallback on.
2026-08-16 15:29:48 -07:00
Zorg c34faaed4c Don't copy progress tool for root user (#2897)
This way we don't have to create cache directories under a different user to launch the progress tool. Longer term I want to never copy the tool.
2026-08-15 09:37:58 -07:00
Sparkle-Bot 79bc9e8729 Update Package management files for version 2.9.5 2026-07-29 15:13:39 +00:00
Zorg be4882f1ff Update CHANGELOG for 2.9.5 2026-07-29 08:06:17 -07:00
Zorg 77669eabe8 Harden patching delta file against symbolic link at destination path (#2891) 2026-07-29 08:03:59 -07:00
Sparkle-Bot b6496a74a0 Update Package management files for version 2.9.4 2026-07-02 03:38:14 +00:00
Zorg 4ba9745eca Update CHANGELOG for version 2.9.4 2026-07-01 20:33:39 -07:00
Zorg 1ec540d537 Use activateIgnoringOtherApps: again for backgrounded apps (#2890) 2026-07-01 20:33:09 -07:00
Sparkle-Bot d46d456107 Update Package management files for version 2.9.3 2026-06-08 03:00:57 +00:00
Zorg 00e7c24b6a Update CHANGELOG for version 2.9.3 2026-06-07 19:55:58 -07:00
Zorg e6a344a570 Fix updating not working the first time if bundle ID ends with ".app" (#2882)
Use a different app cache directory if bundle ID ends with ".app" so that the cache directory Sparkle writes into does not look like an app bundle and cause other systematic issues. This can occur if a developer uses an ill-formed bundle identifier rather than conventional reverse-DNS one.
2026-06-05 18:45:52 -07:00
Sparkle-Bot 6276ba2b40 Update Package management files for version 2.9.2 2026-05-17 02:57:45 +00:00
Zorg 113279a21f Improve synchronization of _receivedAppcastItemData (#2877) 2026-05-16 19:52:48 -07:00
Sparkle-Bot 7c4741d762 Update Package management files for version 2.9.2 2026-05-16 16:38:04 +00:00
Zorg 5df807d5ac Update README for 2.9.2 2026-05-16 09:32:19 -07:00
Sparkle-Bot c6ab245eba Update Package management files for version 2.9.2 2026-05-16 04:06:30 +00:00
Zorg 6e370a5ab8 Enforce connection to installer to be validated before receiving appcast item data (#2876) 2026-05-15 20:56:47 -07:00
Emilio P Egido cbdc150cfb Polish Spanish localization in Sparkle.strings (#2875)
Changes include:
- 'corriendo' -> 'ejecutando'
- '¿Quisieras' -> '¿Querrías' (two strings)
- add accent in 'sólo' (read-only)
- 'Ready to Install' translation adjusted to feminine 'Lista para instalarse'
- 'póngase en contacto' -> 'ponte en contacto'. No English source keys were modified.
2026-05-14 21:05:04 -07:00
Zorg fe7b718d07 Merge commit from fork 2026-05-14 20:39:57 -07:00
Zorg d2b796bc3e Update you're up to date Spanish translation to be gender neutral (#2874)
Fixes #2872.
2026-05-06 19:44:04 -07:00
Zorg 2f33f56afb Fix QoS warning when running Test app server on main thread (#2873)
Move web server work on background thread and don't block main thread. No need to close connection on termination.
2026-05-03 17:36:01 -07:00
Zorg f27a02f068 Show hidden window title for accessibility (#2871)
When the update alert was recently re-designed (along with Tahoe support) it was decided not to show a window title, however we can still set a window title that is hidden for accessibility / discoverability reasons.
2026-04-29 20:59:32 -07:00
Zorg 1520cda1bd Guard against NULL CFRelease() on failure condition in fallback path (#2867)
This was caught by analysis for XPC validation path. This is very unlikely to be hit practically.
2026-04-26 14:50:32 -07:00
Sparkle-Bot 066e75a8b3 Update Package management files for version 2.9.1 2026-03-28 04:13:59 +00:00
Zorg e97ba759e1 Update change log for 2.9.1 2026-03-27 21:09:37 -07:00
Julian Pscheid c625894761 Fix crash in clearDownloadedUpdate due to race condition of receiving delta update failure before probe status (#2863)
Fix: call completionHandler before probe to prevent race with installer messages

sendInstallationData kicks off the installer process, but completionHandler
was deferred until the probe callback fired. Installer messages like
SPUExtractionStarted could arrive on the main queue in the gap, triggering
installerDidStartExtracting -> clearDownloadedUpdate before the caller set
_downloadedUpdateForRemoval. A subsequent clearDownloadedUpdate (e.g. from
installerDidFailToApplyDeltaUpdate) then found both ivars nil and hit the
assertion.

The probe result is only logged, so completing before the probe is safe.
2026-03-23 05:57:35 -07:00
Jeremy Huddleston Sequoia c1dbf52970 Configurations: Add SKIP_INSTALL=YES to for XPCServices targets (#2864)
In most scenarios, they were skipped because INSTALL_PATH is unset.

In XQuartz, we build Sparkle using `xcodebuild install INSTALL_PATH=...`,
so these XPCServices would get installed into the frameworks path of our
app bundle.  This change fixes that by explicitly setting SKIP_INSTALL.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2026-03-22 20:05:25 -07:00
Zorg cd20a12e92 Fix generate_appcast failing if feed URL doesn't have lastPathComponent (#2862) 2026-03-21 07:25:50 -07:00
Zorg 59ff700f51 Upgrade actions/checkout to version 6 (#2861) 2026-03-15 18:48:31 -07:00
Zorg 829fa4c38b Use inherited ARCHS for framework (#2860)
A developer can set ARCHS to arm64 only if they want to exclude Intel, or add arm64e if they want to build for arm64e.

The ARCHS_COMMAND_LINE_TOOLS (for BinaryDelta, generate_appcast, sign_update) should however not include arm64e yet (as SPM dependencies aren't happy with that).
2026-03-15 16:26:33 -07:00
Zorg ae10c16bbb Add minimal framework support for building arm64e (#2858) 2026-03-14 11:37:58 -07:00
Zorg a888daa6f5 Don't let progress status text title string line wrap (#2856)
* Change desired with to Automatic
* Increase content compression resistance priority to required (1000)

This matches the sizing layout of the status text next to the action button.
2026-03-14 09:39:46 -07:00
Zorg 61a100ab89 Indent test application paragraph and list items in parent list (#2854)
These were meant to be indented but were not in the sample XML file.
2026-02-22 16:26:23 -08:00
45 changed files with 620 additions and 237 deletions

No files matched your search

+1 -1
View File
@@ -31,7 +31,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: true
fetch-depth: 0
+1 -1
View File
@@ -33,7 +33,7 @@ jobs:
steps:
- name: "Checkout sources"
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
submodules: true
+63 -14
View File
@@ -97,6 +97,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
// Setting _performedStage1Installation on main thread must be synchronzied with reading it from new connection handler
BOOL _performedStage1Installation;
BOOL _receivedAppcastItemData;
BOOL _performedStage2Installation;
BOOL _performedStage3Installation;
@@ -142,9 +143,9 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
BOOL connectionCodeSigningValidationSkipped = NO;
#endif
// It's safe to allow any connections once stage 1 installation is complete
// It's safe to allow any connections once stage 1 installation is complete and appcast data has been received.
// This is to allow general updaters to resume the installation.
if (!_performedStage1Installation) {
if (!_performedStage1Installation || !_receivedAppcastItemData) {
BOOL passesValidation;
NSError *validationError = nil;
SUValidateConnectionStatus status = [SUCodeSigningVerifier validateConnection:newConnection error:&validationError];
@@ -480,9 +481,21 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
return;
}
// Try to resolve the download URL from symlinks
SUFileManager *fileManager = [[SUFileManager alloc] init];
NSError *resolveError = nil;
NSURL *resolvedDownloadURL = [fileManager resolveSymlinksInURL:downloadURL isDirectory:NO error:&resolveError];
if (resolvedDownloadURL == nil) {
SULogError(resolveError);
// Try to fallback onto regular downloadURL if resolving fails
// Later file operations are performed safely even if the URL doesn't have symlinks resolved.
resolvedDownloadURL = downloadURL;
}
// Validate the download URL before moving it
{
NSArray<NSString *> *downloadURLPathComponents = downloadURL.URLByResolvingSymlinksInPath.pathComponents;
NSArray<NSString *> *downloadURLPathComponents = resolvedDownloadURL.pathComponents;
if (downloadURLPathComponents == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to retrieve path components from download URL" }]];
@@ -545,12 +558,42 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
// This prevents eg: if a bug exists in the updater that removes files we are trying to install
// When this tool is ran as root, we are moving it into a directory that only root will have access to
NSURL *downloadDestinationURL = [[NSURL fileURLWithPath:cacheInstallationPath] URLByAppendingPathComponent:downloadName];
NSURL *cacheInstallationURL = [NSURL fileURLWithPath:cacheInstallationPath isDirectory:YES];
NSError *moveError = nil;
if (![[[SUFileManager alloc] init] moveItemAtURL:downloadURL toURL:downloadDestinationURL error:&moveError]) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to move download archive to new location", NSUnderlyingErrorKey: moveError }]];
return;
NSError *resolvedCacheInstallationError = nil;
NSURL *resolvedCacheInstallationURL = [fileManager resolveSymlinksInURL:cacheInstallationURL isDirectory:YES error:&resolvedCacheInstallationError];
if (resolvedCacheInstallationURL == nil) {
// Fallback to original cache installation URL if resolving fails
SULogError(resolvedCacheInstallationError);
resolvedCacheInstallationURL = cacheInstallationURL;
}
NSURL *downloadDestinationURL = [resolvedCacheInstallationURL URLByAppendingPathComponent:downloadName isDirectory:NO];
BOOL fallbackToFileCopy;
if (@available(macOS 11, *)) {
NSError *renameError = nil;
if (![fileManager renameItemAtResolvedSymlinkURL:resolvedDownloadURL toResolvedSymlinkURL:downloadDestinationURL error:&renameError]) {
SULog(SULogLevelError, @"Error: failed to rename '%@' to '%@'. Falling back to copy operation.", resolvedDownloadURL.path, downloadDestinationURL.path);
SULogError(renameError);
fallbackToFileCopy = YES;
} else {
fallbackToFileCopy = NO;
}
} else {
fallbackToFileCopy = YES;
}
if (fallbackToFileCopy) {
// The client will be responsible for cleaning up the download.
// We will not risk removing it here if rename failed. Copying the file is safer.
NSError *copyError = nil;
if (![fileManager copyItemAtURL:resolvedDownloadURL toURL:downloadDestinationURL error:&copyError]) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to copy download archive to new location", NSUnderlyingErrorKey: copyError }]];
return;
}
}
// Make sure the downloaded archive we moved over is a regular file and not a symbolic link placed by an attacker
@@ -597,15 +640,21 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[self extractAndInstallUpdate];
});
} else if (identifier == SPUSentUpdateAppcastItemData) {
SUAppcastItem *updateItem = (data != nil) ? (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]) : nil;
if (updateItem != nil) {
SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem];
os_unfair_lock_lock(&_newConnectionLock);
if (!_receivedAppcastItemData) {
_receivedAppcastItemData = YES;
NSData *archivedData = SPUArchiveRootObjectSecurely(installationInfo);
if (archivedData != nil) {
[_agentConnection.agent registerInstallationInfoData:archivedData];
SUAppcastItem *updateItem = (data != nil) ? (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]) : nil;
if (updateItem != nil) {
SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem];
NSData *archivedData = SPUArchiveRootObjectSecurely(installationInfo);
if (archivedData != nil) {
[_agentConnection.agent registerInstallationInfoData:archivedData];
}
}
}
os_unfair_lock_unlock(&_newConnectionLock);
} else if (identifier == SPUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) {
// Because anyone can ask us to resume the installation, it may be wise to think about backwards compatibility here if IPC changes
uint8_t relaunch = *((const uint8_t *)data.bytes);
+1
View File
@@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
#define SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_CLONE_LOOKUP 4
#define SPARKLE_DELTA_ARCHIVE_ERROR_CODE_TOO_MANY_FILES 5
#define SPARKLE_DELTA_ARCHIVE_ERROR_CODE_LINK_TOO_LONG 6
#define SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_ITEM_INDEX 7
/*
Modern container format for binary delta archives.
+6 -1
View File
@@ -458,7 +458,12 @@ static compression_algorithm compressionAlgorithmForMode(SPUDeltaCompressionMode
if (commands == SPUDeltaItemCommandEndMarker) {
break;
}
if (currentItemIndex >= relativeFilePaths.count) {
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_ITEM_INDEX userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Item index %llu is past relative path table bounds of length %lu", currentItemIndex, (unsigned long)relativeFilePaths.count] }];
break;
}
// Check if we need to decode additional data
uint16_t decodedMode = 0;
uint64_t decodedDataLength = 0;
+47 -14
View File
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <stdlib.h>
#import <sys/stat.h>
#include <unistd.h>
#include "AppKitPrevention.h"
@@ -177,7 +178,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
[archive enumerateItems:^(SPUDeltaArchiveItem *item, BOOL *stop) {
NSString *relativePath = item.relativeFilePath;
if ([relativePath.pathComponents containsObject:@".."]) {
NSArray<NSString *> *relativePathComponents = relativePath.pathComponents;
if ([relativePathComponents containsObject:@".."]) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path '%@' contains '..' path component", relativePath] }];
}
@@ -187,18 +189,40 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
NSString *sourceFilePath = [source stringByAppendingPathComponent:relativePath];
NSString *destinationFilePath = [destination stringByAppendingPathComponent:relativePath];
{
NSString *destinationParentDirectory = destinationFilePath.stringByDeletingLastPathComponent;
NSDictionary<NSFileAttributeKey, id> *destinationParentDirectoryAttributes = [fileManager attributesOfItemAtPath:destinationParentDirectory error:NULL];
// It is OK for the directory parent to not exist if it has already been removed
if (destinationParentDirectoryAttributes != nil) {
// But if it does exist, make sure the entry in the parent directory we're looking at is good
// If it's inside a symlink, this is not good in any circumstance
NSString *fileType = destinationParentDirectoryAttributes[NSFileType];
if ([fileType isEqualToString:NSFileTypeSymbolicLink]) {
// Walk each intermediate directory component of relativePath, excluding the last component, and verify none are symlinks.
NSUInteger relativePathComponentCount = relativePathComponents.count;
NSString *cumulativePath = destination;
for (NSUInteger relativePathComponentIndex = 0; relativePathComponentIndex + 1 < relativePathComponentCount; relativePathComponentIndex++) {
cumulativePath = [cumulativePath stringByAppendingPathComponent:relativePathComponents[relativePathComponentIndex]];
char cumulativePathBuffer[PATH_MAX + 1] = {0};
if (![cumulativePath getFileSystemRepresentation:cumulativePathBuffer maxLength:PATH_MAX]) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch because '%@' cannot be a symbolic link.", destinationParentDirectory] }];
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch because '%@' cannot be converted to file system path.", cumulativePath] }];
}
*stop = YES;
return;
}
struct stat cumulativePathStat = {0};
if (lstat(cumulativePathBuffer, &cumulativePathStat) != 0) {
if (errno == ENOENT) {
// Directory doesn't exist, so it can't be a symlink - safe to continue
break;
}
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch because failed to stat '%@' with error: %d", cumulativePath, errno] }];
}
*stop = YES;
return;
}
if (S_ISLNK(cumulativePathStat.st_mode)) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch because '%@' cannot contain a symbolic link in its intermediate path.", destinationFilePath.stringByDeletingLastPathComponent] }];
}
*stop = YES;
return;
@@ -206,8 +230,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
}
}
// Don't use -[NSFileManager fileExistsAtPath:] because it will follow symbolic links
BOOL fileExisted = verbose && [fileManager attributesOfItemAtPath:destinationFilePath error:nil];
BOOL fileExisted = verbose && fileExists(destinationFilePath);
BOOL removedFile = NO;
// Files that have no property set that we check for will get ignored
@@ -297,8 +320,18 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
// applyBinaryDeltaToFile() normally preserves file permissions on the file it's replacing.
// However this is not possible if the destination file we're patching is not writable.
// We also need to preserve permissions for clones except when we'll be changing permissions later anyway.
BOOL destinationFileIsWritable;
{
const char *destinationFileSystemRepresentation = destinationFilePath.fileSystemRepresentation;
struct stat destinationFileInfo;
destinationFileIsWritable =
(lstat(destinationFileSystemRepresentation, &destinationFileInfo) == 0 &&
!S_ISLNK(destinationFileInfo.st_mode) &&
access(destinationFileSystemRepresentation, W_OK) == 0);
}
BOOL needsToCopyFilePermissions;
if (![fileManager isWritableFileAtPath:destinationFilePath]) {
if (!destinationFileIsWritable) {
// Remove the file non-writable we're patching that may cause issues
[fileManager removeItemAtPath:destinationFilePath error:NULL];
+1
View File
@@ -70,6 +70,7 @@ NSString *displayHashFromRawHash(const unsigned char *hash);
void getRawHashFromDisplayHash(unsigned char *hash, NSString *hexHash);
extern NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion);
extern NSString *hashOfTree(NSString *path);
BOOL fileExists(NSString *path);
extern BOOL removeTree(NSString *path);
extern BOOL copyTree(NSFileManager *fileManager, NSString *source, NSString *dest);
extern BOOL modifyPermissions(NSString *path, mode_t desiredPermissions);
+10 -4
View File
@@ -453,14 +453,20 @@ extern NSString *hashOfTree(NSString *path)
return hashOfTreeWithVersion(path, SUBinaryDeltaMajorVersionLatest);
}
BOOL fileExists(NSString *path)
{
// Don't use fileExistsForPath: because it will try to follow symbolic links
struct stat fileInfo;
return lstat(path.fileSystemRepresentation, &fileInfo) == 0;
}
BOOL removeTree(NSString *path)
{
NSFileManager *fileManager = [NSFileManager defaultManager];
// Don't use fileExistsForPath: because it will try to follow symbolic links
if (![fileManager attributesOfItemAtPath:path error:nil]) {
if (!fileExists(path)) {
return YES;
}
return [fileManager removeItemAtPath:path error:nil];
return [NSFileManager.defaultManager removeItemAtPath:path error:nil];
}
BOOL copyTree(NSFileManager *fileManager, NSString *source, NSString *dest)
+3 -1
View File
@@ -471,7 +471,9 @@ finally:
SecCodeRef code = NULL;
OSStatus result = SecCodeCopyGuestWithAttributes(NULL, (__bridge CFDictionaryRef _Nullable)(attributes), kSecCSDefaultFlags, &code);
if (result != errSecSuccess) {
CFRelease(code);
if (code != NULL) {
CFRelease(code);
}
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"The client connection could not be validated because SecCodeCopyGuestWithAttributes() failed with error %d", result] }];
+34
View File
@@ -1,3 +1,37 @@
# 2.9.6
* Harden safety of installer moving the download archive (#2898) (Zorg, Joshua Rogers)
* Don't copy progress tool for root user (#2897) (Zorg, Joshua Rogers)
* Reject package based installs when signing validation failed (#2895) (Zorg)
# 2.9.5
* Harden patching delta file against symbolic link at destination path (#2891) (Zorg, Arpit Jain)
# 2.9.4
* Fix backgrounded apps sometimes not bringing windows from user initiated actions in active focus (#2890) (Zorg, wojciech-kulik)
# 2.9.3
* Fix updating not working the first time if the app's bundle ID ends with ".app" (#2882) (Zorg)
# 2.9.2
* Show hidden window title in update window for accessibility (#2871) (Zorg)
* Polish and update Spanish translations to be gender neutral (#2874, #2875) (Emilio P Egido)
* Guard against NULL CFRelease() on failure condition in fallback path (#2867) (Zorg)
* Guard against symlinks when applying delta update files (fe7b718) (Zorg, fg0x0)
* Enforce connection to installer to be validated before receiving appcast item data (#2876, #2877) (Zorg, fg0x0)
# 2.9.1
* Fix potential crash due to race condition within clearDownloadedUpdate (#2863) (Julian Pscheid)
* Fix generate_appcast failing if feed URL doesn't have lastPathComponent (#2862) (Julian Pscheid)
* Don't let progress status text title string line wrap (#2856) (Zorg)
* Add minimal framework support for building arm64e (#2858, #2860) (Zorg)
* Add SKIP_INSTALL=YES to for XPCServices targets (#2864) (Jeremy Huddleston Sequoia)
# 2.9.0
* Add basic markdown support for release notes (requires macOS 12+) including [customizing its presentation](https://sparkle-project.org/documentation/publishing#adapting-markdown-or-plain-text-release-notes) (#2810, #2817) (Zorg)
+1 -1
View File
@@ -1 +1 @@
{"1.27.1": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.1/Sparkle-1.27.1.tar.xz", "2.0.0-beta.6": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-beta.6/Sparkle-2.0.0-beta.6.tar.xz", "2.0.0-rc.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-rc.1/Sparkle-2.0.0-rc.1.tar.xz", "2.0.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0/Sparkle-2.0.0.tar.xz", "2.1.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.1/Sparkle-2.1.0-beta.1.tar.xz", "2.1.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.2/Sparkle-2.1.0-beta.2.tar.xz", "2.1.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0/Sparkle-2.1.0.tar.xz", "2.2.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.1/Sparkle-2.2.0-beta.1.tar.xz", "2.2.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.2/Sparkle-2.2.0-beta.2.tar.xz", "2.2.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0/Sparkle-2.2.0.tar.xz", "2.2.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.1/Sparkle-2.2.1.tar.xz", "2.2.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.2/Sparkle-2.2.2.tar.xz", "2.3.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.1/Sparkle-2.3.0-beta.1.tar.xz", "2.3.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.2/Sparkle-2.3.0-beta.2.tar.xz", "2.3.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0/Sparkle-2.3.0.tar.xz", "2.3.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.1/Sparkle-2.3.1.tar.xz", "2.3.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.2/Sparkle-2.3.2.tar.xz", "2.4.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0-beta.1/Sparkle-2.4.0-beta.1.tar.xz", "2.4.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0-beta.2/Sparkle-2.4.0-beta.2.tar.xz", "2.4.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0/Sparkle-2.4.0.tar.xz", "2.4.1-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.1-beta.1/Sparkle-2.4.1-beta.1.tar.xz", "2.4.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.1/Sparkle-2.4.1.tar.xz", "2.4.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.2/Sparkle-2.4.2.tar.xz", "2.5.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0-beta.1/Sparkle-2.5.0-beta.1.tar.xz", "2.5.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0-beta.2/Sparkle-2.5.0-beta.2.tar.xz", "2.5.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0/Sparkle-2.5.0.tar.xz", "2.5.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.1/Sparkle-2.5.1.tar.xz", "2.5.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.2/Sparkle-2.5.2.tar.xz", "2.6.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0-beta.1/Sparkle-2.6.0-beta.1.tar.xz", "2.6.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0-beta.2/Sparkle-2.6.0-beta.2.tar.xz", "2.6.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0/Sparkle-2.6.0.tar.xz", "2.6.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.1/Sparkle-2.6.1.tar.xz", "1.27.2": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.2/Sparkle-1.27.2.tar.xz", "2.6.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.2/Sparkle-2.6.2.tar.xz", "1.27.3": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.3/Sparkle-1.27.3.tar.xz", "2.6.3": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.3/Sparkle-2.6.3.tar.xz", "2.6.4": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.4/Sparkle-2.6.4.tar.xz", "2.7.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.0-beta.1/Sparkle-2.7.0-beta.1.tar.xz", "2.7.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.0/Sparkle-2.7.0.tar.xz", "2.7.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.1/Sparkle-2.7.1.tar.xz", "2.7.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.2/Sparkle-2.7.2.tar.xz", "2.7.3": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.3/Sparkle-2.7.3.tar.xz", "2.8.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.8.0-beta.1/Sparkle-2.8.0-beta.1.tar.xz", "2.8.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.8.0-beta.2/Sparkle-2.8.0-beta.2.tar.xz", "2.8.0-beta.3": "https://github.com/sparkle-project/Sparkle/releases/download/2.8.0-beta.3/Sparkle-2.8.0-beta.3.tar.xz", "2.8.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.8.0/Sparkle-2.8.0.tar.xLine truncated
{"1.27.1": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.1/Sparkle-1.27.1.tar.xz", "2.0.0-beta.6": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-beta.6/Sparkle-2.0.0-beta.6.tar.xz", "2.0.0-rc.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-rc.1/Sparkle-2.0.0-rc.1.tar.xz", "2.0.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0/Sparkle-2.0.0.tar.xz", "2.1.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.1/Sparkle-2.1.0-beta.1.tar.xz", "2.1.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.2/Sparkle-2.1.0-beta.2.tar.xz", "2.1.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0/Sparkle-2.1.0.tar.xz", "2.2.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.1/Sparkle-2.2.0-beta.1.tar.xz", "2.2.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.2/Sparkle-2.2.0-beta.2.tar.xz", "2.2.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0/Sparkle-2.2.0.tar.xz", "2.2.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.1/Sparkle-2.2.1.tar.xz", "2.2.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.2/Sparkle-2.2.2.tar.xz", "2.3.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.1/Sparkle-2.3.0-beta.1.tar.xz", "2.3.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.2/Sparkle-2.3.0-beta.2.tar.xz", "2.3.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0/Sparkle-2.3.0.tar.xz", "2.3.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.1/Sparkle-2.3.1.tar.xz", "2.3.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.2/Sparkle-2.3.2.tar.xz", "2.4.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0-beta.1/Sparkle-2.4.0-beta.1.tar.xz", "2.4.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0-beta.2/Sparkle-2.4.0-beta.2.tar.xz", "2.4.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0/Sparkle-2.4.0.tar.xz", "2.4.1-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.1-beta.1/Sparkle-2.4.1-beta.1.tar.xz", "2.4.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.1/Sparkle-2.4.1.tar.xz", "2.4.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.2/Sparkle-2.4.2.tar.xz", "2.5.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0-beta.1/Sparkle-2.5.0-beta.1.tar.xz", "2.5.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0-beta.2/Sparkle-2.5.0-beta.2.tar.xz", "2.5.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0/Sparkle-2.5.0.tar.xz", "2.5.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.1/Sparkle-2.5.1.tar.xz", "2.5.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.2/Sparkle-2.5.2.tar.xz", "2.6.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0-beta.1/Sparkle-2.6.0-beta.1.tar.xz", "2.6.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0-beta.2/Sparkle-2.6.0-beta.2.tar.xz", "2.6.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0/Sparkle-2.6.0.tar.xz", "2.6.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.1/Sparkle-2.6.1.tar.xz", "1.27.2": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.2/Sparkle-1.27.2.tar.xz", "2.6.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.2/Sparkle-2.6.2.tar.xz", "1.27.3": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.3/Sparkle-1.27.3.tar.xz", "2.6.3": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.3/Sparkle-2.6.3.tar.xz", "2.6.4": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.4/Sparkle-2.6.4.tar.xz", "2.7.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.0-beta.1/Sparkle-2.7.0-beta.1.tar.xz", "2.7.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.0/Sparkle-2.7.0.tar.xz", "2.7.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.1/Sparkle-2.7.1.tar.xz", "2.7.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.2/Sparkle-2.7.2.tar.xz", "2.7.3": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.3/Sparkle-2.7.3.tar.xz", "2.8.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.8.0-beta.1/Sparkle-2.8.0-beta.1.tar.xz", "2.8.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.8.0-beta.2/Sparkle-2.8.0-beta.2.tar.xz", "2.8.0-beta.3": "https://github.com/sparkle-project/Sparkle/releases/download/2.8.0-beta.3/Sparkle-2.8.0-beta.3.tar.xz", "2.8.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.8.0/Sparkle-2.8.0.tar.xLine truncated
@@ -4,3 +4,4 @@
SWIFT_OBJC_BRIDGING_HEADER = $(PRODUCT_NAME)/Bridging-Header.h
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_EXTERNALLY=1
ARCHS = $(ARCHS_COMMAND_LINE_TOOLS)
+8 -3
View File
@@ -48,9 +48,14 @@ OTHER_SWIFT_FLAGS_COMMON = -DSPARKLE_BUILD_LEGACY_DSA_SUPPORT -DGENERATE_APPCAST
// Minimum supported macOS version
MACOSX_DEPLOYMENT_TARGET = 10.13
// Supported architectures
// Archs to use for Sparkle
// You can change this for example to add arm64e or remove x86_64
ARCHS = $(ARCHS_STANDARD)
// Archs to use for command line tools (generate_appcast, sign_update, BinaryDelta, etc)
// arm64e is not supported for these yet
ARCHS_COMMAND_LINE_TOOLS = $(ARCHS_STANDARD)
// Default Sparkle names
SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle
SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate
@@ -94,12 +99,12 @@ SPARKLE_ICON_NAME = AppIcon
// These variables must have a space after the '=' too
SPARKLE_VERSION_MAJOR = 2
SPARKLE_VERSION_MINOR = 9
SPARKLE_VERSION_PATCH = 0
SPARKLE_VERSION_PATCH = 6
// This should be in SemVer format or empty, ie. "-beta.1"
// These variables must have a space after the '=' too
SPARKLE_VERSION_SUFFIX =
CURRENT_PROJECT_VERSION = 2053
CURRENT_PROJECT_VERSION = 2061
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
ALWAYS_SEARCH_USER_PATHS = NO
+1
View File
@@ -6,4 +6,5 @@ PRODUCT_BUNDLE_IDENTIFIER = ${DOWNLOADER_BUNDLE_ID}
PRODUCT_NAME = ${DOWNLOADER_NAME}
CODE_SIGN_ENTITLEMENTS = $(DOWNLOADER_SANDBOXED_ENTITLEMENTS)
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_SOURCES_EXTERNALLY=1
SKIP_INSTALL = YES
CLANG_MODULES_AUTOLINK = NO
@@ -5,4 +5,5 @@ WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_CONNECTION_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_CONNECTION_NAME}
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_SOURCES_EXTERNALLY=1
SKIP_INSTALL = YES
CLANG_MODULES_AUTOLINK = NO
@@ -5,4 +5,5 @@ WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_LAUNCHER_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_LAUNCHER_NAME}
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_SOURCES_EXTERNALLY=1
SKIP_INSTALL = YES
CLANG_MODULES_AUTOLINK = NO
@@ -5,4 +5,5 @@ WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_STATUS_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_STATUS_NAME}
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE=0 BUILDING_SPARKLE_SOURCES_EXTERNALLY=1
SKIP_INSTALL = YES
CLANG_MODULES_AUTOLINK = NO
+3
View File
@@ -12,3 +12,6 @@ ALWAYS_SEARCH_USER_PATHS = NO
// Disable Warnings - this is a third-party project, and we'll trust that the maintainers know what they're doing.
WARNING_CFLAGS = $(inherited) -Wno-comma
// bsdiff is used by command line tools too
ARCHS = $(inherited) $(ARCHS_COMMAND_LINE_TOOLS)
+3
View File
@@ -15,3 +15,6 @@ WARNING_CFLAGS = $(inherited) -Wno-cast-qual -Wno-conversion -Wno-sign-conversio
// Disable dead stores analyzer warning
CLANG_ANALYZER_DEADCODE_DEADSTORES = NO
// ed25519 is used by command line tools too
ARCHS = $(inherited) $(ARCHS_COMMAND_LINE_TOOLS)
+35 -44
View File
@@ -32,7 +32,7 @@
@implementation SUInstallerLauncher
- (BOOL)submitProgressToolAtPath:(NSString *)progressToolPath withHostBundle:(NSBundle *)hostBundle inSystemDomainForInstaller:(BOOL)inSystemDomainForInstaller SPU_OBJC_DIRECT
- (BOOL)submitProgressToolAtPath:(NSString *)progressToolPath withHostBundle:(NSBundle *)hostBundle inSystemDomainForInstaller:(BOOL)inSystemDomainForInstaller copiedApplication:(BOOL)copiedApplication SPU_OBJC_DIRECT
{
SUFileManager *fileManager = [[SUFileManager alloc] init];
@@ -53,7 +53,7 @@
NSString *hostBundleIdentifier = hostBundle.bundleIdentifier;
assert(hostBundleIdentifier != nil);
NSArray<NSString *> *arguments = @[executablePath, hostBundlePath, @(inSystemDomainForInstaller).stringValue];
NSArray<NSString *> *arguments = @[executablePath, hostBundlePath, @(inSystemDomainForInstaller).stringValue, @(copiedApplication).stringValue];
// The progress tool can only be ran as the logged in user, not as root
CFStringRef domain = kSMDomainUserLaunchd;
@@ -506,8 +506,6 @@ static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser
NSString *userName;
NSString *homeDirectory;
uid_t uid = 0;
gid_t gid = 0;
if (!rootUser) {
// Normal path
homeDirectory = NSHomeDirectory();
@@ -518,7 +516,7 @@ static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser
} else {
// As the root user we need to obtain the user name and home directory reflecting
// the user's console session.
CFStringRef userNameRef = SCDynamicStoreCopyConsoleUser(NULL, &uid, &gid);
CFStringRef userNameRef = SCDynamicStoreCopyConsoleUser(NULL, NULL, NULL);
if (userNameRef == NULL) {
SULog(SULogLevelError, @"Failed to retrieve user name from the console user");
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
@@ -539,55 +537,48 @@ static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser
// We can't compare the signature of this framework/XPC service (depending how it's run) to the host bundle because
// they could be different (eg: take a look at sparkle-cli). We also can't easily tell if the signature of the service/framework is the same as the bundle it's inside.
// The service/framework also need not even be signed in the first place. We'll just assume for now the original bundle hasn't been tampered with
NSString *cachePath = rootUser ?
[SPULocalCacheDirectory cachePathForBundleIdentifier:hostBundleIdentifier userName:userName] :
[SPULocalCacheDirectory cachePathForBundleIdentifier:hostBundleIdentifier];
NSString *rootLauncherCachePath = [cachePath stringByAppendingPathComponent:@"Launcher"];
[SPULocalCacheDirectory removeOldItemsInDirectory:rootLauncherCachePath];
NSDictionary<NSFileAttributeKey, id> *fileAttributes = rootUser ?
@{NSFileOwnerAccountID: @(uid), NSFileGroupOwnerAccountID: @(gid)} :
nil;
NSString *launcherCachePath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootLauncherCachePath intermediateDirectoryFileAttributes:fileAttributes];
if (launcherCachePath == nil) {
SULog(SULogLevelError, @"Failed to create cache directory for progress tool in %@", rootLauncherCachePath);
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
return;
}
SUFileManager *fileManager = [[SUFileManager alloc] init];
if (rootUser) {
// Ensure the console user has ownership of the launcher cache directory
// Otherwise the updater may not launch and not be able to clean up itself
NSError *changeOwnerAndGroupError = nil;
if (![fileManager changeOwnerAndGroupOfItemAtURL:[NSURL fileURLWithPath:launcherCachePath] ownerID:uid groupID:gid error:&changeOwnerAndGroupError]) {
SULog(SULogLevelError, @"Failed to change owner and group for launcher cache directory: %@", changeOwnerAndGroupError);
// Don't create cache directories or copy the progress tool app outside of the bundle for root user,
// because the app will not start if it's contained inside directories owned by root,
// and un-doing that opens up potential security issues.
// Eventually we will also want to not copy the tool app in the !rootUser case, minimizing risk
// by not making that change yet.
BOOL copyProgressTool = !rootUser;
NSString *progressToolPath;
if (copyProgressTool) {
NSString *cachePath = [SPULocalCacheDirectory cachePathForBundleIdentifier:hostBundleIdentifier];
NSString *rootLauncherCachePath = [cachePath stringByAppendingPathComponent:@"Launcher"];
[SPULocalCacheDirectory removeOldItemsInDirectory:rootLauncherCachePath];
NSString *launcherCachePath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootLauncherCachePath];
if (launcherCachePath == nil) {
SULog(SULogLevelError, @"Failed to create cache directory for progress tool in %@", rootLauncherCachePath);
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
return;
}
}
NSString *progressToolPath = [launcherCachePath stringByAppendingPathComponent:@""SPARKLE_INSTALLER_PROGRESS_TOOL_NAME@".app"];
NSError *copyError = nil;
// SUFileManager is more reliable for copying files around
if (![fileManager copyItemAtURL:[NSURL fileURLWithPath:progressToolResourcePath] toURL:[NSURL fileURLWithPath:progressToolPath] error:&copyError]) {
SULog(SULogLevelError, @"Failed to copy progress tool to cache: %@", copyError);
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
return;
progressToolPath = [launcherCachePath stringByAppendingPathComponent:@""SPARKLE_INSTALLER_PROGRESS_TOOL_NAME@".app"];
NSError *copyError = nil;
// SUFileManager is more reliable for copying files around
SUFileManager *fileManager = [[SUFileManager alloc] init];
if (![fileManager copyItemAtURL:[NSURL fileURLWithPath:progressToolResourcePath] toURL:[NSURL fileURLWithPath:progressToolPath] error:&copyError]) {
SULog(SULogLevelError, @"Failed to copy progress tool to cache: %@", copyError);
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
return;
}
} else {
progressToolPath = progressToolResourcePath;
}
SUInstallerLauncherStatus installerStatus = [self submitInstallerAtPath:installerPath withHostBundle:hostBundle iconBundlePath:mainBundle.bundlePath updaterIdentifier:updaterIdentifier userName:userName homeDirectory:homeDirectory mainBundleName:mainBundleName inSystemDomain:inSystemDomain rootUser:rootUser];
BOOL submittedProgressTool = NO;
if (installerStatus == SUInstallerLauncherSuccess) {
submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle inSystemDomainForInstaller:inSystemDomain];
submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle inSystemDomainForInstaller:inSystemDomain copiedApplication:copyProgressTool];
if (!submittedProgressTool) {
SULog(SULogLevelError, @"Failed to submit progress tool job");
+3 -3
View File
@@ -2,10 +2,10 @@
import PackageDescription
// Version is technically not required here, SPM doesn't check
let version = "2.9.0"
let version = "2.9.6"
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
let tag = "2.9.0"
let checksum = "44a0d5a00d5bfb6c2ad1755a92b694d948876d61ad44f35a0119eb0e7ace4b65"
let tag = "2.9.6"
let checksum = "8d5fb41d960b43f4a68aa14126bf62b098544ec8d191cdcc73eb14e63a8e7606"
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
let package = Package(
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Sparkle"
s.version = "2.9.0"
s.version = "2.9.6"
s.summary = "A software update framework for macOS"
s.description = "Sparkle is an easy-to-use software update framework for macOS."
s.homepage = "https://sparkle-project.org"
+4
View File
@@ -229,6 +229,7 @@
725CB9571C7120410064365A /* SPUUserDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9561C7120410064365A /* SPUUserDriver.h */; settings = {ATTRIBUTES = (Public, ); }; };
725CB95A1C7121830064365A /* SPUStandardUserDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9581C7121830064365A /* SPUStandardUserDriver.h */; settings = {ATTRIBUTES = (Public, ); }; };
725CB95B1C7121830064365A /* SPUStandardUserDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 725CB9591C7121830064365A /* SPUStandardUserDriver.m */; };
725EA4B23027D2AF0041BFA6 /* test-package-update.xml in Resources */ = {isa = PBXBuildFile; fileRef = 725EA4B13027D2AF0041BFA6 /* test-package-update.xml */; };
725EE480277BF13B00D820CE /* SPUXarDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */; };
725EE482277BF44A00D820CE /* SPUXarDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */; };
725EE483277C767A00D820CE /* SPUXarDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */; };
@@ -1187,6 +1188,7 @@
725CB9581C7121830064365A /* SPUStandardUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUStandardUserDriver.h; sourceTree = "<group>"; };
725CB9591C7121830064365A /* SPUStandardUserDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUStandardUserDriver.m; sourceTree = "<group>"; };
725DED72263D10C400E7FA8F /* SUAppcast+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SUAppcast+Private.h"; sourceTree = "<group>"; };
725EA4B13027D2AF0041BFA6 /* test-package-update.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "test-package-update.xml"; sourceTree = "<group>"; };
725EE47E277BF13A00D820CE /* SPUXarDeltaArchive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPUXarDeltaArchive.h; path = Autoupdate/SPUXarDeltaArchive.h; sourceTree = SOURCE_ROOT; };
725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPUXarDeltaArchive.m; path = Autoupdate/SPUXarDeltaArchive.m; sourceTree = SOURCE_ROOT; };
725EE481277BF17A00D820CE /* SPUDeltaArchiveProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPUDeltaArchiveProtocol.h; path = Autoupdate/SPUDeltaArchiveProtocol.h; sourceTree = SOURCE_ROOT; };
@@ -1845,6 +1847,7 @@
5A5DD41B249F0F4B0045EB3E /* test-relative-urls.xml */,
729F7EAB27366353004592DC /* test-links.xml */,
723AD12E29922B5F006BB02F /* test-dangerous-link.xml */,
725EA4B13027D2AF0041BFA6 /* test-package-update.xml */,
72C56E212F04C28B0005A484 /* testreleasenotes.html */,
5A5DD40324958AFF0045EB3E /* SUUpdateValidatorTest */,
);
@@ -3138,6 +3141,7 @@
72C56E262F04C28B0005A484 /* testreleasenotes.html in Resources */,
723AD12F29922B5F006BB02F /* test-dangerous-link.xml in Resources */,
72EB736129BEB36100FBCEE7 /* DevSignedAppVersion2.zip in Resources */,
725EA4B23027D2AF0041BFA6 /* test-package-update.xml in Resources */,
723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */,
720DC50427A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml in Resources */,
72E6D9712C04DE1A005496E4 /* SparkleTestCodeSign_pkg.dmg in Resources */,
+22 -17
View File
@@ -62,13 +62,14 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
BOOL _submittedLauncherJob;
BOOL _willTerminate;
BOOL _applicationInitiallyAlive;
BOOL _copiedApplication;
}
- (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray<NSString *> *)arguments delegate:(id<InstallerProgressDelegate>)delegate
{
self = [super init];
if (self != nil) {
if (arguments.count != 3) {
if (arguments.count != 4) {
SULog(SULogLevelError, @"Error: Invalid number of arguments supplied: %@", arguments);
[self cleanupAndExitWithStatus:EXIT_FAILURE error:nil];
}
@@ -114,7 +115,9 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
_application = application;
_delegate = delegate;
[delegate loadLocalizationStringsFromHost:host];
BOOL copiedApplication = arguments[3].boolValue;
[delegate loadLocalizationStringsFromHost:host copiedApplication:copiedApplication];
_copiedApplication = copiedApplication;
_connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUInstallerAgentProtocol)];
_connection.exportedObject = self;
@@ -193,21 +196,23 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
[_statusInfo invalidate];
[_connection invalidate];
// Remove the agent bundle; it is assumed this bundle is in a temporary/cache/support directory
NSError *theError = nil;
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
if (![[NSFileManager defaultManager] removeItemAtPath:bundlePath error:&theError]) {
SULog(SULogLevelError, @"Couldn't remove agent bundle: %@.", theError);
} else {
// There should be nothing else in the parent temporary directory given to us,
// so let us try to remove it. Note rmdir() will fail if there are unexpectably other
// items present
NSString *parentDirectory = bundlePath.stringByDeletingLastPathComponent;
const char *fileSystemRepresentation = parentDirectory.fileSystemRepresentation;
if (fileSystemRepresentation != NULL) {
if (rmdir(fileSystemRepresentation) != 0) {
SULog(SULogLevelError, @"Failed to remove parent agent bundle directory: %@: %d", parentDirectory, errno);
if (_copiedApplication) {
// Remove the agent bundle; it is assumed this bundle is in a temporary/cache/support directory
NSError *theError = nil;
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
if (![[NSFileManager defaultManager] removeItemAtPath:bundlePath error:&theError]) {
SULog(SULogLevelError, @"Couldn't remove agent bundle: %@.", theError);
} else {
// There should be nothing else in the parent temporary directory given to us,
// so let us try to remove it. Note rmdir() will fail if there are unexpectably other
// items present
NSString *parentDirectory = bundlePath.stringByDeletingLastPathComponent;
const char *fileSystemRepresentation = parentDirectory.fileSystemRepresentation;
if (fileSystemRepresentation != NULL) {
if (rmdir(fileSystemRepresentation) != 0) {
SULog(SULogLevelError, @"Failed to remove parent agent bundle directory: %@: %d", parentDirectory, errno);
}
}
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol InstallerProgressDelegate <NSObject>
- (void)loadLocalizationStringsFromHost:(SUHost *)host;
- (void)loadLocalizationStringsFromHost:(SUHost *)host copiedApplication:(BOOL)copiedApplication;
- (void)installerProgressShouldDisplayWithHost:(SUHost *)host;
- (void)installerProgressShouldStop;
+15 -2
View File
@@ -20,7 +20,12 @@
NSString *_installingUpdateTitle;
}
- (void)loadLocalizationStringsFromHost:(SUHost *)host
- (void)createStatusControllerWithHost:(SUHost *)host SPU_OBJC_DIRECT
{
_statusController = [[SUStatusController alloc] initWithHost:host windowTitle:_updatingString centerPointValue:nil minimizable:NO closable:NO];
}
- (void)loadLocalizationStringsFromHost:(SUHost *)host copiedApplication:(BOOL)copiedApplication
{
// Try to retrieve localization strings from the old bundle if possible
// We won't display these strings until installerProgressShouldDisplayWithHost:
@@ -90,11 +95,19 @@
#endif
_installingUpdateTitle = installingUpdateTitle;
// Initialize status controller immediately if app isn't copied, before the app may be swapped/removed
// This gaurantees we will be able to load the nib
if (!copiedApplication) {
[self createStatusControllerWithHost:host];
}
}
- (void)installerProgressShouldDisplayWithHost:(SUHost *)host
{
_statusController = [[SUStatusController alloc] initWithHost:host windowTitle:_updatingString centerPointValue:nil minimizable:NO closable:NO];
if (_statusController == nil) {
[self createStatusControllerWithHost:host];
}
[_statusController setButtonTitle:_cancelUpdateTitle target:nil action:nil isDefault:NO accessibilityIdentifier:@"SUStatusCancel"];
+7 -3
View File
@@ -198,9 +198,13 @@
- (void)clearDownloadedUpdate
{
id<NSObject> downloadedUpdateObject = (_resumableUpdate != nil) ? _resumableUpdate : _downloadedUpdateForRemoval;
assert(downloadedUpdateObject != nil);
if (downloadedUpdateObject != nil && [downloadedUpdateObject isKindOfClass:[SPUDownloadedUpdate class]]) {
if (downloadedUpdateObject == nil) {
SULog(SULogLevelError, @"Warning: clearDownloadedUpdate called but no downloaded update is tracked");
return;
}
if ([downloadedUpdateObject isKindOfClass:[SPUDownloadedUpdate class]]) {
if (_downloadDriver == nil) {
_downloadDriver = [[SPUDownloadDriver alloc] initWithHost:_host];
}
+9 -5
View File
@@ -487,18 +487,22 @@
self->_systemDomain = systemDomain;
[self setUpConnection];
[self sendInstallationData];
// Complete immediately so the caller can set up state (e.g., _downloadedUpdateForRemoval)
// before installer messages arrive on the main queue.
// Previously, completionHandler was called inside the probe callback, which meant
// installer messages (SPUExtractionStarted, SPUArchiveExtractionFailed) could be
// processed before the completion handler fired, leaving _downloadedUpdateForRemoval
// unset and causing an assertion crash in clearDownloadedUpdate.
completionHandler(nil);
// Send a probe/ping to the status service, which should boost/prioritize its startup
if (hostBundleIdentifier != nil) {
[SPUProbeInstallStatus probeInstallerInProgressForHostBundleIdentifier:hostBundleIdentifier completion:^(BOOL stausServiceIsRunning) {
if (!stausServiceIsRunning) {
SULog(SULogLevelError, @"Error: failed to probe status service for %@ from the framework", hostBundleIdentifier);
}
completionHandler(nil);
}];
} else {
completionHandler(nil);
}
break;
-5
View File
@@ -21,10 +21,6 @@ SPU_OBJC_DIRECT_MEMBERS @interface SPULocalCacheDirectory : NSObject
// and then create a unique temporary directory inside it (using +createUniqueDirectoryInDirectory:)
+ (NSString *)cachePathForBundleIdentifier:(NSString *)bundleIdentifier;
// Variant of cachePathForBundleIdentifier: that specifies a userName to create the cache path for
// Only use this when running from as root
+ (NSString *)cachePathForBundleIdentifier:(NSString *)bundleIdentifier userName:(NSString *)userName;
// Remove old files inside a directory
// A caller may want to invoke this on a directory they own rather than remove and re-create an entire directory
// This does nothing if the supplied directory does not exist yet
@@ -33,7 +29,6 @@ SPU_OBJC_DIRECT_MEMBERS @interface SPULocalCacheDirectory : NSObject
// Create a unique directory inside a parent directory
// The parent directory doesn't have to exist yet. If it doesn't exist, intermediate directories will be created.
+ (NSString * _Nullable)createUniqueDirectoryInDirectory:(NSString *)directory;
+ (NSString * _Nullable)createUniqueDirectoryInDirectory:(NSString *)directory intermediateDirectoryFileAttributes:(nullable NSDictionary<NSFileAttributeKey, id> *)attributes;
@end
+15 -21
View File
@@ -18,7 +18,17 @@ static NSTimeInterval OLD_ITEM_DELETION_INTERVAL = 86400 * 10; // 10 days
+ (NSString *)_cachePathForCacheDirectory:(NSURL *)cacheURL bundleIdentifier:(NSString *)bundleIdentifier SPU_OBJC_DIRECT
{
NSString *resultPath = [[[cacheURL URLByAppendingPathComponent:bundleIdentifier isDirectory:YES] URLByAppendingPathComponent:@SPARKLE_BUNDLE_IDENTIFIER isDirectory:YES] path];
// If an app has an ill-formed bundle identifier that ends with ".app" we will append ".sparkle" to it
// so that the cache directory doesn't look like an app bundle directory, which can cause other systematic issues
// https://github.com/sparkle-project/Sparkle/discussions/2881
NSString *appCacheIdentifier;
if ([bundleIdentifier hasSuffix:@".app"] || [bundleIdentifier hasSuffix:@".APP"]) {
appCacheIdentifier = [bundleIdentifier stringByAppendingString:@".sparkle"];
} else {
appCacheIdentifier = bundleIdentifier;
}
NSString *resultPath = [[[cacheURL URLByAppendingPathComponent:appCacheIdentifier isDirectory:YES] URLByAppendingPathComponent:@SPARKLE_BUNDLE_IDENTIFIER isDirectory:YES] path];
assert(resultPath != nil);
return resultPath;
@@ -34,19 +44,6 @@ static NSTimeInterval OLD_ITEM_DELETION_INTERVAL = 86400 * 10; // 10 days
return [self _cachePathForCacheDirectory:cacheURL bundleIdentifier:bundleIdentifier];
}
+ (NSString *)cachePathForBundleIdentifier:(NSString *)bundleIdentifier userName:(NSString *)userName
{
NSString *homeDirectory = NSHomeDirectoryForUser(userName);
assert(homeDirectory != nil);
NSURL *homeDirectoryURL = [NSURL fileURLWithPath:homeDirectory isDirectory:YES];
NSURL *cacheURL = [[homeDirectoryURL URLByAppendingPathComponent:@"Library" isDirectory:YES] URLByAppendingPathComponent:@"Caches" isDirectory:YES];
assert(cacheURL != nil);
return [self _cachePathForCacheDirectory:cacheURL bundleIdentifier:bundleIdentifier];
}
+ (void)removeOldItemsInDirectory:(NSString *)directory
{
NSMutableArray<NSString *> *filePathsToRemove = [NSMutableArray array];
@@ -76,11 +73,11 @@ static NSTimeInterval OLD_ITEM_DELETION_INTERVAL = 86400 * 10; // 10 days
}
}
+ (NSString * _Nullable)createUniqueDirectoryInDirectory:(NSString *)directory intermediateDirectoryFileAttributes:(NSDictionary<NSFileAttributeKey, id> *)intermediateDirectoryFileAttributes
+ (NSString * _Nullable)createUniqueDirectoryInDirectory:(NSString *)directory
{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *createError = nil;
if (![fileManager createDirectoryAtPath:directory withIntermediateDirectories:YES attributes:intermediateDirectoryFileAttributes error:&createError]) {
if (![fileManager createDirectoryAtPath:directory withIntermediateDirectories:YES attributes:nil error:&createError]) {
SULog(SULogLevelError, @"Failed to create directory with intermediate components at %@ with error %@", directory, createError);
return nil;
}
@@ -90,14 +87,11 @@ static NSTimeInterval OLD_ITEM_DELETION_INTERVAL = 86400 * 10; // 10 days
if ([templateString getFileSystemRepresentation:buffer maxLength:sizeof(buffer)]) {
if (mkdtemp(buffer) != NULL) {
return [[NSString alloc] initWithUTF8String:buffer];
} else {
SULog(SULogLevelError, @"Failed to create templated intermediate cache directory using mkdtemp() with error: %d", errno);
}
}
return nil;
}
+ (NSString * _Nullable)createUniqueDirectoryInDirectory:(NSString *)directory
{
return [self createUniqueDirectoryInDirectory:directory intermediateDirectoryFileAttributes:nil];
}
@end
+4 -5
View File
@@ -128,11 +128,10 @@
- (void)_activateApplication SPU_OBJC_DIRECT
{
if (@available(macOS 14, *)) {
[NSApp activate];
} else {
[NSApp activateIgnoringOtherApps:YES];
}
// -[NSApp activate] does not always work reliably from backgrounded apps when the user initiates checks for updates
// from e.g. a menu bar. The OS should grant active focus to the appliation, but it is inconsistent (last tested on 26.5.1).
// For now we will prefer the deprecated more reliant API
[NSApp activateIgnoringOtherApps:YES];
}
- (void)showUpdatePermissionRequest:(SPUUpdatePermissionRequest *)request reply:(void (^)(SUUpdatePermissionResponse *))reply
+7
View File
@@ -773,6 +773,13 @@ static NSString *SPUSanitizeUntrustedVersionString(NSString *versionString, NSSt
chosenInstallationType = SPUInstallationTypeApplication;
#endif
if (signingValidationStatus == SPUAppcastSigningValidationStatusFailed && ![chosenInstallationType isEqualToString:SPUInstallationTypeApplication]) {
if (error != NULL) {
*error = @"Package based install update is rejected because signing validation on feed failed";
}
return nil;
}
_installationType = [chosenInstallationType copy];
NSString *enclosureDeltaSparkleExecutableSize = [enclosure objectForKey:SUAppcastAttributeDeltaFromSparkleExecutableSize];
+24
View File
@@ -58,6 +58,30 @@ SUFileManagerDefinitionAttribute
*/
- (BOOL)moveItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError **)error;
/**
* Renames an item from a source to a destination assuming source and destination URLs have symbolic links resolved.
* @param sourceURL A URL pointing to the item to rename. The item at this URL must exist.
* @param destinationURL A URL pointing to the destination the item will be moved at.
* @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 time was renamed successfully, otherwise NO along with a pouplated error object.
*
* sourceURL and destinationURL must reside on the same volume otherwise this operation will fail.
* If any symbolic links are encountered in these paths during path resolution, this operation will fail.
*/
- (BOOL)renameItemAtResolvedSymlinkURL:(NSURL *)sourceURL toResolvedSymlinkURL:(NSURL *)destinationURL error:(NSError *__autoreleasing *)error API_AVAILABLE(macosx(11.0));
/**
* Returns a URL by resolving links in path.
* @param url A URL pointing to a real file to resolve symlinks in path.
* @param isDirectory Indicates if the URL is a directory.
* @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 A URL that is resolved and has no symlinks in its path.
*
* This method is suitable to resolving a URL before passing it to -renameItemAtResolvedSymlinkURL:toResolvedSymlinkURL:error:
* -[NSURL URLByResolvingSymlinksInPath] does not resolve symlinks for file paths starting with /private/ hence the need for this method.
*/
- (NSURL * _Nullable)resolveSymlinksInURL:(NSURL *)url isDirectory:(BOOL)isDirectory error:(NSError * __autoreleasing *)error;
/**
* Swaps an original item with a new item atomically.
* @param originalItemURL A URL pointing to the original item to replace. The item at this URL must exist.
+111 -3
View File
@@ -225,7 +225,28 @@ SPU_OBJC_DIRECT
return [_fileManager moveItemAtURL:sourceURL toURL:destinationURL error:error];
}
- (BOOL)swapItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError * __autoreleasing *)error
- (NSURL * _Nullable)resolveSymlinksInURL:(NSURL *)url isDirectory:(BOOL)isDirectory error:(NSError * __autoreleasing *)error
{
char path[PATH_MAX] = {0};
if (![url.path getFileSystemRepresentation:path maxLength:sizeof(path)]) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to retrieve file system representation before resolving symlinks in %@", url.path] }];
}
return nil;
}
char resolvedPath[PATH_MAX] = {0};
if (realpath(path, resolvedPath) == NULL) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to resolve symlinks in %@", url.path] }];
}
return nil;
}
return [[NSURL alloc] initFileURLWithFileSystemRepresentation:resolvedPath isDirectory:isDirectory relativeToURL:nil];
}
static BOOL renameFile(NSURL *originalItemURL, NSURL *newItemURL, unsigned int renameFlags, NSError * __autoreleasing *error)
{
char originalPath[PATH_MAX] = {0};
if (![originalItemURL.path getFileSystemRepresentation:originalPath maxLength:sizeof(originalPath)]) {
@@ -243,10 +264,10 @@ SPU_OBJC_DIRECT
return NO;
}
int status = renamex_np(newPath, originalPath, RENAME_SWAP);
int status = renamex_np(originalPath, newPath, renameFlags);
if (status != 0) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to replace %@ with %@.", originalItemURL.lastPathComponent, newItemURL.lastPathComponent] }];
*error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to renamex_np %@ with %@.", originalItemURL.lastPathComponent, newItemURL.lastPathComponent] }];
}
return NO;
}
@@ -254,6 +275,93 @@ SPU_OBJC_DIRECT
return YES;
}
- (BOOL)renameItemAtResolvedSymlinkURL:(NSURL *)sourceURL toResolvedSymlinkURL:(NSURL *)destinationURL error:(NSError *__autoreleasing *)error
{
if (@available(macOS 13, *)) {
// RENAME_NOFOLLOW_ANY option requires macOS 13+
return renameFile(sourceURL, destinationURL, RENAME_NOFOLLOW_ANY, error);
}
// The old path for renaming the file will involve opening file descriptors to parent directories
// and using renameat() without following any symlinks
NSURL *sourceParentDirectoryURL = sourceURL.URLByDeletingLastPathComponent;
char sourceParentDirectoryPath[PATH_MAX] = {0};
if (![sourceParentDirectoryURL getFileSystemRepresentation:sourceParentDirectoryPath maxLength:sizeof(sourceParentDirectoryPath)]) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Source item parent directory %@ to rename cannot be represented as a valid file name", sourceParentDirectoryURL.lastPathComponent] }];
}
return NO;
}
char sourceLastPathComponentPath[PATH_MAX] = {0};
if (![sourceURL.lastPathComponent getFileSystemRepresentation:sourceLastPathComponentPath maxLength:sizeof(sourceLastPathComponentPath)]) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Source item last path component %@ to rename cannot be represented as a valid file name", sourceURL.lastPathComponent] }];
}
return NO;
}
char destinationParentDirectoryPath[PATH_MAX] = {0};
NSURL *destinationParentDirectoryURL = destinationURL.URLByDeletingLastPathComponent;
if (![destinationParentDirectoryURL getFileSystemRepresentation:destinationParentDirectoryPath maxLength:sizeof(destinationParentDirectoryPath)]) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination item parent directory %@ to rename cannot be represented as a valid file name", destinationParentDirectoryURL.lastPathComponent] }];
}
return NO;
}
char destinationLastPathComponentPath[PATH_MAX] = {0};
if (![destinationURL.lastPathComponent getFileSystemRepresentation:destinationLastPathComponentPath maxLength:sizeof(destinationLastPathComponentPath)]) {
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination item last path component %@ to rename cannot be represented as a valid file name", destinationURL.lastPathComponent] }];
}
return NO;
}
// sourceURL and destinationURL is required to have symlinks already resolved so we will use O_NOFOLLOW_ANY to open the parent directories without following symlinks in any of intermediate directories
int sourceParentDirectoryFileDescriptor = open(sourceParentDirectoryPath, O_RDONLY | O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW_ANY);
if (sourceParentDirectoryFileDescriptor == -1) {
if (error != nil) {
*error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open file descriptor to %@", sourceParentDirectoryURL.path.lastPathComponent] }];
}
return NO;
}
int destinationParentDirectoryFileDescriptor = open(destinationParentDirectoryPath, O_RDONLY | O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW_ANY);
if (destinationParentDirectoryFileDescriptor == -1) {
if (error != nil) {
*error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open file descriptor to %@", destinationParentDirectoryURL.path.lastPathComponent] }];
}
close(sourceParentDirectoryFileDescriptor);
return NO;
}
BOOL success = (renameat(sourceParentDirectoryFileDescriptor, sourceLastPathComponentPath, destinationParentDirectoryFileDescriptor, destinationLastPathComponentPath) == 0);
if (!success) {
if (error != nil) {
*error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to rename '%@' to '%@'", sourceURL.path, destinationURL.path] }];
}
}
if (sourceParentDirectoryFileDescriptor != -1) {
close(sourceParentDirectoryFileDescriptor);
}
if (destinationParentDirectoryFileDescriptor != -1) {
close(destinationParentDirectoryFileDescriptor);
}
return success;
}
- (BOOL)swapItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError * __autoreleasing *)error
{
return renameFile(originalItemURL, newItemURL, RENAME_SWAP, error);
}
- (BOOL)changeOwnerAndGroupOfItemAtURL:(NSURL *)targetURL ownerID:(uid_t)ownerID groupID:(gid_t)groupID error:(NSError * __autoreleasing *)error
{
char path[PATH_MAX] = {0};
+12 -12
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="24093.8" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="24764" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="24093.8"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="24764"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -21,14 +21,14 @@
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="200" y="222" width="400" height="107"/>
<rect key="screenRect" x="0.0" y="0.0" width="1470" height="918"/>
<rect key="screenRect" x="0.0" y="0.0" width="1470" height="923"/>
<value key="minSize" type="size" width="213" height="107"/>
<view key="contentView" misplaced="YES" id="6">
<rect key="frame" x="0.0" y="0.0" width="400" height="105"/>
<rect key="frame" x="0.0" y="0.0" width="400" height="107"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="7">
<rect key="frame" x="20" y="37" width="64" height="64"/>
<rect key="frame" x="20" y="42" width="64" height="64"/>
<constraints>
<constraint firstAttribute="height" constant="64" id="BT1-iv-l2H"/>
<constraint firstAttribute="width" constant="64" id="eYK-yn-PVe"/>
@@ -39,10 +39,10 @@
</connections>
</imageView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="E7u-iB-1VW" userLabel="Status text and progress">
<rect key="frame" x="92" y="48" width="288" height="42"/>
<rect key="frame" x="92" y="52" width="288" height="44"/>
<subviews>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8">
<rect key="frame" x="-2" y="26" width="292" height="16"/>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="8">
<rect key="frame" x="-2" y="28" width="292" height="16"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Status Text (set by loc. string in code)" id="54">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -52,8 +52,8 @@
<binding destination="-2" name="value" keyPath="title" id="26"/>
</connections>
</textField>
<progressIndicator verticalHuggingPriority="750" maxValue="100" bezeled="NO" indeterminate="YES" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="11">
<rect key="frame" x="0.0" y="-1" width="288" height="20"/>
<progressIndicator wantsLayer="YES" verticalHuggingPriority="750" maxValue="100" bezeled="NO" indeterminate="YES" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="11">
<rect key="frame" x="0.0" y="0.0" width="288" height="20"/>
<connections>
<binding destination="-2" name="maxValue" keyPath="maxProgressValue" id="13"/>
<binding destination="-2" name="value" keyPath="progressValue" previousBinding="13" id="27"/>
@@ -71,7 +71,7 @@
</constraints>
</customView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="12">
<rect key="frame" x="273" y="13" width="114" height="32"/>
<rect key="frame" x="280" y="20" width="100" height="24"/>
<buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="55">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -85,7 +85,7 @@
</connections>
</button>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="16">
<rect key="frame" x="90" y="23" width="146" height="16"/>
<rect key="frame" x="90" y="24" width="146" height="16"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Small System Font Text" id="56">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+4
View File
@@ -427,6 +427,10 @@ typedef NS_ENUM(NSInteger, SUReleaseNotesFormat)
_releaseNotesBoxView.contentView.layer.cornerRadius = boxCornerRadius - boxBorderWidth;
}
// Keep hidden window title for accessibility
window.title = SULocalizedStringFromTableInBundle(@"Software Update", SPARKLE_TABLE, sparkleBundle, nil);
window.titleVisibility = NSWindowTitleHidden;
_laterButton.title = SULocalizedStringFromTableInBundle(@"Remind Me Later", SPARKLE_TABLE, sparkleBundle, @"");
_skipButton.title = SULocalizedStringFromTableInBundle(@"Skip This Version", SPARKLE_TABLE, sparkleBundle, @"");
_installButton.title = SULocalizedStringFromTableInBundle(@"Install Update", SPARKLE_TABLE, sparkleBundle, @"");
+7 -7
View File
@@ -2,13 +2,13 @@
"%@ %@ is currently the newest version available." = "%1$@ %2$@ es la versión más nueva disponible.";
/* No comment provided by engineer. */
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ es la versión más nueva disponible.\n(Actualmente estás corriendo la versión %3$@.)";
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ es la versión más nueva disponible.\n(Actualmente estás ejecutando la versión %3$@.)";
/* Description text for SUUpdateAlert when the update is downloadable. */
"%@ %@ is now available—you have %@. Would you like to download it now?" = "%1$@ %2$@ ya está disponible (tienes la %3$@). ¿Quisieras descargarla ahora?";
"%@ %@ is now available—you have %@. Would you like to download it now?" = "%1$@ %2$@ ya está disponible (tienes la %3$@). ¿Querrías descargarla ahora?";
/* Description text for SUUpdateAlert when the update informational with no download. */
"%@ %@ is now available—you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ ya está disponible--tú tienes la %3$@. ¿Quisieras aprender más acerca de esta actualización en la red?";
"%@ %@ is now available—you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ ya está disponible--tú tienes la %3$@. ¿Querrías aprender más acerca de esta actualización en la red?";
/* The download progress in a unit of bytes, e.g. 100 KB */
"%@ downloaded" = "%@ descargado";
@@ -23,7 +23,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "¡%1$@ %2$@ se ha descargado y está lista para usarse! ¿Te gustaría instalarla y volver a abrir %1$@ ahora?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ no se puede actualizar porque fue abierta desde una ubicación temporal o de solo lectura.";
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ no se puede actualizar porque fue abierta desde una ubicación temporal o de sólo lectura.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "¡Una nueva versión de %@ está disponible!";
@@ -74,7 +74,7 @@
"OK" = "Aceptar";
/* No comment provided by engineer. */
"Ready to Install" = "Listo para instalarse";
"Ready to Install" = "Lista para instalarse";
/* No comment provided by engineer. */
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "¿Debería %1$@ buscar actualizaciones automáticamente? Siempre puedes buscar actualizaciones manualmente desde el menú %1$@.";
@@ -92,7 +92,7 @@
"Version History" = "Historial de versiones";
/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */
"You’re up to date!" = "¡Está actualizado!";
"You’re up to date!" = "¡Estás al día!";
/* Software Update title/label */
"Software Update" = "Actualización de software";
@@ -125,4 +125,4 @@
"Automatically download and install updates" = "Descargar e instalar actualizaciones automáticamente";
/* Anonymous system profile information disclosure for update permission dialog */
"Anonymous system profile information is used to help us plan future development work. Please contact us if you have any questions about this.\n\nThis is the information that would be sent:" = "La información de perfil de sistema anónimo se usa para ayudarnos a planear el trabajo de desarrollo futuro. Por favor, póngase en contacto con nosotros si tiene preguntas sobre esto.\n\nEsta es la información que nos enviaría:";
"Anonymous system profile information is used to help us plan future development work. Please contact us if you have any questions about this.\n\nThis is the information that would be sent:" = "La información de perfil de sistema anónimo se usa para ayudarnos a planear el trabajo de desarrollo futuro. Por favor, ponte en contacto con nosotros si tienes preguntas sobre esto.\n\nEsta es la información que nos enviaría:";
+38 -41
View File
@@ -297,45 +297,47 @@
abort();
}
self->_webServer = webServer;
// Set up updater and the updater settings window
{
self->_updateSettingsWindowController = [[SUUpdateSettingsWindowController alloc] init];
NSWindow *settingsWindow = self->_updateSettingsWindowController.window;
NSBundle *hostBundle = [NSBundle mainBundle];
NSBundle *applicationBundle = hostBundle;
id<SPUUserDriver> userDriver;
[webServer startWithReadyHandler:^{
dispatch_async(dispatch_get_main_queue(), ^{
// Set up updater and the updater settings window
self->_updateSettingsWindowController = [[SUUpdateSettingsWindowController alloc] init];
NSWindow *settingsWindow = self->_updateSettingsWindowController.window;
NSBundle *hostBundle = [NSBundle mainBundle];
NSBundle *applicationBundle = hostBundle;
id<SPUUserDriver> userDriver;
#if SPARKLE_BUILD_UI_BITS
if (shiftKeyHeldDown) {
userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithWindow:settingsWindow];
} else {
userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle delegate:nil];
}
if (shiftKeyHeldDown) {
userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithWindow:settingsWindow];
} else {
userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle delegate:nil];
}
#else
userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithWindow:settingsWindow];
userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithWindow:settingsWindow];
#endif
SPUUpdater *updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle applicationBundle:applicationBundle userDriver:userDriver delegate:self];
self->_updater = updater;
self->_updateSettingsWindowController.updater = updater;
NSError *updaterError = nil;
if (![updater startUpdater:&updaterError]) {
NSLog(@"Failed to start updater with error: %@", updaterError);
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = @"Updater Error";
alert.informativeText = @"The Updater failed to start. For detailed error information, check the Console.app log.";
[alert addButtonWithTitle:@"OK"];
[alert runModal];
}
[self->_updateSettingsWindowController showWindow:nil];
}
SPUUpdater *updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle applicationBundle:applicationBundle userDriver:userDriver delegate:self];
self->_updater = updater;
self->_updateSettingsWindowController.updater = updater;
NSError *updaterError = nil;
if (![updater startUpdater:&updaterError]) {
NSLog(@"Failed to start updater with error: %@", updaterError);
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = @"Updater Error";
alert.informativeText = @"The Updater failed to start. For detailed error information, check the Console.app log.";
[alert addButtonWithTitle:@"OK"];
[alert runModal];
}
[self->_updateSettingsWindowController showWindow:nil];
});
}];
});
}];
}
@@ -366,11 +368,6 @@
}];
}
- (void)applicationWillTerminate:(NSNotification * __unused)notification
{
[_webServer close];
}
- (IBAction)checkForUpdates:(id __unused)sender
{
[_updater checkForUpdates];
+1 -1
View File
@@ -12,6 +12,6 @@ SPU_OBJC_DIRECT_MEMBERS @interface SUTestWebServer : NSObject
- (instancetype)initWithPort:(int)port workingDirectory:(NSString*)workingDirectory;
- (void)close;
- (void)startWithReadyHandler:(dispatch_block_t)readyHandler;
@end
+15 -17
View File
@@ -174,6 +174,7 @@
SPU_OBJC_DIRECT_MEMBERS @interface SUTestWebServer () <SUTestWebServerConnectionDelegate> {
CFSocketRef _socket;
NSThread *_serverThread;
}
@property (nonatomic) NSMutableArray *connections;
@@ -227,14 +228,23 @@ static void connectCallback(CFSocketRef __unused s, CFSocketCallBackType type, C
_connections = [[NSMutableArray alloc] init];
_workingDirectory = workingDirectory;
CFRunLoopSourceRef source = CFSocketCreateRunLoopSource(NULL, _socket, 0);
assert(source != NULL);
CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
CFRelease(source);
return self;
}
- (void)startWithReadyHandler:(dispatch_block_t)readyHandler
{
_serverThread = [[NSThread alloc] initWithBlock:^{
CFRunLoopSourceRef source = CFSocketCreateRunLoopSource(NULL, self->_socket, 0);
assert(source != NULL);
CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
CFRelease(source);
readyHandler();
[[NSRunLoop currentRunLoop] run];
}];
[_serverThread start];
}
- (void)connectionDidClose:(SUTestWebServerConnection *)sender
{
assert(_connections != nil);
@@ -252,16 +262,4 @@ static void connectCallback(CFSocketRef __unused s, CFSocketCallBackType type, C
}
}
- (void)close
{
for (SUTestWebServerConnection *conn in _connections) {
[conn close];
}
if (_socket) {
CFSocketInvalidate(_socket);
CFRelease(_socket);
_socket = NULL;
}
}
@end
+3 -3
View File
@@ -37,10 +37,10 @@ IMPORTANT: This file must be re-signed if modifications are made to this file! T
* Upgraded text kit system to use *improved* TextKit 2.
* Lists in markdown can contain multiple paragraphs
These paragraphs can even span multiple lines if they are long and wide enough to pass over the next line. These paragraphs can also contain useful information.
These paragraphs can even span multiple lines if they are long and wide enough to pass over the next line. These paragraphs can also contain useful information.
* Multiple levels of lists can also exist in Markdown
* Indented list items can contain information that are related to a parent list point. For example this could contain information about writing long paragraphs.
* Multiple levels of lists can also exist in Markdown
* Indented list items can contain information that are related to a parent list point. For example this could contain information about writing long paragraphs.
1. Markdown also supports numbered lists.
2. This is an example of a numbered list.
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>For unit test only</title>
<item>
<title>Version 2.0</title>
<pubDate>Sat, 26 Jul 2014 15:20:12 +0000</pubDate>
<sparkle:version>2.0</sparkle:version>
<enclosure url="https://sparkle-project.org/release-2.0.pkg" sparkle:installationType="package" length="1346234" />
</item>
<item>
<title>Version 1.0</title>
<pubDate>Sat, 26 Jul 2014 15:20:12 +0000</pubDate>
<sparkle:version>1.0</sparkle:version>
<enclosure url="https://sparkle-project.org/release-1.0.zip" length="1346234" />
</item>
</channel>
</rss>
+57
View File
@@ -8,6 +8,25 @@
import XCTest
private let packageInstallationAppcastXML = """
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>For unit test only</title>
<item>
<title>Version 2.0</title>
<pubDate>Sat, 26 Jul 2014 15:20:12 +0000</pubDate>
<enclosure url="https://sparkle-project.org/release-2.0.pkg" sparkle:version="2.0" sparkle:installationType="package" length="1346234" />
</item>
<item>
<title>Version 1.0</title>
<pubDate>Sat, 26 Jul 2014 15:20:12 +0000</pubDate>
<enclosure url="https://sparkle-project.org/release-1.0.zip" sparkle:version="1.0" length="1346234" />
</item>
</channel>
</rss>
"""
class SUAppcastTest: XCTestCase {
func testParseAppcast() {
@@ -1163,4 +1182,42 @@ class SUAppcastTest: XCTestCase {
XCTFail("Appcast creation should have passed when encountering dangerous link of one item")
}
}
func testPackageInstallAllowedWithSkippedSigningValidation() {
let testFile = Bundle(for: SUAppcastTest.self).path(forResource: "test-package-update", ofType: "xml")!
let testData = NSData(contentsOfFile: testFile)!
do {
let stateResolver = SPUAppcastItemStateResolver(hostVersion: "1.0", applicationVersionComparator: SUStandardVersionComparator.default, standardVersionComparator: SUStandardVersionComparator.default)
let appcast = try SUAppcast(xmlData: testData as Data, relativeTo: nil, stateResolver: stateResolver, signingValidationStatus: .skipped)
XCTAssertEqual(appcast.items.count, 2)
XCTAssertEqual(appcast.items[0].installationType, SPUInstallationTypeGuidedPackage)
XCTAssertEqual(appcast.items[1].installationType, SPUInstallationTypeApplication)
} catch let err as NSError {
NSLog("Unexpected error: %@", err)
XCTFail("Appcast creation should have passed when signing validation is skipped")
}
}
func testPackageInstallRejectedWithFailedSigningValidation() {
let testFile = Bundle(for: SUAppcastTest.self).path(forResource: "test-package-update", ofType: "xml")!
let testData = NSData(contentsOfFile: testFile)!
do {
let stateResolver = SPUAppcastItemStateResolver(hostVersion: "1.0", applicationVersionComparator: SUStandardVersionComparator.default, standardVersionComparator: SUStandardVersionComparator.default)
let appcast = try SUAppcast(xmlData: testData as Data, relativeTo: nil, stateResolver: stateResolver, signingValidationStatus: .failed)
// The package-based item should be rejected because signing validation on the feed failed;
// only the application-based item should remain
XCTAssertEqual(appcast.items.count, 1)
XCTAssertEqual(appcast.items[0].installationType, SPUInstallationTypeApplication)
XCTAssertEqual(appcast.items[0].versionString, "1.0")
} catch let err as NSError {
NSLog("Unexpected error: %@", err)
XCTFail("Appcast creation should have passed, dropping only the rejected package item")
}
}
}
+13 -5
View File
@@ -343,11 +343,19 @@ int bspatch(int argc,const char * const argv[])
}
epf = NULL;
/* Write the new file */
f = fopen(argv[2], "w");
if (f == NULL) {
warn("failed to write new file: %s", argv[2]);
goto cleanup;
/* Write the new file without following symlinks at the destination path */
{
int newfd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0644);
if (newfd < 0) {
warn("failed to open new file: %s", argv[2]);
goto cleanup;
}
f = fdopen(newfd, "w");
if (f == NULL) {
warn("failed to write new file: %s", argv[2]);
close(newfd);
goto cleanup;
}
}
if (fwrite(newp, 1, (size_t)newsize, f) < (size_t)newsize) {
+7 -1
View File
@@ -45,7 +45,13 @@ func makeAppcasts(archivesSourceDir: URL, outputPathURL: URL?, cacheDirectory ca
// Group updates by appcast feed
var updatesByAppcast: [FeedName: [ArchiveItem]] = [:]
for update in allUpdates {
let appcastFile = update.feedURL?.lastPathComponent ?? "appcast.xml"
let appcastFile: String
if let lastComponent = update.feedURL?.lastPathComponent, !lastComponent.isEmpty {
appcastFile = lastComponent
} else {
appcastFile = "appcast.xml"
}
updatesByAppcast[appcastFile, default: []].append(update)
}