Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-5798

Puppet::Util::Execution.execute does not support UTF8 chars reported from STDOUT

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Duplicate
    • None
    • None
    • None
    • Puppet Agent 4.3.2

    Description

      Puppet::Util::Execution.execute does not support UTF8 chars reported from STDOUT.

      Example Integration spec test;

        describe "#execute (Windows) STDOUT", :if => Puppet.features.microsoft_windows? do
          let(:utf8text) do
            "utf8testfile" + [195, 164].pack('c*').force_encoding(Encoding::UTF_8)
          end
          let(:temputf8filename) do
            script_containing(utf8text, :windows => "@ECHO OFF\nECHO #{utf8text}\nEXIT 100")
          end
       
          it "should execute with non-english characters in command line" do
            result = Puppet::Util::Execution.execute("cmd /c \"#{temputf8filename}\"", :failonfail => false)
            expect(temputf8filename.encoding.name).to eq('UTF-8')
            expect(result.exitstatus).to eq(100)
            expect(result).to eq(utf8text)
          end
        end
      

      Result from CMD.EXE and IBM437 local codepage

      DL is deprecated, please use Fiddle
      Run options:
        include {:locations=>{"./spec/integration/util/execution_spec.rb"=>[43]}}
        exclude {:broken=>true, :benchmark=>true}
       
      Puppet::Util::Execution
        #execute (Windows) STDOUT
          should execute with non-english characters in command line (FAILED - 1)
       
      Failures:
       
        1) Puppet::Util::Execution#execute (Windows) STDOUT should execute with non-en
      glish characters in command line
           Failure/Error: expect(result).to eq(utf8text)
       
             expected: "utf8testfile\u00E4"
                  got: "utf8testfileä\n"
       
             (compared using ==)
       
             Diff:
             @@ -1,2 +1,2 @@
             -utf8testfileä
             +utf8testfileä
           # ./spec/integration/util/execution_spec.rb:48:in `block (3 levels) in <top
       (required)>'
       
      Finished in 1.08 seconds (files took 1.95 seconds to load)
      1 example, 1 failure
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              glenn.sarti Glenn Sarti
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support