Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1341

Facter Throws Unhandled Exception when Run Under Unicode User

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • FACT 3.1.5
    • Windows
    • Bug Fix
    • In Puppet with Facter 3, using Windows-1252 extended characters such as ö and æ in a user name on Windows would cause an exception to be thrown by Facter. This has been fixed.

    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. Create user "Jöhn".
      3. Logoff and login as "Jöhn".
      4. 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',
        }

      5. Open a Puppet Console session as Administrator.
      6. Change console font to "Lucidia Console". (Puppet will crash otherwise. PUP-5717)
      7. Change codepage:

        chcp 437

      8. Execute the following command on the SUT:

        puppet apply c:\test.pp

      9. List the contents of the user profiles directory:

        dir C:\Users

      Expect

      The Puppet run should succeed.

      Actual

      Facter reports an uncaught exception.

      C:\>chcp 437
      Active code page: 437
       
      C:\>puppet apply c:\test.pp
      Error: Facter: Facter.search uncaught exception: boost::filesystem::path codecvt
       to wstring: error
      Error: Facter: Facter.reset uncaught exception: boost::filesystem::path codecvt
      to wstring: error
      Error: Facter: Facter.search uncaught exception: boost::filesystem::path codecvt
       to wstring: error
      Error: Facter: Facter.reset uncaught exception: boost::filesystem::path codecvt
      to wstring: error
      Error: Facter: Facter.add uncaught exception: boost::filesystem::path codecvt to
       wstring: error
      Notice: Compiled catalog for w2012r2.corp.puppetlabs.net in environment producti
      on in 0.11 seconds
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns:
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: Name
                       Value
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: ----
                       -----
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: ALLUSERSPROFIL
      E                C:\ProgramData
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: APPDATA
                       C:\Users\Jöhn\AppData\Roaming
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: CommonProgramF
      iles             C:\Program Files\Common Files
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: CommonProgramF
      iles(x86)        C:\Program Files (x86)\Common Files
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: CommonProgramW
      6432             C:\Program Files\Common Files
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: COMPUTERNAME
                       W2012R2
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: ComSpec
                       C:\Windows\system32\cmd.exe
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: FACTER_env_win
      dows_installdir  C:\Program Files\Puppet Labs\Puppet
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: FACTERDIR
                       C:\Program Files\Puppet Labs\Puppet\facter
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: FP_NO_HOST_CHE
      CK               NO
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: HIERA_DIR
                       C:\Program Files\Puppet Labs\Puppet\hiera
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: HOME
                       C:/Users/Jöhn
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: HOMEDRIVE
                       C:
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: HOMEPATH
                       \Users\Jöhn
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: LOCALAPPDATA
                       C:\Users\Jöhn\AppData\Local
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: LOGONSERVER
                       \\W2012R2
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: MCOLLECTIVE_DI
      R                C:\Program Files\Puppet Labs\Puppet\mcollective
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: NUMBER_OF_PROC
      ESSORS           1
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: OS
                       Windows_NT
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: Path
                       C:/Program Files/Puppet Labs/Puppet/facter/bi...
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: PATHEXT
                       .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;....
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: PL_BASEDIR
                       C:\Program Files\Puppet Labs\Puppet
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: PROCESSOR_ARCH
      ITECTURE         AMD64
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: PROCESSOR_IDEN
      TIFIER           Intel64 Family 6 Model 58 Stepping 9, Genuine...
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: PROCESSOR_LEVE
      L                6
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: PROCESSOR_REVI
      SION             3a09
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: ProgramData
                       C:\ProgramData
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: ProgramFiles
                       C:\Program Files
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: ProgramFiles(x
      86)              C:\Program Files (x86)
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: ProgramW6432
                       C:\Program Files
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: PROMPT
                       $P$G
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: PSModulePath
                       C:\Users\Jöhn\Documents\WindowsPowerShell\Mod...
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: PUBLIC
                       C:\Users\Public
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: PUPPET_DIR
                       C:\Program Files\Puppet Labs\Puppet\puppet
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: RUBYLIB
                       C:/Program Files/Puppet Labs/Puppet/puppet/li...
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: RUBYOPT
                       rubygems
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: SCRIPT_NAME
                       puppet
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: SCRIPT_TEMP
                       puppet
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: SESSIONNAME
                       Console
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: SSL_CERT_DIR
                       C:\Windows\system32\ssl\certs
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: SSL_CERT_FILE
                       C:\Windows\system32\ssl\cert.pem
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: SystemDrive
                       C:
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: SystemRoot
                       C:\Windows
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: TEMP
                       C:\Users\JHN~1\AppData\Local\Temp\2
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: TMP
                       C:\Users\JHN~1\AppData\Local\Temp\2
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: USER
                       Jöhn
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: USERDOMAIN
                       W2012R2
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: USERDOMAIN_ROA
      MINGPROFILE      W2012R2
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: USERNAME
                       Jöhn
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: USERPROFILE
                       C:\Users\Jöhn
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: windir
                       C:\Windows
      Notice: /Stage[main]/Main/Exec[tomcat-configure-service]/returns: executed succe
      ssfully
      Notice: Applied catalog in 3.14 seconds
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ryan.gard Ryan Gard
              Ryan Gard Ryan Gard
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support