tmutil restore does not report an error if destination does not have enough space to restore files

Originator:rsesek
Number:rdar://FB7746125 Date Originated:2020-06-22
Status:Open Resolved:
Product:macOS Product Version:10.14.6 18G5033
Classification:Incorrect/Unexpected Behavior Reproducible:Always
 
If you attempt to restore files from the command line using `tmutil restore` and the destination does not have enough space for the files, tmutil exits uncleanly (status=1) but its text output indicates success.

To verify:

1) Create a small temporary Disk Image:
% hdiutil create -attach -fs HFS+ -volname tmrestore -size 5M /tmp/temp.dmg
/dev/disk5          	GUID_partition_scheme          	
/dev/disk5s1        	Apple_HFS                      	/Volumes/tmrestore
created: /tmp/temp.dmg

2) Restore a small file that will definitely fit into the destination:
% tmutil restore -v -p /Volumes/Backup/Backups.backupdb/Elementary/Latest/iMac/Users/rsesek/Desktop/notes.txt /Volumes/tmrestore
Copying file . ...
534 bytes for .
Total copied: 0.00 MB (534 bytes)
Items copied: 1

3) Verify the exit status:
% echo $?
0

4) Verify the restore:
% ls /Volumes/tmrestore
transfer-notes.txt

5) Now try and restore a file whose size is larger than 5MB (the max size of the DMG):
% tmutil restore -v -p /Volumes/Backup/Backups.backupdb/Elementary/Latest/iMac/Users/rsesek/Downloads/MKVToolNix-46.0.0.dmg /Volumes/tmrestore
Copying file . ...
Total copied: 38.27 MB (40132595 bytes)
Items copied: 1

6) Verify the exit status:
% echo $?
1

7) Verify the restore:
% ls /Volumes/tmrestore
transfer-notes.txt

In step 5, tmutil does not report any error information and it indicates that it successfully copied 1 file. However, the exit status in step 6 shows that a failure occurred. And step 7 shows that the file was not restored, despite step 5 saying a copy was successful.

tmutil restore should print an error message if it cannot restore a file, rather than incorrectly reporting that the restore completed successfully.

Comments


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!