From f0da212a8be96b9e21d07bf68002cadbd124078c Mon Sep 17 00:00:00 2001 From: Max Radermacher Date: Wed, 30 Oct 2024 13:53:41 -0500 Subject: [PATCH] Use NSFileManager instead of SSZipArchive --- Podfile | 1 - Podfile.lock | 7 +- Pods | 2 +- Signal.xcodeproj/project.pbxproj | 2 - Signal/Settings.bundle/Acknowledgements.plist | 132 +++++++----------- Signal/src/util/DebugLogs.swift | 32 ++--- ThirdParty/SSZipArchive.podspec | 25 ---- 7 files changed, 69 insertions(+), 132 deletions(-) delete mode 100644 ThirdParty/SSZipArchive.podspec diff --git a/Podfile b/Podfile index d96dfe20ce..ac42d67334 100644 --- a/Podfile +++ b/Podfile @@ -62,7 +62,6 @@ target 'Signal' do project 'Signal.xcodeproj', 'Debug' => :debug, 'Release' => :release # Pods only available inside the main Signal app - pod 'SSZipArchive', podspec: 'ThirdParty/SSZipArchive.podspec' ui_pods target 'SignalTests' do diff --git a/Podfile.lock b/Podfile.lock index a1a19bb88a..e27accd119 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -38,7 +38,6 @@ PODS: - SQLCipher/common (4.6.0) - SQLCipher/standard (4.6.0): - SQLCipher/common - - SSZipArchive (2.5.2) - SwiftProtobuf (1.28.2) - YYImage (1.0.4): - YYImage/Core (= 1.0.4) @@ -64,7 +63,6 @@ DEPENDENCIES: - Reachability - SignalRingRTC (from `https://github.com/signalapp/ringrtc`, tag `v2.48.4`) - SQLCipher (from `https://github.com/signalapp/sqlcipher.git`, tag `v4.6.0-f_barrierfsync`) - - SSZipArchive (from `ThirdParty/SSZipArchive.podspec`) - SwiftProtobuf (= 1.28.2) - YYImage (from `https://github.com/signalapp/YYImage`) - YYImage/libwebp (from `https://github.com/signalapp/YYImage`) @@ -107,8 +105,6 @@ EXTERNAL SOURCES: SQLCipher: :git: https://github.com/signalapp/sqlcipher.git :tag: v4.6.0-f_barrierfsync - SSZipArchive: - :podspec: ThirdParty/SSZipArchive.podspec YYImage: :git: https://github.com/signalapp/YYImage @@ -159,10 +155,9 @@ SPEC CHECKSUMS: Reachability: fd0ecd23705e2599e4cceeb943222ae02296cbc6 SignalRingRTC: ccf191d3598e03548f1e63f7d7644c56924ec8c3 SQLCipher: 30a8e81afa6128e600b17ffa77d0f92fa05ed208 - SSZipArchive: 8c3485528a87fa6f90afdbfc33682eb61d985ae5 SwiftProtobuf: 4dbaffec76a39a8dc5da23b40af1a5dc01a4c02d YYImage: f1ddd15ac032a58b78bbed1e012b50302d318331 -PODFILE CHECKSUM: 3aef64e90a8232b44044628a206c3b35dcf9eeee +PODFILE CHECKSUM: 368a0dc15cf99174b55ec513d8981c5f5ded1658 COCOAPODS: 1.15.2 diff --git a/Pods b/Pods index cb0a926c6e..86f576de5d 160000 --- a/Pods +++ b/Pods @@ -1 +1 @@ -Subproject commit cb0a926c6e7aec4942aa3a4aba033710c3e6e949 +Subproject commit 86f576de5d61ba2f5bbfa8b917986d11f1b8de9f diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 0ddd8a3ffa..8dcae7d4e4 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -15349,7 +15349,6 @@ "${BUILT_PRODUCTS_DIR}/Logging/Logging.framework", "${BUILT_PRODUCTS_DIR}/MobileCoin/MobileCoin.framework", "${BUILT_PRODUCTS_DIR}/PureLayout/PureLayout.framework", - "${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework", "${BUILT_PRODUCTS_DIR}/lottie-ios/Lottie.framework", "${BUILT_PRODUCTS_DIR}/CocoaLumberjack/CocoaLumberjack.framework", "${PODS_XCFRAMEWORKS_BUILD_DIR}/SignalRingRTC/WebRTC/WebRTC.framework/WebRTC", @@ -15372,7 +15371,6 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Logging.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MobileCoin.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PureLayout.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Lottie.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebRTC.framework", diff --git a/Signal/Settings.bundle/Acknowledgements.plist b/Signal/Settings.bundle/Acknowledgements.plist index ed903522a0..32f6e2ac0a 100644 --- a/Signal/Settings.bundle/Acknowledgements.plist +++ b/Signal/Settings.bundle/Acknowledgements.plist @@ -1570,35 +1570,6 @@ limitations under the License. Type PSGroupSpecifier - - FooterText - Copyright (c) 2015-2016 the fiat-crypto authors (see -https://github.com/mit-plv/fiat-crypto/blob/master/AUTHORS). - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - License - MIT License - Title - boring-sys 4.9.0 - Type - PSGroupSpecifier - FooterText Copyright (c) 2014 Alex Crichton @@ -1635,6 +1606,35 @@ DEALINGS IN THE SOFTWARE. Type PSGroupSpecifier + + FooterText + Copyright (c) 2015-2016 the fiat-crypto authors (see +https://github.com/mit-plv/fiat-crypto/blob/master/AUTHORS). + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + License + MIT License + Title + boring-sys 4.9.0 + Type + PSGroupSpecifier + FooterText /* ==================================================================== @@ -10664,28 +10664,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND Type PSGroupSpecifier - - FooterText - Copyright 2015-2016 Brian Smith. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY - SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - License - ISC License - Title - ring 0.17.8 - Type - PSGroupSpecifier - FooterText Copyright (c) 2015-2016 the fiat-crypto authors (see @@ -10716,6 +10694,28 @@ SOFTWARE. Type PSGroupSpecifier + + FooterText + Copyright 2015-2016 Brian Smith. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY + SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + License + ISC License + Title + ring 0.17.8 + Type + PSGroupSpecifier + FooterText /* Copyright (c) 2015, Google Inc. @@ -12327,36 +12327,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Type PSGroupSpecifier - - FooterText - Copyright (c) 2013-2021, ZipArchive, https://github.com/ZipArchive - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - License - MIT - Title - SSZipArchive - Type - PSGroupSpecifier - FooterText MIT License diff --git a/Signal/src/util/DebugLogs.swift b/Signal/src/util/DebugLogs.swift index 32d555cde2..63b537da0c 100644 --- a/Signal/src/util/DebugLogs.swift +++ b/Signal/src/util/DebugLogs.swift @@ -4,7 +4,6 @@ // import Foundation -import SSZipArchive import zlib import SignalServiceKit import SignalUI @@ -229,17 +228,18 @@ class DebugLogs: NSObject { } // Phase 2. Zip up the log files. - let zipFilePath = zipDirPath.appendingFileExtension("zip") - let zipSuccess = SSZipArchive.createZipFile( - atPath: zipFilePath, - withContentsOfDirectory: zipDirPath, - keepParentDirectory: true, - compressionLevel: Z_DEFAULT_COMPRESSION, - password: nil, - aes: false, - progressHandler: nil - ) - guard zipSuccess else { + let zipDirUrl = URL(fileURLWithPath: zipDirPath) + let zipFileUrl = URL(fileURLWithPath: zipDirPath.appendingFileExtension("zip")) + let fileCoordinator = NSFileCoordinator() + var zipError: NSError? + fileCoordinator.coordinate(readingItemAt: zipDirUrl, options: [.forUploading], error: &zipError) { temporaryFileUrl in + do { + try FileManager.default.copyItem(at: temporaryFileUrl, to: zipFileUrl) + } catch { + Logger.warn("Couldn't copy zipped file: \(error)") + } + } + if zipError != nil || !OWSFileSystem.fileOrFolderExists(url: zipFileUrl) { let errorMessage = OWSLocalizedString( "DEBUG_LOG_ALERT_COULD_NOT_PACKAGE_LOGS", comment: "Error indicating that the debug logs could not be packaged." @@ -248,22 +248,22 @@ class DebugLogs: NSObject { return } - OWSFileSystem.protectFileOrFolder(atPath: zipFilePath) + OWSFileSystem.protectFileOrFolder(atPath: zipFileUrl.path) OWSFileSystem.deleteFile(zipDirPath) // Phase 3. Upload the log files. DebugLogUploader.uploadFile( - fileUrl: URL(fileURLWithPath: zipFilePath), + fileUrl: zipFileUrl, mimeType: MimeType.applicationZip.rawValue ).done(on: DispatchQueue.global()) { url in - OWSFileSystem.deleteFile(zipFilePath) + OWSFileSystem.deleteFile(zipFileUrl.path) wrappedSuccess(url) }.catch(on: DispatchQueue.global()) { error in let errorMessage = OWSLocalizedString( "DEBUG_LOG_ALERT_ERROR_UPLOADING_LOG", comment: "Error indicating that a debug log could not be uploaded." ) - wrappedFailure(errorMessage, zipFilePath) + wrappedFailure(errorMessage, zipFileUrl.path) } } diff --git a/ThirdParty/SSZipArchive.podspec b/ThirdParty/SSZipArchive.podspec deleted file mode 100644 index 356508b012..0000000000 --- a/ThirdParty/SSZipArchive.podspec +++ /dev/null @@ -1,25 +0,0 @@ -# This custom podspec lowers the deployment target to 12.2, but should -# otherwise be the same as [the upstream podspec][0]. -# -# [0]: https://github.com/ZipArchive/ZipArchive/blob/28312ba171da6647f410c6e5128a1fca9d2110b5/SSZipArchive.podspec - -Pod::Spec.new do |s| - s.name = 'SSZipArchive' - s.version = '2.5.2' - s.summary = 'Utility class for zipping and unzipping files on iOS, tvOS, watchOS, and macOS.' - s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS, tvOS, watchOS, and macOS. It supports AES and PKWARE encryption.' - s.homepage = 'https://github.com/ZipArchive/ZipArchive' - s.license = { :type => 'MIT', :file => 'LICENSE.txt' } - s.authors = { 'Sam Soffes' => 'sam@soff.es', 'Joshua Hudson' => nil, 'Wilson Chen' => nil } - s.source = { :git => 'https://github.com/ZipArchive/ZipArchive.git', :tag => "#{s.version}" } - s.ios.deployment_target = '12.2' - s.tvos.deployment_target = '15.4' - s.osx.deployment_target = '10.15' - s.watchos.deployment_target = '8.4' - s.source_files = 'SSZipArchive/*.{m,h}', 'SSZipArchive/include/*.{m,h}', 'SSZipArchive/minizip/*.{c,h}' - s.public_header_files = 'SSZipArchive/*.h' - s.libraries = 'z', 'iconv' - s.framework = 'Security' - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', - 'GCC_PREPROCESSOR_DEFINITIONS' => 'HAVE_INTTYPES_H HAVE_PKCRYPT HAVE_STDINT_H HAVE_WZAES HAVE_ZLIB ZLIB_COMPAT' } -end