tanoku/rinku — Issue #15: Unspecified encoding for gemspec file causes encoding problems with passenger spawner under ruby 1.9.2
Author: niblh
Created: 2011-11-10 23:11:23+00:00
State: open

The default passenger ruby wrapper wraps ruby as

exec ruby -E ASCII-8BIT "$@"

which causes problem with the multibyte character in the gemspec author field.

A simple encoding hint at the top of the gemspec (# encoding: UTF-8) seems to solve it.

Sample trace below:

---

```bash

from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/message_channel.rb:287:in `write_scalar'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:330:in `send_error_page'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:297:in `rescue in handle_spawn_application'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:274:in `handle_spawn_application'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server:99:in `

'
[ pid=3573 thr=67894760 file=utils.rb:176 time=2011-11-10 23:32:27.986 ]: *** Exception SyntaxError in PhusionPassenger::Rack::ApplicationSpawner (/var/www/myapp/app/shared/bundle/ruby/1.9.1/bundler/gems/rinku-60f821316be1/rinku.gemspec:11: invalid multibyte char (US-ASCII)
/var/www/myapp/app/shared/bundle/ruby/1.9.1/bundler/gems/rinku-60f821316be1/rinku.gemspec:11: invalid multibyte char (US-ASCII)
/var/www/myapp/app/shared/bundle/ruby/1.9.1/bundler/gems/rinku-60f821316be1/rinku.gemspec:11: syntax error, unexpected $end, expecting ']'
s.authors = ["Vicent Martí"]
^) (process 3573, thread #):
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler.rb:241:in `eval'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler.rb:241:in `rescue in block in load_gemspec'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler.rb:236:in `block in load_gemspec'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler.rb:234:in `chdir'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler.rb:234:in `load_gemspec'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/source.rb:353:in `block in load_spec_files'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/source.rb:352:in `each'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/source.rb:352:in `load_spec_files'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/source.rb:570:in `load_spec_files'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/source.rb:385:in `local_specs'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/source.rb:555:in `specs'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/lazy_specification.rb:48:in `__materialize__'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/spec_set.rb:84:in `block in materialize'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/spec_set.rb:82:in `map!'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/spec_set.rb:82:in `materialize'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/definition.rb:90:in `specs'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/definition.rb:135:in `specs_for'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/definition.rb:124:in `requested_specs'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/environment.rb:23:in `requested_specs'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler/runtime.rb:11:in `setup'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21.rc/lib/bundler.rb:110:in `setup'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb:326:in `prepare_app_process'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:155:in `block in initialize_server'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb:572:in `report_app_init_status'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:153:in `initialize_server'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:204:in `start_synchronously'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:180:in `start'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb:128:in `start'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
from :10:in `synchronize'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server:99:in `

'
*** Exception Encoding::CompatibilityError in spawn manager (incompatible character encodings: ASCII-8BIT and US-ASCII) (process 3573, thread #):
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/message_channel.rb:287:in `write_scalar'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:330:in `send_error_page'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:297:in `rescue in handle_spawn_application'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:274:in `handle_spawn_application'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /home/passenger/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server:99:in `

'

´´´