Can't create alias on APFS to file on a disk image

Originator:msschmitt
Number:rdar://FB7716688 Date Originated:5/27/2020
Status:Open Resolved:
Product:macOS Product Version:macOS Mojave 10.14.6
Classification:Finder Reproducible:Always
 
In macOS you can create an alias to a file that is on another volume, and when you later try to resolve the alias, it will attempt to mount the volume. An example is an alias to a disk image.

The problem is that if you initially create the alias on an APFS volume, it won't be able to resolve it. But it does work if the alias is created on an HFS+ volume, and that alias will work if it is later copied to the same APFS volume that doesn't work otherwise. That is, there is something different inside the alias itself that breaks it when it is initially created on APFS.

[For this example, I'm creating an encrypted image, because this same exact example will also be used to illustrate another issue in another Feedback item.]

1. Create and mount a disk image: hdiutil create -size 5m -fs HFS+ -encryption -volname Secure_Disk -attach Secure_Disk-dmg

2. Give it a password: This is the password

3. Create a file on the disk image: echo "This is some secret text">/Volumes/Secure_DIsk/super_secret.txt

4. In the Finder, option-command drag the super_secret.txt file to an APFS volume to create a Finder alias to the file.

5. Double-click the alias. It will successfully open the super_secret.txt file. Close the Text Edit window.

6. Dismount the image: hdiutil detach /Volumes/Secure_Disk.

7. Double-click the alias. It will fail to resolve, with error: The alias "super_secret.txt" can't be opened because the original item can't be found.

That demonstrated how it doesn't work on APFS. But let's try it with HFS+:

8. Double-click the disk image to mount it again.

9. In the Finder, option-command drag the super_secret.txt file to an HFS+ volume to create a Finder alias to the file.

10. Double-click the alias. It will successfully open the super_secret.txt file. Close the Text Edit window.

11. Eject the disk image again.

12. Double-click the alias on the HFS+ volume. It will display the "Enter password to access Secure_Disk.dmg". Enter the password from step 2.

13. The disk image will mount and the file inside will be opened.

That demonstrated that it works on HFS+. But there's one more anomaly:

14. Eject the image again.

15. In the Finder, copy the alias from the HFS+ volume to the same APFS volume that failed to work in step 4.

16. Double-click the COPIED alias on the APFS volume. It will display the same password box as in step 12. This time it works.

Notice that the alias created on HFS+ and copied to APFS (which works) is not the same size as the alias created on APFS (which doesn't work). It appears that the alias created on APFS contains more magic.

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!