Commit Graph
38 Commits
Author SHA1 Message Date
Zorg be7f6952c2 Reduce code size and make codebase more consistent (#2305) 2022-12-27 12:03:03 -08:00
Zorg 983d19580b Fix handle applying patches when files aren't writeable (#2216) 2022-07-23 10:37:29 -07:00
Zorg 372f0504a5 Bump minimum deployment target to macOS 10.13 (#2196) 2022-07-17 16:43:24 -07:00
Zorg d7942768b8 Validate permission bits of Sparkle executable for delta updates (#2151) 2022-06-11 11:21:52 -07:00
Zorg 94719edeb3 Ignore custom icons set via resource forks in delta updates (#2114)
For creation, we will disallow creating delta updates if a custom resource fork icon data is found in either the old or app bundles.

For applying, we will just ignore the icon data when performing hash verification and continue applying the patch.
2022-04-24 00:38:42 -07:00
Zorg 94b48c45e7 Preserve file system compression when applying delta updates (#2084) 2022-01-30 23:37:42 -08:00
Zorg 1641371e83 Warn and validate against irregular permissions for delta patches (#2061)
* Only track 0755 permissions for symbolic links

Also warn the user when encountering symbolic links that have a non-standard permission mode.

* Warn users when bad or irregular permissions are encountered
2022-01-15 23:00:59 -08:00
Zorg f6396aecfb Add heuristics for binary delta when files move to other directories (#2053)
We have one heuristic for when a .framework version changes, and another for when a file with the same name moves to another location.

To support this, we added a clone + binary diff command.

Also document and improve the format.
2022-01-08 11:48:27 -08:00
Zorg 71fc8d7b11 Add additional options to delta tools (#2052) 2022-01-04 00:14:45 -08:00
Zorg 23fc577184 Add new version 3 binary delta archive format (#2051)
This new format introduces:

* A new container format which stores metadata in a way that is more efficient for compression, decompression, and size. Creation time can be 2x faster, apply time can be a few seconds faster, size savings can be 500 KB - couple of MB due to metadata alone.
* An array of supported compression formats including lzma, bzip2, zlib and more. We now default to lzma which is as competitive as bzip2 (which we were using in version 2 format) in applying/creation times, but can save several MB on size.
* Tracking of files from an old app being replicated in different locations in the new app. This can track unchanged files being renamed and can result in significant savings if the files are large.

Version 2 format is still the default. To use version 3, pass --version=3 to BinaryDelta when creating a patch. We will switch the default to version 3 later. generate_appcast support is upcoming.
2022-01-02 11:35:51 -08:00
Zorg fc44085602 Isolate xar usage in its own archive type for delta patches (#2047)
Also remove support for creating and applying version 1 delta files. Version 2 delta files have been supported by Sparkle 1.10 and later.
2021-12-29 22:41:08 -08:00
Zorg a81f8f3d2d Add safer handling for applying binary delta files (#1988) 2021-10-29 12:14:23 -07:00
Mayur PawasheandKornel cb9386a4ea Ignore symlink permissions in binary deltas (#1905)
Co-authored-by: Kornel <kornel@geekhood.net>
2021-07-23 17:42:13 -07:00
Daniel Jalkut ad0ea07252 Fix unit tests (#1311)
* Quiet warnings from Swift compiler: "Using '!' here is deprecated and will be removed in a future release"

* Ignore diagnostics that yield 'messaging unqualified id' warnings when calling XCTAssertNotEqualObjects. I have filed a bug with Apple, Radar #45968630, requesting that they quiet the warning internally to the macro implementation.

* When setting the access time on a directory and its contents, set the access time on the directory last so that it will be guaranteed to match the expected value. There is a side-effect of calling getFileSystemRepresentation that it sets the access time of its container folder, presumably because of an implementatiton detail of how Foundation builds up the path. Note there is another problem here that the order of items from NSDirectoryEnumerator is undefined, so some of the interior items of a directory will undoubtedly end up getting slightly varying access times set upon them. However, for the purposes of Sparkle's use of this method to "keep things alive" in /tmp, I don't think there is an issue. This fix addresses a failing unit test testUpdateFileAccessTime, which was failing because of very slight differences in access time created by the problem described.
2018-11-11 13:10:12 +01:00
Kornel Lesiński 14c543ccb3 Test with non-ASCII names 2017-01-27 18:17:05 +00:00
Zorg 1a09baf0ed Remove Sparkle.pch and many file #includes
This eliminates many dependencies that don't need to exist.
2016-12-23 16:13:35 -05:00
Kornel Lesiński 59d90e0bb1 Basic binary delta progress 2016-12-21 15:23:41 +01:00
Zorg c78070c748 Improve BinaryDelta error handling & logging
* Fix issue #608. From the framework, the error is logged via SULog.
From the tool, the error is logged to stderr. Uses NSError handling for
both.
* Move patch version validation for creating a binary diff into the
BinaryDelta tool
* Add parameter assertions to createBinaryDelta and handle if
-getFileSystemRepresentation:maxLength: fails
2015-09-02 21:09:11 -04:00
Zorg 61d43f860a Add tests for aborting on code signed xattr's 2015-05-05 22:04:18 -04:00
Zorg 08aed29870 Fix tests from not compiling 2015-04-19 18:48:22 -04:00
Zorg cd478a4c48 Fixing unused variable warnings 2015-04-17 19:07:36 -04:00
Zorg acbd622369 Add tests for invalid patch version inputs 2015-04-17 19:03:21 -04:00
Zorg 817bbc46b1 Add a test to make sure old patches still work 2015-04-17 18:52:42 -04:00
Zorg 5c921de24f Removing couple of unused variables 2015-04-17 17:20:54 -04:00
Zorg 186cfa8486 New patches will now be at major version 2
This will break backwards compatibility with version 1 patches, which generated tree hashes differently and did not handle applying permission changes in some cases.
A version flag is also added to BinaryDelta create for creating patches an older version of BinaryDelta apply can handle. This is only meant for transition purposes.
2015-04-17 14:53:54 -04:00
Zorg 285cd3063f Fix removeTree not working for symbolic links and added tests
I accidently broke this a few commits ago where I inserted a return value for it
2015-04-17 02:28:03 -04:00
Zorg 8a4f4677bd Add detection for ACLs and fail if they are present
Applications probably shouldn't contain ACLs for files inside their bundle. Dealing with these could be complicated, so we should just reject them.
2015-04-17 01:35:17 -04:00
Zorg 443a6064b3 Add test with no files in before/after trees 2015-04-14 01:48:50 -04:00
Zorg 86754e0537 Adding another test case for empty directories 2015-04-14 01:47:01 -04:00
Zorg 78a940fcf4 Add tests for symlink permissions 2015-04-14 01:46:24 -04:00
Zorg 16cd57b8eb Use XCTFail where appropriate 2015-04-14 00:36:30 -04:00
Zorg e93888ad3f Add more permissions tests with directories and files 2015-04-14 00:09:03 -04:00
Zorg d374d99e51 Only allow 0755 and 0644 permissions in after-tree 2015-04-12 19:57:40 -04:00
Zorg 0c40d99740 Added invalid source test for BinaryDelta 2015-04-12 15:55:28 -04:00
Zorg bcab57d8f5 Handle exec. file changes, versioning, more error handling
BinaryDelta can now create proper diffs in the case if a non-executable file becomes an executable file, or vise versa. Currently for simplicit
y and backward-compatibility we delete then extract if an executable difference is found, rather than creating a diff. Files that contain an executable difference are unlikely to be large anyway.

We also change the tree hash function so it can track executable permission differences on files. It also now tracks file types so it is less collision-resistant for example in the case where a regular file becoming a symlink could have resulted in the same hash. Because the tree hash function changed, major & minor versioning to the format was introduced. Older minor versions remain compatible, but older major versions do not. In this case, we've only bumped the minor version. In this case, older versions can apply a patch created by a newer version, and newer versions can apply a patch created by an older version.

More error handling is now checked, some code improvements were made, and some adjustments were made to the tests with regard to the changes above.
2015-04-12 14:46:26 -04:00
Zorg 9895f123a7 Comments changes to SUBinaryDeltaTest.m 2015-04-11 00:40:50 -04:00
Zorg 87dfe0a4ed Adding BinaryDelta creating/applying tests 2015-04-11 00:13:27 -04:00
Jake Petroules 0171677513 Fix Clang static analyzer warning.
Closes #385
2014-08-22 23:13:44 -04:00