diff --git a/CHANGELOG.md b/CHANGELOG.md index 62fff25c77..7a7f0d5cb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ##### Bug Fixes -* None. +* Fix crash when running on mounted filesystems + [Paul Beusterien](https://github.com/paulb777) + [#9200](https://github.com/CocoaPods/CocoaPods/pull/9200) ## 1.8.1 (2019-09-27) diff --git a/lib/cocoapods/config.rb b/lib/cocoapods/config.rb index a219c2349c..2a3478ef18 100644 --- a/lib/cocoapods/config.rb +++ b/lib/cocoapods/config.rb @@ -307,7 +307,7 @@ def configure_with(values_by_key) def podfile_path_in_dir(dir) PODFILE_NAMES.each do |filename| candidate = dir + filename - if candidate.exist? + if candidate.file? return candidate end end diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb index 57ad01acef..28124b0a1c 100644 --- a/spec/unit/config_spec.rb +++ b/spec/unit/config_spec.rb @@ -136,6 +136,16 @@ module Pod end end + it 'should not return the working directory as the installation root if found Podfile is a directory' do + Dir.chdir(temporary_directory) do + path = temporary_directory + 'Podfile' + path.mkpath + Dir.chdir(path) do + @config.installation_root.should == path + end + end + end + it 'returns the parent directory which contains the Podfile if it can be found' do Dir.chdir(temporary_directory) do File.open('Podfile', 'w') {}