[FACT-1126] Windows timezone fact uses strftime instead of wcsftime. Created: 2015/07/15  Updated: 2016/03/07  Resolved: 2015/07/16

Status: Closed
Project: Facter
Component/s: Windows
Affects Version/s: FACT 3.0.1
Fix Version/s: FACT 3.0.2

Type: Bug Priority: Normal
Reporter: Peter Huene Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: windows
Remaining Estimate: 0 minutes
Time Spent: 1 hour
Original Estimate: Not Specified

Issue Links:
Story Points: 1
Sprint: Client 2015-07-22


When Windows is configured to use a timezone that has a localized name, like Mitteleuropäische Sommerzeit, Facter reports the timezone as Mitteleurop‰ische Sommerzeit in its output.

When the facts are sent to a Puppet master, the master reports an invalid UTF-8 sequence for the string.

I believe this is a result of using strftime instead of the correct wcsftime and then converting the result into UTF-8. Also, the return value of wcsftime should be used to size the string.

Comment by Peter Huene [ 2015/07/15 ]

I've reproduced this in Windows Server 2012 by installing the German Language Pack for Germany, setting my interface language to German while keeping my keyboard input as English. Set the timezone to "UTC+1 (Brussels, Paris, etc)" to reproduce exactly.

Comment by Shaigy Nixon [X] (Inactive) [ 2015/07/16 ]

Steps to reproduce:
1) On win2012, goto Control Panel
2) From 'Clock, Language and Region' section choose 'Add a Language' option
3) 'Change your language preferences ' => 'Add a language' to get a list of available languages.
4) 'German => Open' and then 'German(Germany)=>add'
5)From the Language window, Deutsch(Deutschland)=>options=>Download and Install language pack, to install the new language pack.
6) After successfully installing the new language pack, on the Language window, move up the Deutsch language to the top to make it the primary language.
7) From the Language window=>Advanced settings=>Override for default input method, choose English from the drop down list.
8) Now to change the time zone, click on the time displayed at the bottom => Change Date and Time settings=>Change Time Zone, choose UTC+1 for Brussles, Copenhagen, Madrid, Paris and click OK.
8) Log out and log back in
9) From the command prompt run 'facter' and 'puppet agent -t'

Validated on win-2012r2-x86_64 on SHA: 8a146ff6a0972c7eb81c40441eface329f628ad5

C:\Users\Administrator>facter timezone
Mitteleuropäische Sommerzeit
C:\Users\Administrator>puppet agent -t --server octlggp6qf2jk8m.delivery.puppetl
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for pux1o7n0sbq71zk.delivery.puppetlabs.net
Info: Applying configuration version '1437065636'
Notice: Applied catalog in 0.03 seconds
C:\Users\Administrator>facter --version
3.0.1 (commit 5c23a0f1b40d2d39901d4441c2851ea4d13f1e2e)

On master:

[root@octlggp6qf2jk8m data]# grep "timezone" /opt/puppetlabs/server/data/puppetserver/yaml/facts/pux1o7n0sbq71zk.delivery.puppetlabs.net.yaml
  timezone: 'Mitteleuropäische Sommerzeit   '

Generated at Wed Apr 01 14:39:55 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.