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

Cannot Execute PowerShell Command as Unicode User

    Details

      Description

      Description

      If a user with Unicode name attempts to run a manifest that calls PowerShell it will result in a failure:

      Error: Could not initialize global default settings: Invalid argument @ dir_s_mk
      dir - C:/Users/???

      Attachments

      • None.

      Reproduction Steps

      1. Install Puppet Agent on SUT.
      2. Install Chinese language pack and keyboard on SUT.
      3. Create user "你好吗".
      4. Logoff and login as "你好吗".
      5. Create the manifest "C:\test.pp" on the SUT with the following content:

        exec { 'tomcat-configure-service':
          command  => "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe Get-ChildItem Env:",
          onlyif   => "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe exit 0",
          provider => windows,
          logoutput => true,
          tag      => 'tomcat-configure-service',
        }

      6. Open a Puppet Console session. (IN CURRENT USER CONTEXT!)
      7. Change console font to "Lucidia Console". (Puppet will crash otherwise. PUP-5717)
      8. Change codepage:

        chcp 65001

      9. Execute the following command on the SUT:

        puppet apply c:\test.pp --trace

      Expect

      Puppet should compile and run the manifest successfully.

      Actual

      Puppet fails:

      C:\Users\你好吗>chcp 65001
      Active code page: 65001
       
      C:\Users\你好吗>puppet apply c:\test.pp
      Error: Could not initialize global default settings: Invalid argument @ dir_s_mk
      dir - C:/Users/???
       
      C:\Users\你好吗>puppet apply c:\test.pp --trace
      Error: Could not initialize global default settings: Invalid argument @ dir_s_mk
      dir - C:/Users/???
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/fileutils.rb:250:in
      `mkdir'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/fileutils.rb:250:in
      `fu_mkdir'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/fileutils.rb:224:in
      `block (2 levels) in mkdir_p'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/fileutils.rb:222:in
      `reverse_each'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/fileutils.rb:222:in
      `block in mkdir_p'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/fileutils.rb:208:in
      `each'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/fileutils.rb:208:in
      `mkdir_p'
      C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/settings.rb:358:in `create
      _ancestors'
      C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/settings.rb:343:in `block
      in initialize_app_defaults'
      C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/settings.rb:342:in `each'
      C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/settings.rb:342:in `initia
      lize_app_defaults'
      C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet.rb:135:in `do_initialize_s
      ettings_for_run_mode'
      C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet.rb:127:in `initialize_sett
      ings'
      C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/command_line.rb:67:in
       `block in execute'
      C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:491:in `exit_on_fa
      il'
      C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/command_line.rb:66:in
       `execute'
      C:/Program Files/Puppet Labs/Puppet/puppet/bin/puppet:5:in `<main>'
      

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  ryan.gard Ryan Gard
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated: