Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#10041 closed defect (worksforme)

Syntax error in LaunchDaemon startupitems

Reported by: macfreek (Freek Dijkstra) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 1.2
Keywords: Cc:
Port:

Description

A recent installation of both "apache2" and "mysql5 +server" resulted in two unusable LaunchDaemon files.

The reason is that the first line of the ProgramArguments array is the first argument. It should instead be the program name. I completely agree this seems counter intuitive, but this is how Apple defined the launchd.plist syntax. Don't blame the messenger ;) (see man launchd.plist for sparse details; you can also look in other plist examples to find out).

Attached are two patch files for /opt/local/etc/LaunchDaemons/org.darwinports.mysql5/org.darwinports.mysql5.plist and /opt/local/etc/LaunchDaemons/org.darwinports.mysql5/org.darwinports.apache2.plist which do work on my system.

In addition, I'll attach a patch for portstartupitem.tcl, which adds the program as the first entry of the ProgramArguments array.

Attachments (3)

apache2-launchd.diff (546 bytes) - added by macfreek (Freek Dijkstra) 18 years ago.
Diff for the current incorrect and the fixed /Library/LaunchDeamon/org.darwinports.apache2.plist, with correct ProgramArguments.
mysql5-launchd.diff (530 bytes) - added by macfreek (Freek Dijkstra) 18 years ago.
Diff for the current incorrect and the fixed /Library/LaunchDeamon/org.darwinports.mysql5.plist, with correct ProgramArguments.
portstartupitem.tcl.patch (426 bytes) - added by macfreek (Freek Dijkstra) 18 years ago.
Patch for portstartupitem.tcl, which should produce correct launchd plists.

Download all attachments as: .zip

Change History (5)

Changed 18 years ago by macfreek (Freek Dijkstra)

Attachment: apache2-launchd.diff added

Diff for the current incorrect and the fixed /Library/LaunchDeamon/org.darwinports.apache2.plist, with correct ProgramArguments.

Changed 18 years ago by macfreek (Freek Dijkstra)

Attachment: mysql5-launchd.diff added

Diff for the current incorrect and the fixed /Library/LaunchDeamon/org.darwinports.mysql5.plist, with correct ProgramArguments.

Changed 18 years ago by macfreek (Freek Dijkstra)

Attachment: portstartupitem.tcl.patch added

Patch for portstartupitem.tcl, which should produce correct launchd plists.

comment:1 Changed 18 years ago by pguyot (Paul Guyot)

Resolution: worksforme
Status: newclosed

I think the code in HEAD is correct.

This is what I get for mysql5+server: <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE plist PUBLIC -Apple ComputerDTD PLIST 1.0EN http://www.apple.com/DTDs/PropertyList-1.0.dtd > <plist version='1.0'> <dict> <key>Label</key><string>org.darwinports.mysql5</string> <key>ProgramArguments</key> <array>

<string>/opt/local/bin/daemondo</string> <string>--label=mysql5</string> <string>--start-cmd</string> <string>/opt/local/etc/LaunchDaemons/org.darwinports.mysql5/mysql5.wrapper</string> <string>start</string> <string>;</string> <string>--stop-cmd</string> <string>/opt/local/etc/LaunchDaemons/org.darwinports.mysql5/mysql5.wrapper</string> <string>stop</string> <string>;</string> <string>--restart-cmd</string> <string>/opt/local/etc/LaunchDaemons/org.darwinports.mysql5/mysql5.wrapper</string> <string>restart</string> <string>;</string> <string>--pid=none</string>

</array> <key>Debug</key><false/> <key>Disabled</key><false/> <key>OnDemand</key><false/> <key>RunAtLoad</key><false/> </dict> </plist>

comment:2 Changed 18 years ago by macfreek (Freek Dijkstra)

(In reply to comment #4)

This is what I get for mysql5+server: <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE plist PUBLIC -Apple ComputerDTD PLIST 1.0EN http://www.apple.com/DTDs/PropertyList-1.0.dtd > <plist version='1.0'> <dict> <key>Label</key><string>org.darwinports.mysql5</string> <key>ProgramArguments</key> <array>

<string>/opt/local/bin/daemondo</string> <string>--label=mysql5</string> <string>--start-cmd</string>

[...]

That is correct. Somehow, the plist created on my Mac did not contain this line with "<string>/opt/local/bin/daemondo</string>". Has this code changed lately? "port version" gives "Version: 1.200" for me now. I did check if portstartupitem.tcl was different from the point release I use compared to the CVS HEAD, but didn't see this fixed. Perhaps I did not look closely enough? Otherwise, I don't understand why DarwinPorts on my computer gave me an incorrect plist file.

Note: See TracTickets for help on using tickets.