Permalink
Browse files

Set binary encoding on some I/O operations.

  • Loading branch information...
1 parent 55ee7e4 commit 0d9fd5ae91783b25999b322358e6c658ea01b473 @FooBarWidget FooBarWidget committed Jul 4, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/phusion_passenger/standalone/runtime_installer.rb
@@ -253,6 +253,7 @@ def extract_tarball(filename)
File.open(filename, 'rb') do |f|
IO.popen("tar xzf -", "w") do |io|
buffer = ''
+ buffer = buffer.force_encoding('binary') if buffer.respond_to?(:force_encoding)
total_size = File.size(filename)
bytes_read = 0
yield(bytes_read, total_size)

1 comment on commit 0d9fd5a

I had to remove that line to properly install passenger 3.0.19 today.
Here is the backtrace

Downloading Nginx...
# wget -O /tmp/cfabianski-passenger-standalone-48725/nginx-1.2.6.tar.gz http://nginx.org/download/nginx-1.2.6.tar.gz
--2013-01-29 11:44:26--  http://nginx.org/download/nginx-1.2.6.tar.gz
Resolving nginx.org... 206.251.255.63
Connecting to nginx.org|206.251.255.63|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 726025 (709K) [application/octet-stream]
Saving to: `/tmp/cfabianski-passenger-standalone-48725/nginx-1.2.6.tar.gz'

100%[=========================================================================================================================================================================>] 726,025      216K/s   in 3.3s    

2013-01-29 11:44:30 (216 KB/s) - `/tmp/cfabianski-passenger-standalone-48725/nginx-1.2.6.tar.gz' saved [726025/726025]

Installing Phusion Passenger Standalone...
/Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/runtime_installer.rb:264:in `write': "\x8B" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/runtime_installer.rb:264:in `block (2 levels) in extract_tarball'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/runtime_installer.rb:254:in `popen'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/runtime_installer.rb:254:in `block in extract_tarball'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/runtime_installer.rb:253:in `open'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/runtime_installer.rb:253:in `extract_tarball'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/runtime_installer.rb:399:in `block in download_and_extract_nginx_sources'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/runtime_installer.rb:397:in `chdir'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/runtime_installer.rb:397:in `download_and_extract_nginx_sources'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/runtime_installer.rb:135:in `install!'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/abstract_installer.rb:63:in `start'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/start_command.rb:318:in `install_runtime'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/start_command.rb:343:in `ensure_nginx_installed'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/start_command.rb:59:in `run'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/main.rb:93:in `block in run_command'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/main.rb:48:in `block in each_command'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/main.rb:43:in `each'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/main.rb:43:in `each_command'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/main.rb:91:in `run_command'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/main.rb:62:in `run!'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/lib/phusion_passenger/standalone/main.rb:39:in `run!'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/gems/passenger-3.0.19/bin/passenger:32:in `<top (required)>'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/bin/passenger:19:in `load'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/bin/passenger:19:in `<main>'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/bin/ruby_noexec_wrapper:14:in `eval'
  from /Users/cfabianski/.rvm/gems/ruby-1.9.3-p327@dev/bin/ruby_noexec_wrapper:14:in `<main>'
Please sign in to comment.