The Backup Agent of iOS 10.3 crashes, if there are duplicate files with Unicode normalized names

Originator:Norio.Nomura
Number:rdar://31265273 Date Originated:27-Mar-2017
Status:closed Resolved:Done
Product:iOS + SDK Product Version:10.3 (14E5277a)
Classification:Serious Bug Reproducible:Always
 
憲男 野村27-Mar-2017 10:53 AM

Area:
Something not on this list

Summary:
Since APFS does not perform Unicode normalization on filename, it is possible that there are duplicate files with Unicode normalized names.
If there are duplicate files with Unicode normalized names on device, the Backup Agent of iOS 10.3 crashes.

Steps to Reproduce:
1. Build and run attached project on iOS 10.3 device
2. Perform backup from iTunes on Mac that connected iOS 10.3 device.

Expected Results:
3. Backup will complete

Actual Results:
3. Backup Agent on iOS 10.3 crashes, and backup operation fail with message on iTunes:
 The iPhone "norio's iPhone SE" could not be synced
 because the connection to the iPhone was reset.


Version:
iOS 10.3 (14E5277a)

Notes:


Configuration:
iPhone SE (Model A1662, A1723, A1724)

Attachments:
'BackupAgent2  3-27-17, 10-32 AM.crash' and 'UnicodeFilenameOnAPFS.zip' were successfully uploaded.

Comments

I confirmed that the issue has been resolved on iOS 11 beta 1 (15A5278f)

By Norio.Nomura at June 12, 2017, 2:58 a.m. (reply...)

憲男 野村28-Mar-2017 11:51 AM

Same on iOS 10.3 (14E277)

console log on crash: > デフォルト 11:48:36.701142 +0900 BackupAgent2 * Assertion failure in -[MBDriveBackupEngine fileHandleWithPath:flags:mode:error:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/MobileiTunesBackup/MobileBackup-1585/Versions/2/Source/MBDriveBackupEngine.m:2212 > デフォルト 11:48:36.702479 +0900 BackupAgent2 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No operation found for path: /var/mobile/Containers/Data/Application/02C7DB61-F0EC-4B0E-838E-1136B84318B1/Documents/パパ' First throw call stack: (0x18bdd2fd8 0x18a834538 0x18bdd2eac 0x18c86a710 0x1000b9db4 0x1000a9418 0x1000a7eb0 0x198a4a85c 0x18bcc5ce0 0x18bcae000 0x18bcb7414 0x198a458e4 0x198a4c698 0x18bd6b780 0x18bd81adc 0x18bd8127c 0x18bd7ed90 0x18bcaed94 0x18bcfb9a0 0x198a4beec 0x18ae9575c 0x18ae9566c 0x18ae92d84)

By Norio.Nomura at March 28, 2017, 2:56 a.m. (reply...)

Here is the code to verify APFS Unicode normalization https://gist.github.com/norio-nomura/c8a4addd659e1208df500a37da58536d

By Norio.Nomura at March 27, 2017, 1:59 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!