passenger 4.0.13 → 4.0.14

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

data.tar.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJSDPHCAAoJECrHRaUKISqMLiEH/A4OA7fXNqA3/aIzUn5coY6J
6
- MMmrKyTHGxL743dWP2ja28TCIoq41TfDUsWodPbVVUSXQOfOOP83Inz9xa4JB9mw
7
- cCU47RgmsFKsDtiwsXA0JLAtynzMMC1bk4doVWI7dh8pfckKDfwk4MvS5aMoCfyr
8
- 98Irb7YO7hrsGAdk6NU60HghxnF661TnSTdN4IJLImQDGeuXIxRBSvE5HY13cUOO
9
- 9zi+UiGHTSq/1ZKs06NV+OjYXijD4H5U+a8yX/Oxz1mZTKg6/4bHWp16CshphDjp
10
- 9KqEfXgU9M+izSamX9xy3AIcJgpw8pg/PPvIljXdryUf2IAkPwcgF5ZwJhtAXfE=
11
- =1Fig
5
+ iQEcBAABAgAGBQJSEm1+AAoJECrHRaUKISqMwjAIAJrI1rdd3Cxrencb3E/rKc2R
6
+ Fdb0rEgFsPDGSa/D51kAhma2jzxjkGzQUS9k6DCrs9Qfmb5G9PkLaPjh1dIMT0zA
7
+ PhLuhZu4wjxrcwlrZsKxljOq1R+t9IYdjYNKgzwHbF51dM2yTrHmAAuCI4ZS44WD
8
+ 2RnLomVLPmIsRVm7wxmtlMl1gUrVs2U1r259tF2+z4XS+VVOqM9bhgpFcY2Mj7Bg
9
+ f0PFi+aXYpSjl1QwI7eyYdA/TLvOSbSRO9FuLvG3jnN4JI0/vzndS1+gRn5ToykI
10
+ 7q4PfQPVhA/R6b05HcRfrXX+l9WNWFh1duuTAmfvi5jydoIpgY/ROmIAeitPkak=
11
+ =2H4W
12
12
  -----END PGP SIGNATURE-----
data/NEWS CHANGED
@@ -1,3 +1,13 @@
1
+ Release 4.0.14
2
+ --------------
3
+
4
+ * Fixed a bug in Passenger Standalone's source compiler, for the specific
5
+ case when the downloaded Nginx binary doesn't work, and compilation
6
+ of the Nginx binary did not succeed the first time (e.g. because of
7
+ missing dependencies).
8
+ * Precompiled Ruby native extensions are now automatically downloaded.
9
+
10
+
1
11
  Release 4.0.13
2
12
  --------------
3
13
 
@@ -70,7 +70,7 @@
70
70
 
71
71
  #define PROCESS_SHUTDOWN_TIMEOUT_DISPLAY "1 minute"
72
72
 
73
- #define PASSENGER_VERSION "4.0.13"
73
+ #define PASSENGER_VERSION "4.0.14"
74
74
 
75
75
  #define SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION 1
76
76
 
@@ -30,7 +30,7 @@ module PhusionPassenger
30
30
 
31
31
  PACKAGE_NAME = 'passenger'
32
32
  # Run 'rake ext/common/Constants.h' after changing this number.
33
- VERSION_STRING = '4.0.13'
33
+ VERSION_STRING = '4.0.14'
34
34
 
35
35
  PREFERRED_NGINX_VERSION = '1.4.2'
36
36
  NGINX_SHA256_CHECKSUM = '5361ffb7b0ebf8b1a04369bc3d1295eaed091680c1c58115f88d56c8e51f3611'
@@ -129,10 +129,61 @@ private
129
129
  end
130
130
 
131
131
  def download_binary_and_load
132
- # TODO
133
- return false
132
+ if !PhusionPassenger.installed_from_release_package?
133
+ return
134
+ end
135
+ if ENV['PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY'] == '0'
136
+ STDERR.puts "*** Phusion Passenger: PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY set, " +
137
+ "not downloading precompiled binary"
138
+ return
139
+ end
140
+ STDERR.puts "*** Phusion Passenger: no #{library_name} found for " +
141
+ "the current Ruby interpreter. Downloading precompiled binary from the Phusion server " +
142
+ "(set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable)..."
143
+
144
+ require 'phusion_passenger/platform_info/ruby'
145
+ require 'phusion_passenger/utils/tmpio'
146
+ PhusionPassenger::Utils.mktmpdir("passenger-native-support-") do |dir|
147
+ Dir.chdir(dir) do
148
+ basename = "rubyext-#{archdir}.tar.gz"
149
+ if !download(basename, dir)
150
+ return false
151
+ end
152
+
153
+ sh "tar", "xzf", basename
154
+ sh "rm", "-f", basename
155
+ STDERR.puts "Checking whether downloaded binary is usable..."
156
+
157
+ File.open("test.rb", "w") do |f|
158
+ f.puts(%Q{
159
+ require File.expand_path('passenger_native_support')
160
+ f = File.open("test.txt", "w")
161
+ PhusionPassenger::NativeSupport.writev(f.fileno, ["hello", "\n"])
162
+ })
163
+ end
164
+
165
+ if sh_nonfatal("#{PlatformInfo.ruby_command} -I. test.rb") &&
166
+ File.exist?("test.txt") &&
167
+ File.read("test.txt") == "hello\n"
168
+ STDERR.puts "Binary is usable."
169
+ File.unlink("test.rb")
170
+ File.unlink("test.txt")
171
+ result = try_directories(installation_target_dirs) do |target_dir|
172
+ files = Dir["#{dir}/*"]
173
+ STDERR.puts "# Installing " + files.map{ |n| File.basename(n) }.join(' ')
174
+ FileUtils.cp(files, target_dir)
175
+ require "#{target_dir}/#{library_name}"
176
+ [true, false]
177
+ end
178
+ return result
179
+ else
180
+ STDERR.puts "Binary is not usable."
181
+ return false
182
+ end
183
+ end
184
+ end
134
185
  end
135
-
186
+
136
187
  def compile_and_load
137
188
  STDERR.puts "*** Phusion Passenger: no #{library_name} found for " +
138
189
  "the current Ruby interpreter. Compiling one..."
@@ -140,6 +191,15 @@ private
140
191
  require 'fileutils'
141
192
  require 'phusion_passenger/platform_info/ruby'
142
193
 
194
+ target_dir = compile(installation_target_dirs)
195
+ if target_dir
196
+ require "#{target_dir}/#{library_name}"
197
+ else
198
+ STDERR.puts "Ruby native_support extension not loaded. Continuing without native_support."
199
+ end
200
+ end
201
+
202
+ def installation_target_dirs
143
203
  target_dirs = []
144
204
  if (output_dir = ENV['PASSENGER_NATIVE_SUPPORT_OUTPUT_DIR']) && !output_dir.empty?
145
205
  target_dirs << "#{output_dir}/#{VERSION_STRING}/#{archdir}"
@@ -148,13 +208,33 @@ private
148
208
  target_dirs << "#{native_support_dir_in_source_root}/#{archdir}"
149
209
  end
150
210
  target_dirs << "#{home}/#{USER_NAMESPACE_DIRNAME}/native_support/#{VERSION_STRING}/#{archdir}"
211
+ return target_dirs
212
+ end
213
+
214
+ def download(name, output_dir)
215
+ url = "#{PhusionPassenger::BINARIES_URL_ROOT}/#{PhusionPassenger::VERSION_STRING}/#{name}"
216
+ filename = "#{output_dir}/#{name}"
151
217
 
