From 15217fe1162a400fa1cd2216e395d9f17be8083e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 18 Nov 2009 17:28:12 -0800 Subject: Do not expand paths given on the shell Shells already expand '~' before the executables see it, and relative paths inside symlinks can get set incorrectly to the actual directory name, and not the (usually desired) symlink name for things like Capistrano. Since our paths are now unexpanded, we must now check the "working_directory" directive and raise an error if the user specifies the config file in a way that makes the config file unreloadable. --- test/exec/test_exec.rb | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'test') diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb index f6dfd6a..49762c0 100644 --- a/test/exec/test_exec.rb +++ b/test/exec/test_exec.rb @@ -82,6 +82,57 @@ end end end + def test_working_directory_rel_path_config_file + other = Tempfile.new('unicorn.wd') + File.unlink(other.path) + Dir.mkdir(other.path) + File.open("config.ru", "wb") do |fp| + fp.syswrite < 'text/plain' }, [ Dir.pwd ] ] } +EOF + end + FileUtils.cp("config.ru", other.path + "/config.ru") + Dir.chdir(@tmpdir) + + tmp = File.open('unicorn.config', 'wb') + tmp.syswrite <