passenger 4.0.5 → 4.0.6

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.

Files changed (162) hide show
  1. data.tar.gz.asc +7 -7
  2. data/.travis.yml +1 -2
  3. data/CONTRIBUTING.md +20 -5
  4. data/CONTRIBUTORS +67 -0
  5. data/LICENSE +1 -1
  6. data/NEWS +48 -0
  7. data/Rakefile +2 -2
  8. data/bin/passenger-config +18 -0
  9. data/bin/passenger-install-apache2-module +2 -0
  10. data/bin/passenger-install-nginx-module +11 -12
  11. data/bin/passenger-memory-stats +2 -0
  12. data/bin/passenger-status +152 -69
  13. data/build/agents.rb +1 -5
  14. data/build/basics.rb +26 -13
  15. data/build/cplusplus_support.rb +9 -0
  16. data/build/debian.rb +129 -0
  17. data/build/documentation.rb +6 -2
  18. data/build/integration_tests.rb +13 -2
  19. data/build/misc.rb +16 -0
  20. data/build/packaging.rb +67 -51
  21. data/build/preprocessor.rb +314 -0
  22. data/build/test_basics.rb +1 -0
  23. data/{debian → debian.template}/README.Debian +0 -0
  24. data/{debian → debian.template}/changelog +131 -0
  25. data/debian.template/compat +1 -0
  26. data/debian.template/control +71 -0
  27. data/debian.template/copyright +385 -0
  28. data/debian.template/libapache2-mod-passenger.install +3 -0
  29. data/{debian → debian.template}/libapache2-mod-passenger.postinst +0 -0
  30. data/{debian → debian.template}/libapache2-mod-passenger.prerm +0 -0
  31. data/debian.template/locations.ini +12 -0
  32. data/debian.template/passenger.conf +4 -0
  33. data/{debian → debian.template}/passenger.load +0 -0
  34. data/debian.template/patches/series +0 -0
  35. data/debian.template/repack.sh +42 -0
  36. data/debian.template/ruby-passenger-dev.install +3 -0
  37. data/debian.template/ruby-passenger-doc.install +2 -0
  38. data/debian.template/ruby-passenger.docs +4 -0
  39. data/debian.template/ruby-passenger.install +11 -0
  40. data/debian.template/ruby-passenger.manpages +4 -0
  41. data/debian.template/rules.template +35 -0
  42. data/debian.template/source/format +1 -0
  43. data/debian.template/watch +3 -0
  44. data/dev/run_travis.sh +46 -46
  45. data/doc/Architectural overview.html +2 -2
  46. data/doc/Packaging.html +27 -18
  47. data/doc/Packaging.txt.md +27 -18
  48. data/doc/Security of user switching support.html +2 -2
  49. data/doc/Users guide Apache.html +881 -95
  50. data/doc/Users guide Apache.idmap.txt +48 -6
  51. data/doc/Users guide Apache.txt +13 -1
  52. data/doc/Users guide Nginx.html +1063 -190
  53. data/doc/Users guide Nginx.idmap.txt +89 -45
  54. data/doc/Users guide Nginx.txt +45 -0
  55. data/doc/Users guide Standalone.html +7 -7
  56. data/doc/users_guide_snippets/alternative_for_flying_passenger.txt +1 -0
  57. data/doc/users_guide_snippets/environment_variables.txt +221 -0
  58. data/doc/users_guide_snippets/installation.txt +66 -17
  59. data/doc/users_guide_snippets/support_information.txt +3 -3
  60. data/doc/users_guide_snippets/tips.txt +352 -40
  61. data/ext/common/Account.h +4 -3
  62. data/ext/common/AccountsDatabase.h +6 -6
  63. data/ext/common/AgentsStarter.h +1 -13
  64. data/ext/common/ApplicationPool2/DirectSpawner.h +4 -4
  65. data/ext/common/ApplicationPool2/DummySpawner.h +1 -1
  66. data/ext/common/ApplicationPool2/Group.h +9 -4
  67. data/ext/common/ApplicationPool2/Implementation.cpp +6 -1
  68. data/ext/common/ApplicationPool2/Options.h +65 -37
  69. data/ext/common/ApplicationPool2/Pool.h +91 -41
  70. data/ext/common/ApplicationPool2/Process.h +6 -6
  71. data/ext/common/ApplicationPool2/SmartSpawner.h +14 -14
  72. data/ext/common/ApplicationPool2/Socket.h +1 -1
  73. data/ext/common/ApplicationPool2/Spawner.h +24 -16
  74. data/ext/common/ApplicationPool2/SpawnerFactory.h +9 -1
  75. data/ext/common/ApplicationPool2/SuperGroup.h +1 -1
  76. data/ext/common/Constants.h +1 -1
  77. data/ext/common/Logging.cpp +12 -7
  78. data/ext/common/MessageServer.h +7 -12
  79. data/ext/common/MultiLibeio.cpp +5 -5
  80. data/ext/common/ResourceLocator.h +2 -6
  81. data/ext/common/ServerInstanceDir.h +37 -10
  82. data/ext/common/UnionStation.h +10 -10
  83. data/ext/common/Utils.cpp +30 -4
  84. data/ext/common/Utils.h +7 -0
  85. data/ext/common/Utils/BlockingQueue.h +2 -2
  86. data/ext/common/Utils/Lock.h +2 -2
  87. data/ext/common/Utils/MessagePassing.h +2 -2
  88. data/ext/common/Utils/Timer.h +4 -4
  89. data/ext/common/agents/HelperAgent/AgentOptions.h +2 -0
  90. data/ext/common/agents/HelperAgent/Main.cpp +57 -16
  91. data/ext/common/agents/HelperAgent/RequestHandler.h +4 -1
  92. data/ext/common/agents/LoggingAgent/AdminController.h +91 -0
  93. data/ext/common/agents/LoggingAgent/LoggingServer.h +46 -29
  94. data/ext/common/agents/LoggingAgent/Main.cpp +43 -16
  95. data/ext/common/agents/LoggingAgent/RemoteSender.h +7 -7
  96. data/ext/common/agents/Watchdog/AgentWatcher.cpp +11 -11
  97. data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +3 -1
  98. data/ext/common/agents/Watchdog/Main.cpp +62 -0
  99. data/ext/libeio/config.guess +206 -167
  100. data/ext/libeio/config.sub +142 -68
  101. data/ext/libev/config.guess +304 -290
  102. data/ext/libev/config.sub +198 -77
  103. data/ext/nginx/config +4 -0
  104. data/ext/nginx/ngx_http_passenger_module.c +1 -0
  105. data/ext/oxt/implementation.cpp +4 -4
  106. data/lib/phusion_passenger.rb +14 -5
  107. data/lib/phusion_passenger/abstract_installer.rb +41 -0
  108. data/lib/phusion_passenger/admin_tools/server_instance.rb +48 -39
  109. data/lib/phusion_passenger/message_client.rb +31 -7
  110. data/lib/phusion_passenger/native_support.rb +35 -12
  111. data/lib/phusion_passenger/packaging.rb +16 -2
  112. data/lib/phusion_passenger/platform_info/binary_compatibility.rb +6 -31
  113. data/lib/phusion_passenger/platform_info/operating_system.rb +1 -1
  114. data/lib/phusion_passenger/preloader_shared_helpers.rb +3 -1
  115. data/lib/phusion_passenger/request_handler.rb +1 -1
  116. data/lib/phusion_passenger/standalone/command.rb +6 -6
  117. data/lib/phusion_passenger/standalone/main.rb +23 -8
  118. data/lib/phusion_passenger/standalone/package_runtime_command.rb +9 -5
  119. data/lib/phusion_passenger/standalone/runtime_installer.rb +9 -10
  120. data/lib/phusion_passenger/standalone/start_command.rb +20 -4
  121. data/resources/templates/installer_common/freebsd9_broken_cxx_runtime.txt.erb +19 -0
  122. data/resources/templates/installer_common/low_amount_of_memory_warning.txt.erb +22 -0
  123. data/resources/templates/standalone/config.erb +3 -2
  124. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +4 -4
  125. data/test/cxx/ApplicationPool2/PoolTest.cpp +1 -1
  126. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +7 -7
  127. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +9 -9
  128. data/test/cxx/EventedBufferedInputTest.cpp +17 -17
  129. data/test/cxx/RequestHandlerTest.cpp +5 -5
  130. data/test/cxx/ServerInstanceDirTest.cpp +3 -1
  131. data/test/cxx/TestSupport.h +4 -4
  132. data/test/cxx/UnionStationTest.cpp +3 -1
  133. data/test/cxx/UtilsTest.cpp +2 -0
  134. data/test/integration_tests/apache2_tests.rb +2 -2
  135. data/test/integration_tests/native_packaging_spec.rb +170 -0
  136. data/test/ruby/spec_helper.rb +0 -1
  137. data/test/stub/apache2/httpd.conf.erb +1 -1
  138. data/test/stub/nginx/nginx.conf.erb +1 -0
  139. data/test/support/apache2_controller.rb +1 -1
  140. data/test/support/placebo-preloader.rb +1 -1
  141. data/test/support/test_helper.rb +5 -2
  142. metadata +32 -26
  143. metadata.gz.asc +7 -7
  144. data/debian/compat +0 -1
  145. data/debian/control +0 -49
  146. data/debian/copyright +0 -20
  147. data/debian/libapache2-mod-passenger.install +0 -1
  148. data/debian/passenger-common.install +0 -4
  149. data/debian/passenger.conf +0 -4
  150. data/debian/prerm +0 -2
  151. data/debian/rules +0 -37
  152. data/debian/watch +0 -3
  153. data/dev/googlecode_upload.py +0 -265
  154. data/ext/common/agents/HelperAgent/BacktracesServer.h +0 -60
  155. data/resources/templates/nginx/not_available_when_natively_packaged.txt.erb +0 -8
  156. data/test/stub/rails3.1/app/assets/javascripts/application.js +0 -9
  157. data/test/stub/rails3.2/app/assets/javascripts/application.js +0 -15
  158. data/test/stub/rails_apps/2.3/mycook/public/javascripts/application.js +0 -2
  159. data/test/stub/rails_apps/2.3/mycook/public/javascripts/controls.js +0 -963
  160. data/test/stub/rails_apps/2.3/mycook/public/javascripts/dragdrop.js +0 -973
  161. data/test/stub/rails_apps/2.3/mycook/public/javascripts/effects.js +0 -1128
  162. data/test/stub/rails_apps/2.3/mycook/public/javascripts/prototype.js +0 -4320
