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

Non-English values in environment variables gets garbled on Windows

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Done
    • Affects Version/s: PUP 3.7.4
    • Fix Version/s: None
    • Component/s: Windows
    • Labels:
    • Environment:

      Windows 7 64 bit Swedish
      Windows 10 TP Build 10041 64 bit English
      PE 3.7.2 (Puppet 3.7.4) 64-bit (Ruby 2.0.0)

    • Template:
    • Story Points:
      2
    • Sprint:
      Windows 2016-01-27
    • CS Priority:
      Major
    • UX Priority:
      Major

      Description

      I discovered a problem today when I ran one of my modules on a computer running Windows. The cause of the problem was non-US characters in the users home directory (aka userprofile). The non-US characters in question was å, ä and ö. My only way of solving this was to rename the user account on the computer to a name with only English characters.

      I managed to reproduce the problem with a minimal manifest that I include in this ticket. The manifest works fine if my user account is c:\Users\John but if I change it to c:\Users\Jöhn it destroys the Swedish character and instead outputs C:\Users\JA›ƒ,ªA?hn

      This happens in an exec resource like this:

      	exec { 'tomcat-configure-service':
      		command  => "powershell.exe Get-ChildItem Env:",
      		onlyif   => 'powershell.exe exit 0',      
      		provider => windows,
      		logoutput => true,
      		#notify => $tomcat_service,
      		tag      => 'tomcat-configure-service',
      	}
      

      To reproduce the error I ran it like this on Windows in cmd.exe:

      set USERNAME=Jöhn
      set USERPROFILE=C:\Users\Jöhn
      M:\Virtual Machines\Puppet Windows development\synced_folder>puppet apply manifests\bug_swedish_userprofile.pp --test
      

      In the output you can see the garbled text. I include the complete output in the attached file puppetrun.log. To also see it internally in Ruby I added logging to util.rb. Simply replace it in C:\Program Files\Puppet Labs\Puppet Enterprise\puppet\lib\puppet with mine.

      This problem is a serious road block for running this in production so I would like to see it prioritized.

        Attachments

        1. bug_swedish_userprofile.pp
          0.9 kB
        2. puppetrun.log
          73 kB
        3. util.rb
          18 kB

          Issue Links

            Activity

              People

              Assignee:
              glenn.sarti Glenn Sarti
              Reporter:
              John Ericson John Ericson
              QA Contact:
              Ryan Gard
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support