Ignore non-standard permissions in delta updates instead of failing the build

Fixes #1383
This commit is contained in:
Kornel Lesiński authored and Kornel Lesiński committed 2019-03-29 00:06:55 +00:00
1 parent fc3221c5d2
commit 1edfcaba71
2 files changed
+5 -8

No files matched your search

+3 -6
View File
@@ -381,13 +381,10 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
mode_t permissions = [info[INFO_PERMISSIONS_KEY] unsignedShortValue];
if (!isSymLink(ent) && !IS_VALID_PERMISSIONS(permissions)) {
permissions = 0755;
if (verbose) {
fprintf(stderr, "\n");
fprintf(stderr, "\nwarning: file permissions %o of '%s' won't be preserved in the delta update (only permissions with modes 0755 and 0644 are supported).\n", permissions & PERMISSION_FLAGS, ent->fts_path);
}
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Invalid file permissions after-tree on file %@ (only permissions with modes 0755 and 0644 are supported)", @(ent->fts_path)] }];
}
return NO;
}
if (aclExists(ent)) {
@@ -588,7 +585,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
[filemgr removeItemAtPath: patchFile error: NULL];
if ([filemgr moveItemAtPath: temporaryFile toPath: patchFile error: NULL] != YES)
{
+2 -2
View File
@@ -627,10 +627,10 @@ typedef void (^SUDeltaHandler)(NSFileManager *fileManager, NSString *sourceDirec
XCTFail(@"Failed setting file permissions");
}
// This would fail for version 1.0
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
} afterDiffHandler:nil];
XCTAssertFalse(success);
// we just ignore bad permissions, since that's a too common problem to fail on
XCTAssertTrue(success);
}
- (void)testBadPermissionsInBeforeTree