Hi James, "E6" is not a valid CFBundleVersion. CFBundleVersions are very specifically tuples consisting solely of three numeric elements as proscribed in
https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102364 <https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102364> The daemon which backs SMJobBless() is strict in this regard. Because the version was invalid, it assumed a version of "0.0.0", and chose not to perform the update. -damien > On 27 Jan, 2017, at 11:31, James Foster <james.fos...@gemtalksystems.com> > wrote: > > According to Damien Sorresso, BSD Engineering, Apple Inc. (see > https://lists.macosforge.org/pipermail/launchd-dev/2010-October/000834.html > <https://lists.macosforge.org/pipermail/launchd-dev/2010-October/000834.html>), > "ServiceManagement will check the CFBundleVersion of the tool and, if it's > the same ..., will not overwrite it." > > I've updated my code to show the CFBundleVersion of the tool both before and > after a "successful" invocation of SMJobBless(). Is there anything I can do > to get this to work? > > 2017-01-27 09:10... existing: <string>84</string> > 2017-01-27 09:10... replacement: <string>E6</string> > 2017-01-27 09:10... SMJobBless(com.GemTalk.GemStone.Helper,...) returned > true... > 2017-01-27 09:10... now found: <string>84</string> > >> On Jan 25, 2017, at 4:48 PM, James Foster <james.fos...@gemtalksystems.com >> <mailto:james.fos...@gemtalksystems.com>> wrote: >> >> I am attempting to replace a helper tool. Most of the time if I increment >> the version (of my application and of the helper tool) then the new tool >> will be installed. Sometimes it won't be installed and I have to delete the >> old one manually. The problem seems to occur about every dozen versions or >> so, and once it happens the replacement will not occur even if I change the >> version numbers again. >> >> https://developer.apple.com/reference/servicemanagement/1431078-smjobbless?language=objc >> >> <https://developer.apple.com/reference/servicemanagement/1431078-smjobbless?language=objc> >> states "If the job is already installed, success is returned.” >> >> How does SMJobBless() determine that the job is already installed? What do I >> need to do, beyond creating an entirely new job name, to make it look >> different enough to replace? >> >> Following is my code and console output (from macOS 10.12.2). >> >> James Foster >> >> >> CODE: >> >> - (void)installHelperTool; >> { >> OSStatus status = AuthorizationCreate(...); >> // handle errors >> >> NSLog(@"existing: %@", [self system:@"/usr/bin/otool -P " >> "/Library/PrivilegedHelperTools/com.GemTalk.GemStone.Helper | " >> "grep -A 1 VersionString | tail -1"]); >> NSLog(@"replacement: %@", [self system:@"/usr/bin/otool -P " >> >> "GemStone.app/Contents/Library/LaunchServices/com.GemTalk.GemStone.Helper | " >> "grep -A 1 VersionString | tail -1"]); >> CFErrorRef cfError = nil; >> if (SMJobBless(kSMDomainSystemLaunchd, (__bridge >> CFStringRef)@kHelperIdentifier, authRef, &cfError)) { >> NSLog(@"SMJobBless(%s,...) returned true; attempting (%s).", >> kHelperIdentifier, kShortVersionString); >> NSLog(@"now found: %@", [self system:@"/usr/bin/otool -P " >> "/Library/PrivilegedHelperTools/com.GemTalk.GemStone.Helper | " >> "grep -A 1 VersionString | tail -1"]); >> } else { >> AppError(@"Helper tool installation failed: %@", [(__bridge >> NSError*) cfError localizedDescription]); >> } >> } >> >> >> CONSOLE: >> >> default 14:25:04.368568 -0800 authd Succeeded authorizing right >> 'com.apple.ServiceManagement.blesshelper' by client >> '/Users/jfoster/Library/Developer/Xcode/DerivedData/GemStone-akfvfyaoddyaavgbcxnrdhnovoal/Build/Products/Debug/GemStone.app' >> [5626] for authorization created by >> '/Users/jfoster/Library/Developer/Xcode/DerivedData/GemStone-akfvfyaoddyaavgbcxnrdhnovoal/Build/Products/Debug/GemStone.app' >> [5626] (13,0) >> default 14:25:04.889238 -0800 kernel AMFI: allowing exception >> handler for 'GemStone' (5626) because the process is not restricted. >> default 14:25:04.385444 -0800 GemStone existing: >> <string>1.3.3.9</string> >> default 14:25:04.900905 -0800 kernel AMFI: allowing exception >> handler for 'GemStone' (5626) because the process is not restricted. >> default 14:25:04.397113 -0800 GemStone replacement: >> <string>1.4.0</string> >> default 14:25:04.398426 -0800 authd Succeeded authorizing right >> 'com.apple.ServiceManagement.blesshelper' by client '/usr/libexec/smd' [251] >> for authorization created by >> '/Users/jfoster/Library/Developer/Xcode/DerivedData/GemStone-akfvfyaoddyaavgbcxnrdhnovoal/Build/Products/Debug/GemStone.app' >> [5626] (3,0) >> default 14:25:04.408694 -0800 GemStone >> SMJobBless(com.GemTalk.GemStone.Helper,...) returned true; attempting >> (1.4.0). >> default 14:25:04.923798 -0800 kernel AMFI: allowing exception >> handler for 'GemStone' (5626) because the process is not restricted. >> default 14:25:04.419988 -0800 GemStone now found: >> <string>1.3.3.9</string> >> > > _______________________________________________ > launchd-dev mailing list > launchd-dev@lists.macosforge.org > https://lists.macosforge.org/mailman/listinfo/launchd-dev
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ launchd-dev mailing list launchd-dev@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/launchd-dev