Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Crash when validating unrelated spec versions #1272

Closed
keith opened this Issue · 4 comments

3 participants

@keith
Collaborator

When using an old version of CocoaPods (in this example 0.20.2) and installing a specific version of a spec (DTCoreText 1.6.1) new versions with newer features cause a crash.

### Stack

CocoaPods : 0.20.2
Ruby : ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
RubyGems : 2.0.6
Host : Mac OS X 10.8.4 (12E55)
Xcode : 4.6.3 (4H1503)
Ruby lib dir : /Users/ksmiley/.rbenv/versions/2.0.0-p247/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ fe77c55


### Podfile

```ruby
platform :ios, '5.0'

pod 'DTCoreText', '1.6.1'

Error

Pod::DSLError - Invalid `DTCoreText.podspec` file: undefined method `prepare_command=' for #<Pod::Specification name="DTCoreText">
 #
 #  from /Users/ksmiley/.cocoapods/master/DTCoreText/1.6.3/DTCoreText.podspec:17
 #  -------------------------------------------
 #    spec.prefix_header_contents = '#import <CoreText/CoreText.h>'
 >    spec.prepare_command = <<-CMD
 #       cd Core/Source
 #  -------------------------------------------
 #
/Users/ksmiley/.cocoapods/master/DTCoreText/1.6.3/DTCoreText.podspec:17:in `block in _eval_podspec'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/specification.rb:40:in `initialize'
/Users/ksmiley/.cocoapods/master/DTCoreText/1.6.3/DTCoreText.podspec:1:in `new'
/Users/ksmiley/.cocoapods/master/DTCoreText/1.6.3/DTCoreText.podspec:1:in `_eval_podspec'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/specification.rb:608:in `eval'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/specification.rb:608:in `_eval_podspec'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/specification.rb:558:in `from_string'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/specification.rb:541:in `from_file'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/specification/set.rb:88:in `specification'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/source.rb:156:in `block in search'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/source.rb:151:in `each'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/source.rb:151:in `find'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/source.rb:151:in `search'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/source/aggregate.rb:104:in `block in search'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/source/aggregate.rb:104:in `select'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-core-0.20.2/lib/cocoapods-core/source/aggregate.rb:104:in `search'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/resolver.rb:191:in `find_cached_set'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/resolver.rb:153:in `block (2 levels) in find_dependency_specs'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/user_interface.rb:113:in `message'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/resolver.rb:152:in `block in find_dependency_specs'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/resolver.rb:148:in `each'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/resolver.rb:148:in `find_dependency_specs'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/resolver.rb:65:in `block (2 levels) in resolve'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/user_interface.rb:52:in `section'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/resolver.rb:63:in `block in resolve'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/resolver.rb:62:in `each'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/resolver.rb:62:in `resolve'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/installer/analyzer.rb:290:in `block in resolve_dependencies'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/user_interface.rb:52:in `section'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/installer/analyzer.rb:288:in `resolve_dependencies'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/installer/analyzer.rb:56:in `analyze'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/installer.rb:167:in `analyze'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/installer.rb:92:in `block in resolve_dependencies'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/user_interface.rb:52:in `section'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/installer.rb:91:in `resolve_dependencies'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/installer.rb:84:in `install!'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/command/project.rb:38:in `run_install_with_update'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/command/project.rb:68:in `run'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/claide-0.3.2/lib/claide/command.rb:206:in `run'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/lib/cocoapods/command.rb:49:in `run'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.20.2/bin/pod:19:in `<top (required)>'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/bin/pod:23:in `load'
/Users/ksmiley/.rbenv/versions/2.0.0-p247/bin/pod:23:in `<main>'

Here (for now) is a test project https://github.com/andrewroycarter/CocoapodsTest
Related conversation (partially) CocoaPods/Specs@be05054#commitcomment-3823026

Obviously I'm not suggesting patching an old version of CocoaPods but I am suggesting that if a spec isn't being used in the project that it shouldn't be validated in future version (although this may already be fixed)

@fabiopelosin
Owner

This is related to this check which can be removed.

@nskboy nskboy was assigned
@nskboy

Let's see what I can do with this.

@nskboy

@irrationalfab, I removed this check and now I have a failing spec. Any ideas how to fix them without rewriting much of a Pods caching code in resolver?

I though of introducing some kind of Pod::Specification::Set#specification_for_dependency that can be used from Pod::Source#search without a risk of crash but I can't figure out how to look up spec that satisfies this dependency requirements :(

@fabiopelosin

@nskboy I think that the spec can be removed. If the subspec doesn't exists CocoaPods will raise later in the resolution process with the same error as the raise call is performed by Pod::Specification#subspec_by_name.

As a note this is an area of CocoaPods which could benefit from some improvement (/c @alloy) because if the resikved version of a spec doesn't include a subspec the installation would fail regardless from the fact that the previous versions (which might be acceptable by the resolver) could have included it. This might break an installation for an external reasons, however as pod install will not upgrade a pod, the issue should be triggered only by pod update. For this reason I'm not sure wether we should invest more time on it or not at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.