152
- target_dir = compile(target_dirs)
153
- if target_dir
154
- require "#{target_dir}/#{library_name}"
218
+ cache_dir = PhusionPassenger.download_cache_dir
219
+ if File.exist?("#{cache_dir}/#{name}")
220
+ FileUtils.cp("#{cache_dir}/#{name}", filename, :verbose => true)
221
+ return true
222
+ end
223
+
224
+ STDERR.puts "Attempting to download #{url} into #{output_dir}"
225
+ cert = PhusionPassenger.binaries_ca_cert_path
226
+ File.unlink("#{filename}.tmp") rescue nil
227
+ if PhusionPassenger::PlatformInfo.find_command("wget")
228
+ result = system("wget", "--tries=3", "-O", "#{filename}.tmp", "--ca-certificate=#{cert}", url)
155
229
  else
156
- STDERR.puts "Ruby native_support extension not loaded. Continuing without native_support."
230
+ result = system("curl", url, "-f", "-L", "-o", "#{filename}.tmp", "--cacert", cert)
231
+ end
232
+ if result
233
+ File.rename("#{filename}.tmp", filename)
234
+ else
235
+ File.unlink("#{filename}.tmp") rescue nil
157
236
  end
237
+ return result
158
238
  end
159
239
 
160
240
  def mkdir(dir)
@@ -167,6 +247,7 @@ private
167
247
 
168
248
  def sh(*args)
169
249
  if !sh_nonfatal(*args)
250
+ command_string = args.join(' ')
170
251
  raise "Could not compile #{library_name} (\"#{command_string}\" failed)"
171
252
  end
172
253
  end
@@ -178,33 +259,40 @@ private
178
259
  end
179
260
 
180
261
  def compile(target_dirs)
262
+ try_directories(target_dirs) do |target_dir|
263
+ result =
264
+ sh_nonfatal("#{PlatformInfo.ruby_command} '#{extconf_rb}'") &&
265
+ sh_nonfatal("make")
266
+ if result
267
+ STDERR.puts "Compilation succesful."
268
+ STDERR.puts "-------------------------------"
269
+ [target_dir, false]
270
+ else
271
+ STDERR.puts "Compilation failed."
272
+ STDERR.puts "-------------------------------"
273
+ [nil, false]
274
+ end
275
+ end
276
+ end
277
+
278
+ def try_directories(dirs)
181
279
  result = nil
182
- target_dirs.each_with_index do |target_dir, i|
280
+ dirs.each_with_index do |dir, i|
183
281
  begin
184
- mkdir(target_dir)
185
- File.open("#{target_dir}/.permission_test", "w").close
186
- File.unlink("#{target_dir}/.permission_test")
187
- STDERR.puts "# cd #{target_dir}"
188
- Dir.chdir(target_dir) do
189
- result =
190
- sh_nonfatal("#{PlatformInfo.ruby_command} '#{extconf_rb}'") &&
191
- sh_nonfatal("make")
192
- if result
193
- STDERR.puts "Compilation succesful."
194
- STDERR.puts "-------------------------------"
195
- return target_dir
196
- else
197
- STDERR.puts "Compilation failed."
198
- STDERR.puts "-------------------------------"
199
- return nil
200
- end
282
+ mkdir(dir)
283
+ File.open("#{dir}/.permission_test", "w").close
284
+ File.unlink("#{dir}/.permission_test")
285
+ STDERR.puts "# cd #{dir}"
286
+ Dir.chdir(dir) do
287
+ result, should_retry = yield(dir)
288
+ return result if !should_retry
201
289
  end
202
290
  rescue Errno::EACCES
203
291
  # If we encountered a permission error, then try
204
292
  # the next target directory. If we get a permission
205
293
  # error on the last one too then propagate the
206
294
  # exception.
207
- if i == target_dirs.size - 1
295
+ if i == dirs.size - 1
208
296
  STDERR.puts "Encountered permission error, " +
209
297
  "but no more directories to try. Giving up."
210
298
  STDERR.puts "-------------------------------"
@@ -220,8 +308,8 @@ private
220
308
  # is set to false. For example, when we're running
221
309
  # in Phusion Passenger Standalone. In this case
222
310
  # just ignore this directory.
223
- if i == target_dirs.size - 1
224
- STDERR.puts "Encountered permission error, " +
311
+ if i == dirs.size - 1
312
+ STDERR.puts "Not a valid directory, " +
225
313
  "but no more directories to try. Giving up."
