Stabyourself / notpacman

Pacman with physics
Do What The F*ck You Want To Public License
18 stars 5 forks source link

Mac version has invalid CFBundleSignature and wrong PkgInfo #3

Open ryandesign opened 1 month ago

ryandesign commented 1 month ago

The Mac version available on the web site (from November 17, 2013) has its creator code set (in the CFBundleSignature field of its Info.plist) to NP2. That's not a valid value. The creator code must be a globally unique four-character code that you have registered with Apple. If you have not registered a creator code with Apple, set this field to ????.

Creator codes were essential in Mac OS 9 and earlier because they were the way that icons and file types were associated with a program but are not particularly relevant on Mac OS X and later where the bundle identifier is used for that purpose instead so I don't think anybody registers creator codes with Apple anymore. I'm not sure they even still offer creator code registration.

The PkgInfo file needs to be updated as well. Its contents are currently APPLLoVe. Its contents should be the concatenation of two values from the Info.plist: the four-character value of CFBundlePackageType (which should be APPL meaning application) and the four-character value of CFBundleSignature (your creator code or ???? if you don't have one). Ensure that this file is exactly eight bytes, with no trailing newline.

schm1dtxbox commented 1 month ago

Does any of this actually impact app functionality, or are you just nitpicking over deprecated shit that should actually be removed outright and NOT fixed? (i.e. Pkginfo deleted completely and CFBundleSignature removed. Both are no longer documented by Apple on their current developer docs, plus Apple never mandated creating a Pkginfo file to begin with for macOS, with the OS also not actually respecting CFBundleSignature since at least Mac OS X 10.6 if not earlier).

ryandesign commented 1 month ago

It wasn't my intention to nitpick. I found something wrong so I reported it. Fixing these files to have the correct values is trivially easy.

I haven't observed any misbehavior but I don't know what consequences occur when these values are wrong. I don't know how modern macOS uses them. The answer could be "not at all" as you imply but most Apple apps in /System/Applications on my macOS 14 system still have CFBundleSignature in their Info.plist and all of them have PkgInfo files, suggesting they still have some value. My understanding is that PkgInfo files were never a part of iOS but they've certainly been in Mac OS X since the beginning.

The LÖVE game distribution instructions suggest copying the official binary and making changes to the Info.plist. I assume these changes were made manually for this and other Stabyourself games; I didn't see a script that made the changes automatically or I would have submitted a fix for the script. Such a script could still be created and shared among all projects. /usr/libexec/PlistBuddy is the tool usually used to manipulate plists programmatically.

The fact that the above instructions don't mention the need to change CFBundleSignature and PkgInfo is a bug in the instructions. The official LÖVE app does have those, and it would be wrong for games to be distributed claiming to have LÖVE's creator code.

schm1dtxbox commented 1 month ago

AFAIK early Mac OS X versions only bothered including support for creator codes to provide some degree of legacy compatibility with Classic Mac OS paradigms, and PkgInfo only really handled performance improvements if any bundle code did access the CFBundleSignature and CFBundlePackageType info. I'm 100% sure that, since Mac OS X 10.6, CFBundleSignature/creator codes are completely unused though (as many people have described online) so there is nothing wrong with fake, invalid, or fraudulent creator codes being used at all. I believe the only reason PkgInfo still exists in new apps, meanwhile, is because Xcode still produces ones that contain APPL???? for 99% of stuff. The file does absolutely nothing on modern Macs though, and I'm 100% sure that, as before, putting complete bullshit into PkgInfo will cause no trouble. Best to close this issue as such, or amend it to take a more modern approach as per my previous comment, i.e. remove CFBundleSignature and PkgInfo completely.