OTA: Episode VI : Return of the (je)Diff

Provide a simple but useful diff between OTA contents at file name or file content level

Jonathan Levin, (@Morpheus______), http://newosxbook.com/ - 02/28/2018

About

Trying to look for how Apple patched that nasty unicode character bug in 11.2.6 made me realize that, like the search functionality I put into my OTA tool, a diff feature would also be cool. So I did.

This feature works remarkably well between micro-updates (i.e. X.y.z to X.y.(z+n), e.g. 11.2.5-> 11.2.6, and between OTAs of the same model:

#
# Assume at this point 'p' is the extracted pbzx. 
# If you don't know what I'm talking about, start at chapter 1 of the series.
#
root@Qilin (/NewOSXBook/..../iPhone10,6/11.2.6) # ota -d ./p ../11.2.5/p
System/Library/AppSignatures/com.apple.Bridge
System/Library/AppSignatures/com.apple.DocumentsApp
System/Library/AppSignatures/com.apple.Fitness
System/Library/AppSignatures/com.apple.Home
System/Library/AppSignatures/com.apple.Maps
System/Library/AppSignatures/com.apple.MobileAddressBook
System/Library/AppSignatures/com.apple.MobileStore
System/Library/AppSignatures/com.apple.Music
System/Library/AppSignatures/com.apple.VoiceMemos
System/Library/AppSignatures/com.apple.calculator
System/Library/AppSignatures/com.apple.compass
System/Library/AppSignatures/com.apple.facetime
System/Library/AppSignatures/com.apple.iBooks
System/Library/AppSignatures/com.apple.mobilecal
System/Library/AppSignatures/com.apple.mobilemail
System/Library/AppSignatures/com.apple.mobileme.fmf1
System/Library/AppSignatures/com.apple.mobilenotes
System/Library/AppSignatures/com.apple.news
System/Library/AppSignatures/com.apple.podcasts
System/Library/AppSignatures/com.apple.reminders
System/Library/AppSignatures/com.apple.stocks
System/Library/AppSignatures/com.apple.tips
System/Library/AppSignatures/com.apple.tv
System/Library/AppSignatures/com.apple.videos
System/Library/AppSignatures/com.apple.weather
System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64
System/Library/CoreAccessories/PlugIns/Features/AssistiveTouch-iOS.feature/AssistiveTouch-iOS
System/Library/CoreAccessories/PlugIns/Features/BLEPairing-iOS.feature/BLEPairing-iOS
System/Library/CoreAccessories/PlugIns/Features/Communications-iOS.feature/Communications-iOS
System/Library/CoreAccessories/PlugIns/Features/HID.feature/HID
System/Library/CoreAccessories/PlugIns/Features/MediaLibrary-iOS.feature/MediaLibrary-iOS
System/Library/CoreAccessories/PlugIns/Features/Navigation-iOS.feature/Navigation-iOS
System/Library/CoreAccessories/PlugIns/Features/NowPlaying-iOS.feature/NowPlaying-iOS
System/Library/CoreAccessories/PlugIns/Features/OOBBTPairing-iOS.feature/OOBBTPairing-iOS
System/Library/CoreAccessories/PlugIns/Platform/IOKit.platform/IOKit
System/Library/CoreAccessories/PlugIns/Platform/Platform-Bluetooth.platform/Platform-Bluetooth
System/Library/CoreAccessories/PlugIns/Platform/System.platform/System
System/Library/CoreAccessories/PlugIns/Platform/WiFiSharing.platform/WiFiSharing
System/Library/CoreAccessories/PlugIns/Transports/IOAccessoryManager.transport/IOAccessoryManager
System/Library/CoreAccessories/PlugIns/Transports/USBHost.transport/USBHost
System/Library/CoreServices/SystemVersion.plist (different sizes)
System/Library/PrivateFrameworks/CoreAccessories.framework/Support/accessoryd
System/Library/PrivateFrameworks/HomeSharing.framework/Support/itunescloudd
System/Library/UserEventPlugins/com.apple.accessoryd.matching.plugin/com.apple.accessoryd.matching
#
# And .. wa...lla!
#
root@Qilin (/NewOSXBook/..../iPhone10,6/11.2.6) # ota -e usr/lib/dyld ../11.2.5/p; md5sum usr/lib/dyld
5de2aa2cc507941748a20e2d0c5d9e29  usr/lib/dyld
root@Qilin (/NewOSXBook/..../iPhone10,6/11.2.6) # ota -e usr/lib/dyld ./p; md5sum usr/lib/dyld
5de2aa2cc507941748a20e2d0c5d9e29  usr/lib/dyld

But wait, you say! What about updates from X.y to X.w? Or maybe from X... to V...? Doing a file comparison would yield so many changes you'll miss the signal for the noise, right? Well, for that I introduce the "-n", which will only check for name differences:

root@Qilin (/NewOSXBook/..../iPhone10,6/11.2.6) # ota -n -d ./p ../11.1.1/p | head -5 
Applications/AXUIViewService.app: In file1 but not file2
Applications/AXUIViewService.app/AXUIViewService: In file1 but not file2
Applications/AXUIViewService.app/AXUIViewService-Entitlements.plist: In file1 but not file2
Applications/AXUIViewService.app/AXUIViewService.strings: In file1 but not file2
Applications/AXUIViewService.app/AXUIViewService.stringsdict: In file1 but not file2
root@Qilin (/NewOSXBook/..../iPhone10,6/11.2.6) # ota -l p | grep Applications/AXUIViewService.app/AXUIViewService-Entitlements.plist
Applications/AXUIViewService.app/AXUIViewService-Entitlements.plist
root@Qilin (/NewOSXBook/..../iPhone10,6/11.2.6) # ota -l ../11.1.1/p | grep Applications/AXUIViewService.app/AXUIViewService-Entitlements.plist

Note that I'm super lazy here, so I only diff file 1 vs. file 2. You probably want to run the older OTA image as "file2" for this reason, although you can always switch them around, of course

Other articles in series

I
II
III
Episode IV
Episode V
Episode VII
Episode VIII (the conclusion)

Sources

Updated ota.c (compiles cleanly on Linux, MacOS)

License

  • All yours. A nice greet would be nice if you end up github'ing it like some people do. Plagiarism is low.
  • P.S.

  • Yes, I cover the (very basic) file format in the upcoming MOXiI 2nd Ed (Volume II, though, so you'll have to wait a bit).
  • And I also talk about this stuff in The Tg Training - the next one in April 30th right in the heart of Manhattan :)