226
314
  STDERR.puts "-------------------------------"
227
315
  return nil
@@ -234,7 +322,7 @@ private
234
322
  end
235
323
  end
236
324
 
237
- end
325
+ end # module PhusionPassenger
238
326
 
239
327
  if PhusionPassenger::NativeSupportLoader.supported?
240
328
  PhusionPassenger::NativeSupportLoader.new.start
@@ -161,9 +161,10 @@ private
161
161
  runner = PlatformInfo::Depcheck::ConsoleRunner.new
162
162
  runner.add('download-tool')
163
163
 
164
- if !runner.check_all
164
+ result = runner.check_all
165
+ puts
166
+ if !result
165
167
  @download_binaries = false
166
- puts
167
168
  line
168
169
  puts
169
170
  render_template 'standalone/download_tool_missing',
@@ -267,7 +268,7 @@ private
267
268
  return false
268
269
  end
269
270
  end
270
- puts "Binaries are usable."
271
+ puts "All support binaries are usable."
271
272
  return true
272
273
  end
273
274
 
@@ -310,10 +311,10 @@ private
310
311
  puts "Checking whether the downloaded binary is usable..."
311
312
  output = `env LD_BIND_NOW=1 DYLD_BIND_AT_LAUNCH=1 ./nginx -v 2>&1`
312
313
  if $? && $?.exitstatus == 0 && output =~ /nginx version:/
313
- puts "Binary is usable."
314
+ puts "Nginx binary is usable."
314
315
  return true
315
316
  else
316
- @stderr.puts "Binary is not usable."
317
+ @stderr.puts "Nginx binary is not usable."
317
318
  return false
318
319
  end
319
320
  end
@@ -556,14 +557,12 @@ private
556
557
  Dir.chdir(source_dir) do
557
558
  shell = PlatformInfo.find_command('bash') || "sh"
558
559
  command = ""
559
- if @targets.include?(:support_binaries)
560
- output_dir = "#{@support_dir}/common/libpassenger_common"
561
- nginx_libs = COMMON_LIBRARY.only(*NGINX_LIBS_SELECTOR).
562
- set_output_dir(output_dir).
563
- link_objects_as_string
564
- command << "env PASSENGER_INCLUDEDIR='#{PhusionPassenger.include_dir}'" <<
565
- " PASSENGER_LIBS='#{nginx_libs} #{output_dir}/../libboost_oxt.a' "
566
- end
560
+ lib_dir = "#{@lib_dir}/common/libpassenger_common"
561
+ nginx_libs = COMMON_LIBRARY.only(*NGINX_LIBS_SELECTOR).
562
+ set_output_dir(lib_dir).
563
+ link_objects_as_string
564
+ command << "env PASSENGER_INCLUDEDIR='#{PhusionPassenger.include_dir}' " <<
565
+ "PASSENGER_LIBS='#{nginx_libs} #{lib_dir}/../libboost_oxt.a' "
567
566
  # RPM thinks it's being smart by scanning binaries for
568
567
  # paths and refusing to create package if it detects any
569
568
  # hardcoded thats that point to /usr or other important
@@ -196,6 +196,50 @@ describe "Passenger Standalone" do
196
196
  test_serving_application(command)
197
197
  end
198
198
 
