From c0c1c51d8df27c736763dd65e24cffc0ac4bc8a9 Mon Sep 17 00:00:00 2001 From: Kornel Date: Wed, 31 Oct 2018 00:51:31 +0000 Subject: [PATCH] Ignore symlink permissions in binary deltas Fixes #1301 --- Sparkle/SUBinaryDeltaCommon.m | 5 +++++ Tests/SUBinaryDeltaTest.m | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Sparkle/SUBinaryDeltaCommon.m b/Sparkle/SUBinaryDeltaCommon.m index 8ede8dcb..1ee65115 100644 --- a/Sparkle/SUBinaryDeltaCommon.m +++ b/Sparkle/SUBinaryDeltaCommon.m @@ -190,6 +190,11 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion) if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) { uint16_t mode = ent->fts_statp->st_mode; + // permission of symlinks is irrelevant and can't be changed. + // hardcoding a value helps avoid differences between filesystems. + if (ent->fts_info == FTS_SL) { + mode = 0755; + } uint16_t type = ent->fts_info; uint16_t permissions = mode & PERMISSION_FLAGS; diff --git a/Tests/SUBinaryDeltaTest.m b/Tests/SUBinaryDeltaTest.m index 544be1ff..7c95b37a 100644 --- a/Tests/SUBinaryDeltaTest.m +++ b/Tests/SUBinaryDeltaTest.m @@ -251,7 +251,7 @@ typedef void (^SUDeltaHandler)(NSFileManager *fileManager, NSString *sourceDirec XCTFail(@"Failed setting file permissions"); } - XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]); + XCTAssertTrue([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]); }]; }