tags 782494 + patch
thanks

Hi,

This is indeed related to upstream bug #22703. The fix to this bug is no longer
needed, since ruby Etc module now handles encoding correctly (from ruby 2.1.0)

  commit 4c009414119347e87d9bb2402617a4585dd3f341
  Author: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
  Date:   Sat Aug 3 00:46:10 2013 +0000
  
      etc.c: encodings
      
      * ext/etc/etc.c (setup_passwd, setup_group): set proper encodings to
        string members.

Test with the following user : useradd -c 'éèéù' test

Just before this commit (at 042e5013a3bc42a3637aa1646e9fc002436b852f) :
  ruby -retc -e 'p Etc.getpwnam("test").gecos.encoding'
  #<Encoding:ASCII-8BIT>

At commit 4c009414119347e87d9bb2402617a4585dd3f341 :
  ruby -retc -e 'p Etc.getpwnam("test").gecos.encoding'
  #<Encoding:UTF-8>

The following patch has been tested successfully on wheezy and jessie.

Regards
-- 
Cédric
>From f13f102622725283264fb80fc0d4679692edacda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Barboiron?= <[email protected]>
Date: Thu, 28 May 2015 14:30:05 +0200
Subject: [PATCH] fix again #22703 for ruby >= 2.1.0

---
 lib/puppet/type/user.rb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb
index 12c4250..9e18f98 100644
--- a/lib/puppet/type/user.rb
+++ b/lib/puppet/type/user.rb
@@ -170,8 +170,10 @@ module Puppet
 
     newproperty(:comment) do
       desc "A description of the user.  Generally the user's full name."
-      munge do |v|
-        v.respond_to?(:force_encoding) ? v.force_encoding(Encoding::ASCII_8BIT) : v
+      if RUBY_VERSION < "2.1.0"
+        munge do |v|
+          v.respond_to?(:force_encoding) ? v.force_encoding(Encoding::ASCII_8BIT) : v
+        end
       end
     end
 
-- 
2.1.0

Reply via email to