@@ -43,7 +43,7 @@ namespace tut {
43
43
  }
44
44
 
45
45
  void _gatherOutput(const char *data, unsigned int size) {
46
- lock_guard<boost::mutex> l(gatheredOutputSyncher);
46
+ boost::lock_guard<boost::mutex> l(gatheredOutputSyncher);
47
47
  gatheredOutput.append(data, size);
48
48
  }
49
49
  };
@@ -58,7 +58,7 @@ namespace tut {
58
58
  // SpawnException error page.
59
59
  Options options = createOptions();
60
60
  options.appRoot = "stub";
61
- options.startCommand = "perl\1" "-e\1" "print STDERR \"hello world\\n\"; sleep(60)";
61
+ options.startCommand = "perl\t" "-e\t" "print STDERR \"hello world\\n\"; sleep(60)";
62
62
  options.startupFile = ".";
63
63
  options.startTimeout = 300;
64
64
 
@@ -82,7 +82,7 @@ namespace tut {
82
82
  // as error response instead.
83
83
  Options options = createOptions();
84
84
  options.appRoot = "stub";
85
- options.startCommand = "perl\1" "-e\1" "print STDERR \"hello world\\n\"";
85
+ options.startCommand = "perl\t" "-e\t" "print STDERR \"hello world\\n\"";
86
86
  options.startupFile = ".";
87
87
 
88
88
  DirectSpawner spawner(bg.safe, *resourceLocator, generation);
@@ -105,7 +105,7 @@ namespace tut {
105
105
  // https://code.google.com/p/phusion-passenger/issues/detail?id=842#c19
106
106
  Options options = createOptions();
107
107
  options.appRoot = "stub/rack";
108
- options.startCommand = "ruby\1" "start.rb\1" "--execself";
108
+ options.startCommand = "ruby\t" "start.rb\t" "--execself";
109
109
  options.startupFile = "start.rb";
110
110
  SpawnerPtr spawner = createSpawner(options);
111
111
  process = spawner->spawn(options);
@@ -81,7 +81,7 @@ namespace tut {
81
81
  Options options;
82
82
  options.spawnMethod = "dummy";
83
83
  options.appRoot = "stub/rack";
84
- options.startCommand = "ruby\1" "start.rb";
84
+ options.startCommand = "ruby\t" "start.rb";
85
85
  options.startupFile = "start.rb";
86
86
  options.loadShellEnvvars = false;
87
87
  options.user = testConfig["normal_user_1"].asCString();
@@ -61,7 +61,7 @@ namespace tut {
61
61
  }
62
62
 
63
63
  void _gatherOutput(const char *data, unsigned int size) {
64
- lock_guard<boost::mutex> l(gatheredOutputSyncher);
64
+ boost::lock_guard<boost::mutex> l(gatheredOutputSyncher);
65
65
  gatheredOutput.append(data, size);
66
66
  }
67
67
  };
@@ -75,7 +75,7 @@ namespace tut {
75
75
  // restart it and try again.
76
76
  Options options = createOptions();
77
77
  options.appRoot = "stub/rack";
78
- options.startCommand = "ruby\1" "start.rb";
78
+ options.startCommand = "ruby\t" "start.rb";
79
79
  options.startupFile = "start.rb";
80
80
  shared_ptr<SmartSpawner> spawner = createSpawner(options);
81
81
  process = spawner->spawn(options);
@@ -96,7 +96,7 @@ namespace tut {
96
96
  // SmartSpawner will throw an exception.
97
97
  Options options = createOptions();
98
98
  options.appRoot = "stub/rack";
99
- options.startCommand = "ruby\1" "start.rb";
99
+ options.startCommand = "ruby\t" "start.rb";
100
100
  options.startupFile = "start.rb";
101
101
  setLogLevel(-1);
102
102
  shared_ptr<SmartSpawner> spawner = createSpawner(options, true);
@@ -115,7 +115,7 @@ namespace tut {
115
115
  // whatever stderr output as error page.
116
116
  Options options = createOptions();
117
117
  options.appRoot = "stub/rack";
118
- options.startCommand = "ruby\1" "start.rb";
118
+ options.startCommand = "ruby\t" "start.rb";
119
119
  options.startupFile = "start.rb";
120
120
  options.startTimeout = 300;
121
121
 
@@ -148,7 +148,7 @@ namespace tut {
148
148
  // as error response instead.
149
149
  Options options = createOptions();
150
150
  options.appRoot = "stub/rack";
151
- options.startCommand = "ruby\1" "start.rb";
151
+ options.startCommand = "ruby\t" "start.rb";
152
152
  options.startupFile = "start.rb";
153
153
 
154
154
  vector<string> preloaderCommand;
@@ -179,7 +179,7 @@ namespace tut {
179
179
  // takes note of the process's environment variables.
180
180
  Options options = createOptions();
181
181
  options.appRoot = "stub/rack";
182
- options.startCommand = "ruby\1" "start.rb";
182
+ options.startCommand = "ruby\t" "start.rb";
183
183
  options.startupFile = "start.rb";
184
184
  options.environmentVariables.push_back(make_pair("PASSENGER_FOO", "foo"));
185
185
 
@@ -241,7 +241,7 @@ namespace tut {
241
241
  shutdown(session->fd(), SHUT_WR);
242
242
  readAll(session->fd());
243
243
  EVENTUALLY(2,
244
- lock_guard<boost::mutex> l(gatheredOutputSyncher);
244
+ boost::lock_guard<boost::mutex> l(gatheredOutputSyncher);
245
245
  result = gatheredOutput.find("hello world!\n") != string::npos;
246
246
  );
247
247
  }
@@ -78,7 +78,7 @@
78
78
  // Basic spawning test.
79
79
  Options options = createOptions();
80
80
  options.appRoot = "stub/rack";
81
- options.startCommand = "ruby\1" "start.rb";
81
+ options.startCommand = "ruby\t" "start.rb";
82
82
  options.startupFile = "start.rb";
83
83
  SpawnerPtr spawner = createSpawner(options);
84
84
  process = spawner->spawn(options);
@@ -95,7 +95,7 @@
95
95
  // It enforces the given start timeout.
96
96
  Options options = createOptions();
97
97
  options.appRoot = "stub";
98
- options.startCommand = "sleep\1" "60";
98
+ options.startCommand = "sleep\t" "60";
99
99
  options.startupFile = ".";
100
100
  options.startTimeout = 300;
101
101
  SpawnerPtr spawner = createSpawner(options);
@@ -114,7 +114,7 @@
114
114
  // in exceptions.
115
115
  Options options = createOptions();
116
116
  options.appRoot = "stub";
117
- options.startCommand = "echo\1" "!> hello world";
117
+ options.startCommand = "echo\t" "!> hello world";
118
118
  options.startupFile = ".";
119
119
  SpawnerPtr spawner = createSpawner(options);
120
120
  try {
@@ -132,7 +132,7 @@
132
132
  // which will result in a SpawnException with the content.
133
133
  Options options = createOptions();
134
134
  options.appRoot = "stub";
135
- options.startCommand = "perl\1" "start_error.pl";
135
+ options.startCommand = "perl\t" "start_error.pl";
136
136
  options.startupFile = "start_error.pl";
137
137
  SpawnerPtr spawner = createSpawner(options);
138
138
  try {
@@ -153,7 +153,7 @@
153
153
  // response.
154
154
  Options options = createOptions();
155
155
  options.appRoot = "stub";
156
- options.startCommand = "perl\1" "start_error.pl\1" "freeze";
156
+ options.startCommand = "perl\t" "start_error.pl\t" "freeze";
157
157
  options.startupFile = "start_error.pl";
158
158
  options.startTimeout = 300;
159
159
  SpawnerPtr spawner = createSpawner(options);
@@ -171,7 +171,7 @@
171
171
  // The reported PID is correct.
172
172
  Options options = createOptions();
173
173
  options.appRoot = "stub/rack";
174
- options.startCommand = "ruby\1" "start.rb";
174
+ options.startCommand = "ruby\t" "start.rb";
175
175
  options.startupFile = "start.rb";
176
176
  SpawnerPtr spawner = createSpawner(options);
177
177
  process = spawner->spawn(options);
@@ -188,7 +188,7 @@
188
188
  // Custom environment variables can be passed.
189
189
  Options options = createOptions();
190
190
  options.appRoot = "stub/rack";
191
- options.startCommand = "ruby\1" "start.rb";
191
+ options.startCommand = "ruby\t" "start.rb";
192
192
  options.startupFile = "start.rb";
193
193
  options.environmentVariables.push_back(make_pair("PASSENGER_FOO", "foo"));
194
194
  options.environmentVariables.push_back(make_pair("PASSENGER_BAR", "bar"));
@@ -209,7 +209,7 @@
209
209
  // Any raised SpawnExceptions take note of the process's environment variables.
210
210
  Options options = createOptions();
211
211
  options.appRoot = "stub";
212
- options.startCommand = "echo\1" "!> hello world";
212
+ options.startCommand = "echo\t" "!> hello world";
213
213
  options.startupFile = ".";
214
214
  options.environmentVariables.push_back(make_pair("PASSENGER_FOO", "foo"));
215
215
  SpawnerPtr spawner = createSpawner(options);
@@ -312,7 +312,7 @@
312
312
  process.reset();
313
313
 
314
314
  EVENTUALLY(2,
315
- lock_guard<boost::mutex> l(gatheredOutputSyncher);
315
+ boost::lock_guard<boost::mutex> l(gatheredOutputSyncher);
316
316
  result = gatheredOutput.find("hello stdout!\n") != string::npos
317
317
  && gatheredOutput.find("hello stderr!\n") != string::npos;
318
318
  );
@@ -25,7 +25,7 @@ namespace tut {
25
25
  virtual ssize_t readSocket(void *buf, size_t n) {
26
26
  int readError;
27
27
  {
28
- lock_guard<boost::mutex> l(syncher);
28
+ boost::lock_guard<boost::mutex> l(syncher);
29
29
  readError = this->readError;
30
30
  }
31
31
  if (readError == 0) {
@@ -37,14 +37,14 @@ namespace tut {
37
37
  }
38
38
 
39
39
  void setReadError(int code) {
40
- lock_guard<boost::mutex> l(syncher);
40
+ boost::lock_guard<boost::mutex> l(syncher);
41
41
  readError = code;
42
42
  }
43
43
 
44
44
  virtual void afterProcessingBuffer() {
45
45
  function<void ()> onAfterProcessingBuffer;
46
46
  {
47
- lock_guard<boost::mutex> l(syncher);
47
+ boost::lock_guard<boost::mutex> l(syncher);
48
48
  onAfterProcessingBuffer = this->onAfterProcessingBuffer;
49
49
  }
50
50
  if (onAfterProcessingBuffer) {
@@ -80,7 +80,7 @@ namespace tut {
80
80
 
81
81
  static size_t onData(const EventedBufferedInputPtr &input, const StaticString &data) {
82
82
  EventedBufferedInputTest *self = (EventedBufferedInputTest *) input->userData;
83
- lock_guard<boost::mutex> l(self->syncher);
83
+ boost::lock_guard<boost::mutex> l(self->syncher);
84
84
  self->counter++;
85
85
  if (data.empty()) {
86
86
  self->log.append("EOF\n");
@@ -96,12 +96,12 @@ namespace tut {
96
96
 
97
97
  static void onError(const EventedBufferedInputPtr &input, const char *message, int code) {
98
98
  EventedBufferedInputTest *self = (EventedBufferedInputTest *) input->userData;
99
- lock_guard<boost::mutex> l(self->syncher);
99
+ boost::lock_guard<boost::mutex> l(self->syncher);
100
100
  self->log.append("Error: " + toString(code) + "\n");
101
101
  }
102
102
 
103
103
  unsigned int getCounter() {
104
- lock_guard<boost::mutex> l(syncher);
104
+ boost::lock_guard<boost::mutex> l(syncher);
105
105
  return counter;
106
106
  }
107
107
 
@@ -124,13 +124,13 @@ namespace tut {
124
124
  }
125
125
 
126
126
  void logEbiIsStarted() {
127
- lock_guard<boost::mutex> l(syncher);
127
+ boost::lock_guard<boost::mutex> l(syncher);
128
128
  log.append("isStarted: " + toString(ebi->isStarted()) + "\n");
129
129
  log.append("isSocketStarted: " + toString(ebi->isSocketStarted()) + "\n");
130
130
  }
131
131
  };
132
132
 
133
- #define LOCK() lock_guard<boost::mutex> l(syncher)
133
+ #define LOCK() boost::lock_guard<boost::mutex> l(syncher)
134
134
 
135
135
  #define DEFINE_ON_DATA_METHOD(name, code) \
136
136
  static size_t name(const EventedBufferedInputPtr &input, const StaticString &data) { \
@@ -439,7 +439,7 @@ namespace tut {
439
439
  )
440
440
 
441
441
  static void on_after_processing_buffer_20(EventedBufferedInputTest *self) {
442
- lock_guard<boost::mutex> l(self->syncher);
442
+ boost::lock_guard<boost::mutex> l(self->syncher);
443
443
  if (self->counter == 1) {
444
444
  self->log.append("Finished first onData; isSocketStarted: " +
445
445
  toString(self->ebi->isSocketStarted()) + "\n");
@@ -485,7 +485,7 @@ namespace tut {
485
485
  static void on_after_processing_buffer_21(EventedBufferedInputTest *self) {
486
486
  if (self->getCounter() == 1) {
487
487
  self->ebi->stop();
488
- lock_guard<boost::mutex> l(self->syncher);
488
+ boost::lock_guard<boost::mutex> l(self->syncher);
489
489
  self->log.append("isSocketStarted: " +
490
490
  toString(self->ebi->isSocketStarted()) + "\n");
491
491
  }
@@ -511,13 +511,13 @@ namespace tut {
511
511
  if (self->getCounter() == 1) {
512
512
  self->ebi->stop();
513
513
  {
514
- lock_guard<boost::mutex> l(self->syncher);
514
+ boost::lock_guard<boost::mutex> l(self->syncher);
515
515
  self->log.append("Paused; isSocketStarted: " +
516
516
  toString(self->ebi->isSocketStarted()) + "\n");
517
517
  }
518
518
  self->ebi->start();
519
519
  {
520
- lock_guard<boost::mutex> l(self->syncher);
520
+ boost::lock_guard<boost::mutex> l(self->syncher);
521
521
  self->log.append("Resumed; isSocketStarted: " +
522
522
  toString(self->ebi->isSocketStarted()) + "\n");
523
523
  }
@@ -564,19 +564,19 @@ namespace tut {
564
564
  if (self->getCounter() == 1) {
565
565
  self->ebi->stop();
566
566
  {
567
- lock_guard<boost::mutex> l(self->syncher);
567
+ boost::lock_guard<boost::mutex> l(self->syncher);
568
568
  self->log.append("Paused; isSocketStarted: " +
569
569
  toString(self->ebi->isSocketStarted()) + "\n");
570
570
  }
571
571
  self->ebi->start();
572
572
  {
573
- lock_guard<boost::mutex> l(self->syncher);
573
+ boost::lock_guard<boost::mutex> l(self->syncher);
574
574
  self->log.append("Resumed; isSocketStarted: " +
575
575
  toString(self->ebi->isSocketStarted()) + "\n");
576
576
  }
577
577
  self->ebi->stop();
578
578
  {
579
- lock_guard<boost::mutex> l(self->syncher);
579
+ boost::lock_guard<boost::mutex> l(self->syncher);
580
580
  self->log.append("Paused again; isSocketStarted: " +
581
581
  toString(self->ebi->isSocketStarted()) + "\n");
582
582
  }
@@ -660,7 +660,7 @@ namespace tut {
660
660
  )
661
661
 
662
662
  static void on_after_processing_buffer_25(EventedBufferedInputTest *self) {
663
- lock_guard<boost::mutex> l(self->syncher);
663
+ boost::lock_guard<boost::mutex> l(self->syncher);
664
664
  if (self->counter == 1) {
665
665
  self->log.append("Handler done; isSocketStarted: " +
666
666
  toString(self->ebi->isSocketStarted()) + "\n");
@@ -707,7 +707,7 @@ namespace tut {
707
707
  )
708
708
 
709
709
  static void on_after_processing_buffer_26(EventedBufferedInputTest *self) {
710
- lock_guard<boost::mutex> l(self->syncher);
710
+ boost::lock_guard<boost::mutex> l(self->syncher);
711
711
  if (self->counter == 1) {
712
712
  self->log.append("Handler done; isSocketStarted: " +
713
713
  toString(self->ebi->isSocketStarted()) + "\n");
@@ -323,7 +323,7 @@ namespace tut {
323
323
  sendHeaders(defaultHeaders,
324
324
  "PASSENGER_APP_ROOT", (root + "/test/tmp.handler").c_str(),
325
325
  "PASSENGER_APP_TYPE", "",
326
- "PASSENGER_START_COMMAND", ("ruby\1" + root + "/test/tmp.handler/start.rb").c_str(),
326
+ "PASSENGER_START_COMMAND", ("ruby\t" + root + "/test/tmp.handler/start.rb").c_str(),
327
327
  "PATH_INFO", "/",
328
328
  NULL);
329
329
  string response = readAll(connection);
@@ -348,7 +348,7 @@ namespace tut {
348
348
  sendHeaders(defaultHeaders,
349
349
  "PASSENGER_APP_ROOT", (root + "/test/tmp.handler").c_str(),
350
350
  "PASSENGER_APP_TYPE", "",
351
- "PASSENGER_START_COMMAND", ("ruby\1" + root + "/test/tmp.handler/start.rb").c_str(),
351
+ "PASSENGER_START_COMMAND", ("ruby\t" + root + "/test/tmp.handler/start.rb").c_str(),
352
352
  "PATH_INFO", "/",
353
353
  NULL);
354
354
  string response = readAll(connection);
@@ -371,7 +371,7 @@ namespace tut {
371
371
  sendHeaders(defaultHeaders,
372
372
  "PASSENGER_APP_ROOT", (root + "/test/tmp.handler").c_str(),
373
373
  "PASSENGER_APP_TYPE", "",
374
- "PASSENGER_START_COMMAND", ("ruby\1" + root + "/test/tmp.handler/start.rb").c_str(),
374
+ "PASSENGER_START_COMMAND", ("ruby\t" + root + "/test/tmp.handler/start.rb").c_str(),
375
375
  "PASSENGER_RAISE_INTERNAL_ERROR", "true",
376
376
  "PATH_INFO", "/",
377
377
  NULL);
@@ -399,7 +399,7 @@ namespace tut {
399
399
  sendHeaders(defaultHeaders,
400
400
  "PASSENGER_APP_ROOT", (root + "/test/tmp.handler").c_str(),
401
401
  "PASSENGER_APP_TYPE", "",
402
- "PASSENGER_START_COMMAND", ("ruby\1" + root + "/test/tmp.handler/start.rb").c_str(),
402
+ "PASSENGER_START_COMMAND", ("ruby\t" + root + "/test/tmp.handler/start.rb").c_str(),
403
403
  "PASSENGER_STATUS_LINE", "false",
404
404
  "PATH_INFO", "/",
405
405
  NULL);
@@ -425,7 +425,7 @@ namespace tut {
425
425
  sendHeaders(defaultHeaders,
426
426
  "PASSENGER_APP_ROOT", (root + "/test/tmp.handler").c_str(),
427
427
  "PASSENGER_APP_TYPE", "",
428
- "PASSENGER_START_COMMAND", ("ruby\1" + root + "/test/tmp.handler/start.rb").c_str(),
428
+ "PASSENGER_START_COMMAND", ("ruby\t" + root + "/test/tmp.handler/start.rb").c_str(),
429
429
  "PASSENGER_FRIENDLY_ERROR_PAGES", "false",
430
430
  "PATH_INFO", "/",
431
431
  NULL);
@@ -58,9 +58,11 @@ namespace tut {
58
58
  }
59
59
 
60
60
  TEST_METHOD(5) {
61
- // The destructor doesnn't remove the server instance directory if it
61
+ // The destructor doesn't remove the server instance directory if it
62
62
  // wasn't created with the ownership flag or if it's been detached.
63
63
  string path, path2;
64
+ makeDirTree(parentDir + "/passenger-test.1234");
65
+ makeDirTree(parentDir + "/passenger-test.5678");
64
66
  {
65
67
  ServerInstanceDir dir(parentDir + "/passenger-test.1234", false);
66
68
  ServerInstanceDir dir2(parentDir + "/passenger-test.5678", false);
@@ -264,12 +264,12 @@ public:
264
264
  }
265
265
 
266
266
  int get() const {
267
- lock_guard<boost::mutex> l(lock);
267
+ boost::lock_guard<boost::mutex> l(lock);
268
268
  return val;
269
269
  }
270
270
 
271
271
  void set(int value) {
272
- lock_guard<boost::mutex> l(lock);
272
+ boost::lock_guard<boost::mutex> l(lock);
273
273
  val = value;
274
274
  }
275
275
 
@@ -279,13 +279,13 @@ public:
279
279
  }
280
280
 
281
281
  AtomicInt &operator++() {
282
- lock_guard<boost::mutex> l(lock);
282
+ boost::lock_guard<boost::mutex> l(lock);
283
283
  val++;
284
284
  return *this;
285
285
  }
286
286
 
287
287
  AtomicInt operator++(int) {
288
- lock_guard<boost::mutex> l(lock);
288
+ boost::lock_guard<boost::mutex> l(lock);
289
289
  AtomicInt temp(*this);
290
290
  val++;
291
291
  return temp;
@@ -61,9 +61,11 @@ namespace tut {
61
61
  }
62
62
 
63
63
  void startLoggingServer(const function<void ()> &initFunc = function<void ()>()) {
64
+ VariantMap options;
65
+ options.set("analytics_dump_file", dumpFile);
64
66
  serverFd = createUnixServer(socketFilename.c_str());
65
67
  server = ptr(new LoggingServer(eventLoop,
66
- serverFd, accountsDatabase, dumpFile));
68
+ serverFd, accountsDatabase, options));
67
69
  if (initFunc) {
68
70
  initFunc();
69
71
  }
@@ -333,6 +333,8 @@ namespace tut {
333
333
  (mode_t) (S_IRUSR | S_IXUSR | S_IWGRP | S_IXOTH));
334
334
  ensure_equals("(7)", parseModeString("u=rs,g=ws"),
335
335
  (mode_t) (S_IRUSR | S_ISUID | S_IWGRP | S_ISGID));
336
+ ensure_equals("(7)", parseModeString("u=rwx,g=rwx,+t"),
337
+ (mode_t) (S_IRWXU | S_IRWXG | S_ISVTX));
336
338
  }
337
339
 
338
340
  TEST_METHOD(38) {
@@ -458,8 +458,8 @@ describe "Apache 2 module" do
458
458
  # Wait until the server has processed the session close event.
459
459
  sleep 0.1
460
460
 
461
- processes = instance.connect(:passenger_status) do
462
- instance.processes
461
+ processes = instance.connect(:role => :passenger_status) do |client|
462
+ instance.processes(client)
463
463
  end
464
464
  processes.should have(1).item
465
465
  processes[0].group.name.should == @mycook.full_app_root + "#default"
@@ -0,0 +1,170 @@
1
+ # encoding: utf-8
2
+ # Phusion Passenger - https://www.phusionpassenger.com/
3
+ # Copyright (c) 2013 Phusion
4
+ #
5
+ # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
25
+ # Ensure that the natively installed tools are in PATH.
26
+ ENV['PATH'] = "/usr/bin:#{ENV['PATH']}"
27
+ LOCATIONS_INI = ENV['LOCATIONS_INI']
28
+ abort "Please set the LOCATIONS_INI environment variable to the right locations.ini" if !LOCATIONS_INI
29
+
30
+ BINDIR = "/usr/bin"
31
+ SBINDIR = "/usr/sbin"
32
+ INCLUDEDIR = "/usr/share/passenger/include"
33
+ NGINX_ADDON_DIR = "/usr/share/passenger/ngx_http_passenger_module"
34
+ DOCDIR = "/usr/share/doc/ruby-passenger"
35
+ RESOURCESDIR = "/usr/share/passenger"
36
+ RUBY_EXTENSION_SOURCE_DIR = "/usr/share/passenger/ruby_extension_source"
37
+ AGENTS_DIR = "/usr/lib/passenger/agents"
38
+ APACHE2_MODULE_PATH = "/usr/lib/apache2/modules/mod_passenger.so"
39
+
40
+ describe "A natively packaged Phusion Passenger" do
41
+ def capture_output(command)
42
+ output = `#{command}`.strip
43
+ if $?.exitstatus == 0
44
+ return output
45
+ else
46
+ abort "Command #{command.join(' ')} exited with status #{$?.exitstatus}"
47
+ end
48
+ end
49
+
50
+ def which(command)
51
+ return capture_output("which #{command}")
52
+ end
53
+
54
+ specify "locations.ini only refers to existent filesystem locations" do
55
+ File.read(LOCATIONS_INI).split("\n").each do |line|
56
+ if line =~ /=/
57
+ name, filename = line.split('=', 2)
58
+ if filename =~ /^\// && !File.exist?(filename)
59
+ raise "#{filename} does not exist"
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ specify "passenger-install-nginx-module is in #{BINDIR}" do
66
+ which("passenger-install-nginx-module").should == "#{BINDIR}/passenger-install-nginx-module"
67
+ end
68
+
69
+ specify "passenger-status is in #{SBINDIR}" do
70
+ which("passenger-status").should == "#{SBINDIR}/passenger-status"
71
+ end
72
+
73
+ specify "the Nginx runtime library headers exist" do
74
+ File.directory?(INCLUDEDIR).should be_true
75
+ Dir["#{INCLUDEDIR}/common/*.h"].should_not be_empty
76
+ end
77
+
78
+ specify "the Nginx addon directory exists" do
79
+ File.directory?(NGINX_ADDON_DIR).should be_true
80
+ File.file?("#{NGINX_ADDON_DIR}/ngx_http_passenger_module.c")
81
+ end
82
+
83
+ specify "the documentation directory exists" do
84
+ File.directory?(DOCDIR).should be_true
85
+ File.file?("#{DOCDIR}/Users guide Apache.html").should be_true
86
+ end
87
+
88
+ specify "the resources directory exists" do
89
+ File.directory?(RESOURCESDIR).should be_true
90
+ File.file?("#{RESOURCESDIR}/helper-scripts/rack-loader.rb").should be_true
91
+ end
92
+
93
+ specify "the Ruby extension source directory exists" do
94
+ File.directory?(RUBY_EXTENSION_SOURCE_DIR).should be_true
95
+ File.file?("#{RUBY_EXTENSION_SOURCE_DIR}/extconf.rb").should be_true
96
+ end
97
+
98
+ specify "the agents directory exists" do
99
+ File.directory?(AGENTS_DIR).should be_true
100
+ File.file?("#{AGENTS_DIR}/PassengerWatchdog").should be_true
101
+ File.executable?("#{AGENTS_DIR}/PassengerWatchdog").should be_true
102
+ end
103
+
104
+ specify "the Apache 2 module exists" do
105
+ File.file?(APACHE2_MODULE_PATH).should be_true
106
+ end
107
+
108
+ describe "passenger-config" do
109
+ it "passenger-config is in #{BINDIR}" do
110
+ which("passenger-config").should == "#{BINDIR}/passenger-config"
111
+ end
112
+
113
+ it "shows the path to locations.ini" do
114
+ capture_output("passenger-config --root").should == LOCATIONS_INI
115
+ end
116
+
117
+ it "recognizes the runtime libraries as compiled" do
118
+ system("passenger-config --compiled").should be_true
119
+ end
120
+
121
+ it "recognizes the install as natively packaged" do
122
+ system("passenger-config --natively-packaged").should be_true
123
+ end
124
+
125
+ it "shows the directory to the runtime library headers" do
126
+ capture_output("passenger-config --includedir").should == INCLUDEDIR
127
+ end
128
+
129
+ it "shows the directory to the Nginx addon" do
130
+ capture_output("passenger-config --nginx-addon-dir").should == NGINX_ADDON_DIR
131
+ end
132
+
133
+ it "shows the Nginx runtime libraries" do
134
+ libs = capture_output("passenger-config --nginx-libs").split(" ")
135
+ libs.should_not be_empty
136
+ libs.each do |lib|
137
+ File.file?(lib).should be_true
138
+ end
139
+ end
140
+ end
141
+
142
+ describe "passenger-memory-stats" do
143
+ it "is in #{SBINDIR}" do
144
+ which("passenger-memory-stats").should == "#{SBINDIR}/passenger-memory-stats"
145
+ end
146
+
147
+ it "works" do
148
+ capture_output("passenger-memory-stats").should =~ /Passenger processes/
149
+ end
150
+ end
151
+
152
+ describe "passenger-install-apache2-module" do
153
+ it "is in #{BINDIR}" do
154
+ which("passenger-install-apache2-module").should == "#{BINDIR}/passenger-install-apache2-module"
155
+ end
156
+
157
+ it "prints the configuration snippet and exits" do
158
+ output = capture_output("passenger-install-apache2-module --auto")
159
+ output.should =~ /Please edit your Apache configuration file/
160
+ output.should_not include("Compiling and installing Apache 2 module")
161
+ output.should_not include("rake apache2")
162
+ end
163
+
164
+ it "produces a correct configuration snippet" do
165
+ output = capture_output("passenger-install-apache2-module --auto")
166
+ output.should include("LoadModule passenger_module #{APACHE2_MODULE_PATH}")
167
+ output.should include("PassengerRoot #{LOCATIONS_INI}")
168
+ end
169
+ end
170
+ end