pkgutil --forget lies with certain Apple package receipts

Originator:nmcspadden
Number:rdar://29355322 Date Originated:11/21/16
Status:Open Resolved:
Product:macOS Product Version:macOS 10.12.1 (16B2555)
Classification: Reproducible:Always
 
Summary:
Trying to forget the Xcode Command Line Tools package receipts doesn't work, but pkgutil still reports that it does.  When you try to forget the receipt, it gives you an error message, but then reports that it "Forgot package 'com.apple.pkg.DevSDK_OSX1012' on '/'." anyway - which is a lie. Pkgutil should inform you that it can't do this operation successfully.

Steps to Reproduce:
1. Install the Xcode Command Line tools package from developer.apple.com
2. $ sudo pkgutil --forget com.apple.pkg.DevSDK_OSX1012


Expected Results:
Since this package receipt cannot be actually forgotten due to SIP protection (see radar 16990965, for example), pkgutil should tell you that it will never be able to forget it.

Actual Results:
Unknown error Error Domain=NSCocoaErrorDomain Code=4 ""com.apple.pkg.DevSDK_OSX1012.bom" couldn't be removed." UserInfo={NSFilePath=/var/db/receipts/com.apple.pkg.DevSDK_OSX1012.bom, NSUserStringVariant=(
    Remove
), NSUnderlyingError=0x7f8affc55470 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}.
Forgot package 'com.apple.pkg.DevSDK_OSX1012' on '/'.

Version:
macOS 10.12.1 (16B2555)

Notes:


Configuration:
Any mac running macOS 10.12.1 (16B2555), with the Xcode 8 Command Line Tools installed.

Comments

Duplicate of 14379232

By nmcspadden at Dec. 5, 2016, 10:57 p.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!