[launchd-dev] SMJobBless not copying entire __launchd_plist

Damien Sorresso dsorresso at apple.com
Fri Jul 9 12:30:57 PDT 2010


On Jul 9, 2010, at 6:33 AM, Richard Brown wrote:
> The documentation for SMJobBless states that "[t]he helper tool must
> have an embedded launchd plist. The only required key in this plist is
> the Label key."  This implies to us that other keys in the embedded
> launchd plist (except Program and ProgramArguments) will be respected.
> 
> However, we find that the executable is copied into place, but only
> the Label of our embedded launchd plist (and the ProgramArguments
> generated by the API call) is written out to the
> /Library/LaunchDaemons/reverse-dns-label.helper.plist.

We'll also remove the Program key. Otherwise, I'd have to see your plist to diagnose further.

> We are further unable to get the SMJobBless API to upgrade the
> installed helper tool based on "Bundle version" version number in the
> __info_plist; we instead receive "(kSMErrorDomainFramework error -308
> - Unknown error code: -308)" in the CFErrorRef.  But if we manually
> remove the launchd job and delete the helper tool & plist files,
> SMJobBless succeeds, with the new launchd plist containing the same
> information as the previous, namely the Label and ProgramArguments,
> but nothing else from the embedded __launchd_plist section.

It sounds like your plist is somehow getting truncated.

> Can anyone help explain these issues?  Should we try a workaround of
> SMJobCopyDictionary / mutate dictionary / SMJobSubmit to get our other
> keys/values into the launchd plist?


That won't help. Those APIs don't touch the plist on-disk.
-- 
Damien Sorresso
BSD Engineering
Apple Inc.



More information about the launchd-dev mailing list