# File lib/phusion_passenger/utils.rb, line 748
        def check_directory_tree_permissions(dir)
                components = dir.split("/")
                components.shift
                i = 0
                # We can't use File.readable() and friends here because they
                # don't always work right with ACLs. Instead of we use 'real'
                # checks.
                while i < components.size
                        path = "/" + components[0..i].join("/")
                        begin
                                File.stat(path)
                        rescue Errno::EACCES
                                return [File.dirname(path), true]
                        end
                        i += 1
                end
                begin
                        Dir.chdir(dir) do
                                return nil
                        end
                rescue Errno::EACCES
                        return [dir, false]
                end
        end