Jira (BOLT-1344) run_command inserting a BOM in command

6 views
Skip to first unread message

Erick Banks (JIRA)

unread,
May 24, 2019, 6:15:03 PM5/24/19
to puppe...@googlegroups.com
Erick Banks created an issue
 
Puppet Task Runner / Bug BOLT-1344
run_command inserting a BOM in command
Issue Type: Bug Bug
Affects Versions: BOLT 1.20.0
Assignee: Unassigned
Created: 2019/05/24 3:14 PM
Labels: windows windows-parity
Priority: Normal Normal
Reporter: Erick Banks

Puppet Version:
bolt 1.20.0
puppet litmus 0.2.0

OS Name/Version:
Test runner - Mac OSX 10.14.4
System under test - Windows 2016, vm pooler win-2016-x86_64

Describe your issue in as much detail as possible...
When running a "run_shell" method via Litmus, which calls out to Bot's "run_command" a Byte Order Mark (BOM, represented by hex value U+FEFF) is being inserted into my command rendering the output on the system under test not runnable.

Desired Behavior:
When "run_command" is given a string it does not insert undesired BOM into the string.

Actual Behavior:
"run_command" inserts BOM into my string that gets written to file as a string with a leading "?" like so:

?try { if (Invoke-DscResource -Name File -Method Test -ModuleName C:/ProgramData/PuppetLabs/code/environments/production/modules/dsc/lib/puppet_x/dsc_resources/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 -Verbose -Property @{"DestinationPath"="C:/test/test.txt";"Contents"="catcat"}) { exit 0 } else { exit 1 } } catch { Write-Host $_.Exception.Message; exit 1 }

Steps to repro:
Execute "run_command" at .bundle/gems/ruby/2.3.0/gems/bolt-1.20.0/lib/bolt/executor.rb:229 with the string "command" equal to

"Set-Content -Path C:/temp/temp.ps1 -Value 'try { if (Invoke-DscResource -Name File -Method Test -ModuleName C:/ProgramData/PuppetLabs/code/environments/production/modules/dsc/lib/puppet_x/dsc_resources/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 -Verbose -Property @{\"DestinationPath\"=\"C:/test/test.txt\";\"Contents\"=\"catcat\"}) { exit 0 } else { exit 1 } } catch { Write-Host $_.Exception.Message; exit 1 }' -Encoding ASCII"

Note "description" at .bundle/gems/ruby/2.3.0/gems/bolt-1.20.0/lib/bolt/executor.rb @ line 154 is correct.

However by "results @object" at .bundle/gems/ruby/2.3.0/gems/bolt-1.20.0/lib/bolt/executor.rb @ line 156 the string as an added BOM:

"Set-Content -Path C:/temp/temp.ps1 -Value '<U+FEFF>try { if (Invoke-DscResource -Name File -Method Test -ModuleName C:/ProgramData/PuppetLabs/code/environments/production/modules/dsc/lib/puppet_x/dsc_resources/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 -Verbose -Property @{\"DestinationPath\"=\"C:/test/test.txt\";\"Contents\"=\"catcat\"}) { exit 0 } else { exit 1 } } catch { Write-Host $_.Exception.Message; exit 1 }' -Encoding ASCII"

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

Erick Banks (JIRA)

unread,
May 24, 2019, 6:15:04 PM5/24/19
to puppe...@googlegroups.com
Erick Banks updated an issue
Change By: Erick Banks
*Puppet Version:*
bolt 1.20.0
puppet litmus 0.2.0

*OS Name/Version:*

Test runner - Mac OSX 10.14.4
System under test - Windows 2016, vm pooler win-2016-x86_64

_Describe your issue in as much detail as possible..._

When running a "run_shell" method via Litmus, which calls out to Bot's "run_command" a Byte Order Mark (BOM, represented by hex value U+FEFF) is being inserted into my command rendering the output on the system under test not runnable.

*Desired Behavior:*

When "run_command" is given a string it does not insert undesired BOM into the string.

*Actual Behavior:*

"run_command" inserts BOM into my string that gets written to file as a string with a leading "?" like so:

{code:powershell}

?try { if (Invoke-DscResource -Name File -Method Test -ModuleName C:/ProgramData/PuppetLabs/code/environments/production/modules/dsc/lib/puppet_x/dsc_resources/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 -Verbose -Property @{"DestinationPath"="C:/test/test.txt";"Contents"="catcat"}) { exit 0 } else { exit 1 } } catch { Write-Host $_.Exception.Message; exit 1 }

{code}


Steps to repro:
Execute "run_command" at .bundle/gems/ruby/2.3.0/gems/bolt-1.20.0/lib/bolt/executor.rb:229 with the string "command" equal to
{code:powershell}

"Set-Content -Path C:/temp/temp.ps1 -Value 'try { if (Invoke-DscResource -Name File -Method Test -ModuleName C:/ProgramData/PuppetLabs/code/environments/production/modules/dsc/lib/puppet_x/dsc_resources/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 -Verbose -Property @{\"DestinationPath\"=\"C:/test/test.txt\";\"Contents\"=\"catcat\"}) { exit 0 } else { exit 1 } } catch { Write-Host $_.Exception.Message; exit 1 }' -Encoding ASCII"
{code}


Note "description" at .bundle/gems/ruby/2.3.0/gems/bolt-1.20.0/lib/bolt/executor.rb @ line 154 is correct.

However by "results @object" at .bundle/gems/ruby/2.3.0/gems/bolt-1.20.0/lib/bolt/executor.rb @ line 156 the string as an added BOM:
{code:powershell}

"Set-Content -Path C:/temp/temp.ps1 -Value '<U+FEFF>try { if (Invoke-DscResource -Name File -Method Test -ModuleName C:/ProgramData/PuppetLabs/code/environments/production/modules/dsc/lib/puppet_x/dsc_resources/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 -Verbose -Property @{\"DestinationPath\"=\"C:/test/test.txt\";\"Contents\"=\"catcat\"}) { exit 0 } else { exit 1 } } catch { Write-Host $_.Exception.Message; exit 1 }' -Encoding ASCII"
{code}

Erick Banks (JIRA)

unread,
May 24, 2019, 6:16:02 PM5/24/19
to puppe...@googlegroups.com
However by "results @object" at .bundle/gems/ruby/2.3.0/gems/bolt-1.20.0/lib/bolt/executor.rb @ line 156 the string as now has an added BOM before "try" :

{code:powershell}
"Set-Content -Path C:/temp/temp.ps1 -Value '<U+FEFF>try { if (Invoke-DscResource -Name File -Method Test -ModuleName C:/ProgramData/PuppetLabs/code/environments/production/modules/dsc/lib/puppet_x/dsc_resources/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 -Verbose -Property @{\"DestinationPath\"=\"C:/test/test.txt\";\"Contents\"=\"catcat\"}) { exit 0 } else { exit 1 } } catch { Write-Host $_.Exception.Message; exit 1 }' -Encoding ASCII"
{code}
Reply all
Reply to author
Forward
0 new messages