Jira (PUP-9304) Puppet::Util::Execution.execute does not have binary-safe stdinfile support

4 views
Skip to first unread message

Sean Millichamp (JIRA)

unread,
Nov 7, 2018, 1:57:05 PM11/7/18
to puppe...@googlegroups.com
Sean Millichamp created an issue
 
Puppet / Bug PUP-9304
Puppet::Util::Execution.execute does not have binary-safe stdinfile support
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2018/11/07 10:56 AM
Priority: Normal Normal
Reporter: Sean Millichamp

 

While working on a patch to address SERVER-2167 I was trying to pass binary data on stdin to a command (gpg) run by Puppet::Util::Execution.execute using the stdinfile option.

GPG was returning errors indicating the input data was corrupted so I did some digging. I believe that the 'r' in this line https://github.com/puppetlabs/puppet/blob/d4348e02c5eba0222d400ab0883f53cc8e2a086f/lib/puppet/util/execution.rb#L199 should be 'rb' to indicate to Ruby that the encoding should be treated as ASCII-8BIT instead of the default (in my environment UTF-8).

It should be safe to pass binary data in via execute's stdinfile option and if the current behavior cannot be changed then there should be an option which indicates that stdinfile should be treated as binary data.

In this instance, I was able to work around the issue by passing the file directly to gpg as a command line argument instead of using stdinfile (and it worked), but it may not be possible to do that in every use case.

My testing was within Puppetserver in PE 2018.1.3.

 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Josh Cooper (JIRA)

unread,
Nov 8, 2018, 1:20:03 PM11/8/18
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Nov 8, 2018, 1:20:04 PM11/8/18
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Nov 8, 2018, 1:21:03 PM11/8/18
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-9304
 
Re: Puppet::Util::Execution.execute does not have binary-safe stdinfile support

Thanks Sean Millichamp. It looks like there are a few places where we should be specifying rb and wb.

Josh Cooper (Jira)

unread,
Jun 11, 2020, 2:51:03 AM6/11/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-9304

This is related to PUP-9559

This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Oct 23, 2020, 8:00:03 PM10/23/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 5.5.z
Fix Version/s: PUP 6.y
Reply all
Reply to author
Forward
0 new messages