Issue #14060 has been updated by Daniel Pittman.

Status changed from Unreviewed to In Topic Branch Pending Review
Target version set to 2.7.x

https://github.com/puppetlabs/puppet/pull/698 has the fix for this.
----------------------------------------
Bug #14060: exec shell provider does "unexpected" shell quoting
https://projects.puppetlabs.com/issues/14060#change-61101

Author: Matthew Byng-Maddick
Status: In Topic Branch Pending Review
Priority: Normal
Assignee: 
Category: exec
Target version: 2.7.x
Affected Puppet version: 2.7.13
Keywords: exec shell provider
Branch: 


The shell provider for the exec resource type (`puppet/provider/exec/shell.rb`) 
claims that it tries to mirror the behaviour of the 0.25.x series of 
(un-provider-ed) exec types.

Simply put, it doesn't.

It wraps what is supplied in the command in *double* quotes ("") meaning that 
expansions of $ and \ take place at the wrong level, and only substitutes out " 
with \"

It currently does:
<pre>
  def run(command, check = false)
    command = %Q{/bin/sh -c "#{command.gsub(/"/,'\"')}"}
    super(command, check)
  end
</pre>
But should actually do:
<pre>
  def run(command, check = false)
    command = %Q{/bin/sh -c '#{command.gsub(/'/,"'\"'\"'")}'}
    super(command, check)
  end
</pre>

Principle of least surprise and all...


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to