Jira (PUP-11164) launchd service provider fails if a parsable but invalid LaunchAgent or LaunchDaemon plist file exists

17 views
Skip to first unread message

Clay Caviness (Jira)

unread,
Jul 8, 2021, 6:50:03 PM7/8/21
to puppe...@googlegroups.com
Clay Caviness created an issue
 
Puppet / Bug PUP-11164
launchd service provider fails if a parsable but invalid LaunchAgent or LaunchDaemon plist file exists
Issue Type: Bug Bug
Affects Versions: PUP 7.8.0
Assignee: Unassigned
Components: Types and Providers
Created: 2021/07/08 3:49 PM
Priority: Normal Normal
Reporter: Clay Caviness

If a file in the LaunchAgents or LaunchDaemons paths is encountered that's parseable by Puppet::Util::Plist.read_plist_from_file but not a valid launchd plist file, then Puppet will crash with an error.

To reproduce:

# echo "aaa" >/Library/LaunchDaemons/invalid.txt
# puppet resource service
Error: Could not run: undefined method `has_key?' for "aaa":String

In launchd.rb line 141, the parsed plist (job) is checked with .has_key? to ensure a Label is present. If the parsed plist is not a Hash, though, this will fail.

I expect the correct course of action is to add a job.is_a?(Hash) check first.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Clay Caviness (Jira)

unread,
Jul 8, 2021, 6:53:04 PM7/8/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jul 13, 2021, 10:29:03 AM7/13/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jul 13, 2021, 10:29:03 AM7/13/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Jul 14, 2021, 4:34:04 AM7/14/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jul 20, 2021, 11:11:04 AM7/20/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jul 20, 2021, 11:12:04 AM7/20/21
to puppe...@googlegroups.com

Gabriel Nagy (Jira)

unread,
Jul 21, 2021, 9:23:04 AM7/21/21
to puppe...@googlegroups.com

Claire Cadman (Jira)

unread,
Aug 11, 2021, 9:24:04 AM8/11/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages