[launchd-dev] (RESOLVED) SMJobBless not copying entire __launchd_plist

Richard Brown rabrown at quantumcheese.com
Sun Jul 11 16:46:43 PDT 2010


On Fri, Jul 9, 2010 at 15:30, Damien Sorresso <dsorresso at apple.com> wrote:
> 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.
<snip>
> It sounds like your plist is somehow getting truncated.

Using otool and a hex2bin tool, we confirmed that the plist was indeed
being truncated during the -sectcreate.
It seems that our plist file had some manner of deficiency (unexpected
line-break type, perhaps?).  It is strange, though, that we could open
and read the file (initially generated with a shell script) in the
Property List Editor with no difficulty; yet saving it with no
modifications from that utility fixed whatever problem caused the
truncation.
The API is working for us now.

>> 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.
It's not clear to me what "SMJobSubmit submits the given job to the
specified domain" means if it doesn't touch the plist on-disk; is it
only for one-shot jobs?

Richard Brown


More information about the launchd-dev mailing list