[PUP-3501] upstart provider fails with non-ASCII characters in job conf file with a non-UTF8 locale Created: 2014/10/22  Updated: 2017/05/18  Resolved: 2017/05/15

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: PUP 3.7.1
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: Phil Fenstermacher Assignee: Unassigned
Resolution: Duplicate Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 14.04


Issue Links:
Duplicate
duplicates PUP-1055 "invalid byte sequence" with service ... Accepted
Template:

 Description   

The default php5-fpm upstart job configuration file contains the line

author "Ondřej Surý <ondrej@debian.org>"

When I run puppet agent -t from the command line, everything works great, and as expected. When puppet does it's normal run, I get

Error: /Stage[main]/Php::Fpm::Daemon/Service[php5-fpm]: Could not evaluate: invalid byte sequence in US-ASCII

in the reports.

If I unset the LANG environment variable then the run fails from the command line as well, with the same error (making nice traces possible):

Error: /Stage[main]/Php::Fpm::Daemon/Service[php5-fpm]: Could not evaluate: invalid byte sequence in US-ASCII
/usr/lib/ruby/vendor_ruby/puppet/provider/service/upstart.rb:212:in `match'
/usr/lib/ruby/vendor_ruby/puppet/provider/service/upstart.rb:212:in `match'
/usr/lib/ruby/vendor_ruby/puppet/provider/service/upstart.rb:212:in `block in enabled_post_0_9_0?'
/usr/lib/ruby/vendor_ruby/puppet/provider/service/upstart.rb:211:in `each_line'
/usr/lib/ruby/vendor_ruby/puppet/provider/service/upstart.rb:211:in `enabled_post_0_9_0?'
/usr/lib/ruby/vendor_ruby/puppet/provider/service/upstart.rb:109:in `enabled?'
/usr/lib/ruby/vendor_ruby/puppet/type/service.rb:64:in `retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:1058:in `block in retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:1053:in `each'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:1053:in `retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:1076:in `retrieve_resource'
/usr/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:236:in `from_resource'
/usr/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:19:in `evaluate'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:204:in `apply'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:217:in `eval_resource'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `call'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `block (2 levels) in evaluate'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:327:in `block in thinmark'
/usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:326:in `thinmark'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `block in evaluate'
/usr/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:118:in `traverse'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:138:in `evaluate'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:169:in `block in apply'
/usr/lib/ruby/vendor_ruby/puppet/util/log.rb:149:in `with_destination'
/usr/lib/ruby/vendor_ruby/puppet/transaction/report.rb:112:in `as_logging_destination'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:168:in `apply'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:118:in `block in apply_catalog'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `block in benchmark'
/usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:117:in `apply_catalog'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:222:in `run_internal'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:132:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet/context.rb:64:in `override'
/usr/lib/ruby/vendor_ruby/puppet.rb:244:in `override'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:131:in `run'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:47:in `block (4 levels) in run'
/usr/lib/ruby/vendor_ruby/puppet/agent/locker.rb:20:in `lock'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:47:in `block (3 levels) in run'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:117:in `with_client'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:44:in `block (2 levels) in run'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:82:in `run_in_fork'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:43:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:179:in `call'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:179:in `controlled_run'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:41:in `run'
/usr/lib/ruby/vendor_ruby/puppet/application/agent.rb:356:in `onetime'
/usr/lib/ruby/vendor_ruby/puppet/application/agent.rb:322:in `run_command'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:384:in `block (2 levels) in run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:510:in `plugin_hook'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:384:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:488:in `exit_on_fail'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:384:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:146:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:92:in `execute'
/usr/bin/puppet:8:in `<main>'

Removing the UTF-8 characters from the configuration file and running puppet agent -t --trace causes things to work as desired.

Without LANG set, /sbin/status php5-fpm still works.

/etc/default/locale sets LANG=en_US.UTF-8

The bug can be worked around by setting the locale in /etc/environment, or by setting it in /etc/init.d/puppet.



 Comments   
Comment by Phil Fenstermacher [ 2014/10/22 ]

It also seems reasonable for this to be a non-puppet issue, similar to CHEF-3304

Comment by Mathias Brodala [ 2015/05/04 ]

Here's the locale output for the root user on a regular Ubuntu Trusty VM image:

LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

Does this means that I have to enforce LANG=en_US.UTF-8 via /etc/environment on all of our machines? It does fix the issue but I'm not sure if this is the way to go.

Comment by Yama [ 2015/07/20 ]

I'm facing the same issue on Ubuntu 14.04

LANG=en_US.UTF-8 via /etc/environment does fix this for me after restarting puppet.

But why not set it in the puppet init file ?

Comment by Yama [ 2015/07/21 ]

OK, It seem that /etc/environment doesn't work then the system has rebooted. You need to manually restart puppet again to get it working.

I think the only option is the puppet init script.

Comment by Yama [ 2015/07/21 ]

OK, I need to update this again.

When I set this in my /etc/init.d/puppet and reboot the machine it doesn't work also. Restarting the puppet service makes it work again.

Comment by Larsen [ 2017/04/25 ]

Duplicate of PUP-1055?

Comment by Josh Cooper [ 2017/05/15 ]

Thank you for reporting this. We believe this issue has already been reported in another ticket. Please see the linked duplicate issue.

Generated at Sat Dec 14 18:31:06 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.