[Pkg-puppet-devel] Bug#782494: puppet: Non-ASCII user realnames cause encoding errors when running with a UTF-8 locale

Tero Marttila tero.marttila at paivola.fi
Mon Apr 13 07:25:12 UTC 2015


Package: puppet
Version: 3.7.2-4
Severity: important

Hi,

When testing my puppet infrastructure with Debian jessie puppet 3.7 and a UTF-8 locale, I noticed a regression vs debian wheezy concerning users with non-ASCII realnames.

	$ locale
	LANG=en_US.UTF-8
	LC_CTYPE="en_US.UTF-8"
	...
	$ puppet -V
	3.7.2
	$ ruby --version
	ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]

Adding a new user, or changing a pure-ASCII comment to a non-ASCII comment, works fine:

	$ getent passwd terom
	terom:x:1001:100:Tero:/home/terom:/bin/bash
	$ sudo LANG=C.UTF-8 puppet resource user terom ensure=present comment=Tëro
	Notice: /User[terom]/comment: comment changed 'Tero' to 'Tëro'
	user { 'terom':
	  ensure  => 'present',
	  comment => 'Tëro',
	}

However, user resources with non-ASCII real names in the /etc/passwd comment field trigger encoding-related errors and fail to apply:

	$ sudo LANG=C.UTF-8 puppet resource user terom ensure=present comment=Tëro
	Error: Could not convert change 'comment' to string: incompatible character encodings: UTF-8 and ASCII-8BIT
	Error: Could not convert change 'comment' to string: incompatible character encodings: UTF-8 and ASCII-8BIT
	Error: /User[terom]: Could not evaluate: Puppet::Util::Log requires a message
	user { 'terom':
	  ensure  => 'present',
	  comment => 'Tëro',
	}

The bug seems closely related to the upstream bug #22703, which should have been fixed in Puppet 3.4?

	https://projects.puppetlabs.com/issues/22703

The workaround is to use a non-UTF-8 locale.

	$ sudo LANG=C puppet resource user terom ensure=present comment=Tëro
	user { 'terom':
	  ensure  => 'present',
	  comment => 'Tëro',
	}

This also happens with the upstream puppet 3.7.5 on Debian jessie:

	$ dpkg -l puppet
	Desired=Unknown/Install/Remove/Purge/Hold
	| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
	|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
	||/ Name                              Version               Architecture          Description
	+++-=================================-=====================-=====================-========================================================================
	ii  puppet                            3.7.5-1puppetlabs1    all                   Centralized configuration management - agent startup and compatibility s
	$ puppet --version
	3.7.5
	$ sudo LANG=C.UTF-8 puppet resource user terom ensure=present comment=Tëro
	Error: Could not convert change 'comment' to string: incompatible character encodings: UTF-8 and ASCII-8BIT
	Error: Could not convert change 'comment' to string: incompatible character encodings: UTF-8 and ASCII-8BIT
	Error: /User[terom]: Could not evaluate: Puppet::Util::Log requires a message
	user { 'terom':
	  ensure  => 'present',
	  comment => 'Tëro',
	}

However, the upstream 3.7.5 on debian wheezy works fine:

	$ dpkg -l puppet ruby
	Desired=Unknown/Install/Remove/Purge/Hold
	| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
	|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
	||/ Name                              Version               Architecture          Description
	+++-=================================-=====================-=====================-========================================================================
	ii  puppet                            3.7.5-1puppetlabs1    all                   Centralized configuration management - agent startup and compatibility s
	ii  ruby                              1:1.9.3               all                   Interpreter of object-oriented scripting language Ruby (default version)
	$ getent passwd terom
	terom:x:1001:100:Tëro:/home/terom:/bin/bash
	$ sudo LANG=C.UTF-8 puppet resource user terom ensure=present comment=Tëro
	user { 'terom':
	  ensure  => 'present',
	  comment => 'Tëro',
	}
	
 -- Tero Marttila

-- System Information:
Debian Release: 8.0
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages puppet depends on:
ii  init-system-helpers         1.22
ii  puppet-common               3.7.2-4
ii  ruby                        1:2.1.5
ii  ruby2.1 [ruby-interpreter]  2.1.5-2

puppet recommends no packages.

Versions of packages puppet suggests:
pn  etckeeper   <none>
pn  puppet-el   <none>
pn  vim-puppet  <none>

-- Configuration Files:
/etc/default/puppet e3a89dd703e6b796ef7889ba75af2df7 [Errno 2] No such file or directory: u'/etc/default/puppet e3a89dd703e6b796ef7889ba75af2df7'
/etc/logrotate.d/puppet 037c34a239a8895833388ccfce278adc [Errno 2] No such file or directory: u'/etc/logrotate.d/puppet 037c34a239a8895833388ccfce278adc'

-- no debconf information



More information about the Pkg-puppet-devel mailing list