199
+ specify "if the downloaded support binaries work but the download Nginx binary doesn't, " +
200
+ "and Nginx compilation doesn't succeed the first time, then Nginx compilation " +
201
+ "succeeds the second time" do
202
+ Dir.chdir("#{@webroot}/#{version}") do
203
+ create_tarball("support-#{compat_id}.tar.gz") do
204
+ FileUtils.cp_r(Dir["#{PhusionPassenger.source_root}/buildout/*"],
205
+ ".")
206
+ end
207
+ create_tarball("nginx-#{nginx_version}-#{compat_id}.tar.gz") do
208
+ create_file("nginx",
209
+ "#!/bin/sh\n" +
210
+ "exit 1\n")
211
+ end
212
+ end
213
+
214
+ # Temporarily make Passenger Standalone think our runtime is
215
+ # not compiled.
216
+ File.rename("#{PhusionPassenger.source_root}/buildout",
217
+ "#{PhusionPassenger.source_root}/buildout.renamed")
218
+ begin
219
+ command = "passenger start " +
220
+ "--runtime-dir '#{@runtime_dir}' " +
221
+ "--binaries-url-root '#{@base_url}'"
222
+
223
+ @output = `#{command} --runtime-check-only --no-compile-runtime 2>&1`
224
+ $?.exitstatus.should_not == 0
225
+ @output.should include(SUPPORT_BINARIES_DOWNLOAD_MESSAGE)
226
+ @output.should include("All support binaries are usable.")
227
+ @output.should include(NGINX_BINARY_DOWNLOAD_MESSAGE)
228
+ @output.should include("Nginx binary is not usable.")
229
+ @output.should include("Refusing to compile the Phusion Passenger Standalone")
230
+
231
+ @output = capture_output("#{command} --runtime-check-only")
232
+ @output.should include(NGINX_SOURCE_DOWNLOAD_MESSAGE)
233
+ @output.should include(COMPILING_MESSAGE)
234
+ File.exist?("#{PhusionPassenger.source_root}/buildout").should be_false
235
+
236
+ test_serving_application("#{command} --no-compile-runtime")
237
+ ensure
238
+ File.rename("#{PhusionPassenger.source_root}/buildout.renamed",
239
+ "#{PhusionPassenger.source_root}/buildout")
240
+ end
241
+ end
242
+
199
243
  it "starts a server which serves the application" do
200
244
  # The last test already tests this. This empty test here
201
245
  # is merely to show the intent of the tests, and to
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.13
4
+ version: 4.0.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-15 00:00:00.000000000 Z
12
+ date: 2013-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
metadata.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJSDPHCAAoJECrHRaUKISqMDX8H/2MtD2WgryTYL9nhPxJ7D+1z
6
- vUcrqf1lngkSLQmyfGDM8DagqbGWt6m1UgKMiCzYwwCQR/rt5EVK2ppkaDSOqKpr
7
- A/maHy8wStcJj9FN6OY1P4I+SaPyANtUhvAWUB/iI9gy62m7u8pWMlxWP+qsGH8g
8
- 1U8V26frXbpnhm9is7+QrU294nfXdZNMzBaLqZ25NZ9iwwpn5pyx+uspeYFXvqIW
9
- /lCHtjH/cQArDV9Am8mUdJC4R0Kjt8dW6uXEQDMkP2CuRFbApNDptH+DueSvASJ/
10
- vfq9zFHRTp13ikntMbnnw5v5PJo8Lw1NXFa/eRhYD7NnAqkkZ9jkOdwwI8JSTvc=
11
- =jbCp
5
+ iQEcBAABAgAGBQJSEm1+AAoJECrHRaUKISqMbS8H/AqQwpqtfJ2nzmQTlLg9ePVV
6
+ Z1BJbm4OFlbjONYhdtNxg6fCqj5AVIN1qa+pQSnXXMYdIqk8wZbCWjzOpYGFpZpS
7
+ N9ZRiVdFXoCVd/yYE/o9CStTXA5C7p/VFYespyL8qrqrgcjC6OncMOTQnnRl0TJT
8
+ hnMo/MIHS6CoD+0+mvBjyJWzxcgyiWpEShNJ0hPeWsNET/UsQCt8WwTJ99luI+Q7
9
+ SFOZF+PnCg+xkPYkrfxVl4+lCNmV5+KbSuuL9Oa1BJCSsRvu5SMpTgJw2eKVYVy/
10
+ JqfWbTFGWIdlBZuH2VhHCvX5NAJwnZsLze7oTmHOOTYGUKpsZ3WvIMFsuEAsTEA=
11
+ =vDNO
12
12
  -----END PGP SIGNATURE-----