Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`pod cache list` print incorrect pod path #8422

Open
tripleCC opened this Issue Jan 15, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@tripleCC
Copy link
Contributor

tripleCC commented Jan 15, 2019

Report

pod cache list command print incorrect pod path

What did you do?

  1. run pod repo add PrivateSpecRepo https://github.com/tripleCC/PrivateSpecRepo.git
  2. run git clone https://github.com/tripleCC/podTestLibrary.git
  3. run cd podTestLibrary/Example
  4. run pod install
  5. run pod cache list podTestLibrary

What did you expect to happen?

print correct pod path

podTestLibrary:
  - Version: 0.1.0
    Type:    Release
    Spec:    /Users/songruiwang/Library/Caches/CocoaPods/Pods/Specs/Release/podTestLibrary/0.1.podspec.json
    Pod:    /Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary/0.1.0-479bb

What happened instead?

print incorrect pod path

podTestLibrary:
  - Version: 0.1.0
    Type:    Release
    Spec:    /Users/songruiwang/Library/Caches/CocoaPods/Pods/Specs/Release/podTestLibrary/0.1.podspec.json
    Pod:     /Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary/0.1.0-beec6

/Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary/0.1.0-beec6 directory isn't exist.

run cd /Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary/0.1.0-beec6 :

cd: no such file or directory: /Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary/0.1.0-beec6

run ls /Users/songruiwang/Library/Caches/CocoaPods/Pods/Release/podTestLibrary :

0.1.0-479bb

CocoaPods Environment

Stack

   CocoaPods : 1.5.3
        Ruby : ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17]
    RubyGems : 2.6.14
        Host : Mac OS X 10.14.2 (18C54)
       Xcode : 10.1 (10B61)
         Git : git version 2.17.2 (Apple Git-113)
Ruby lib dir : /Users/songruiwang/.rvm/rubies/ruby-2.4.1/lib
Repositories : 2dfire-cocoapods-spec - git@git.2dfire.net:ios/cocoapods-spec.git @ fa31f0842e458a9dfe9b2acbe23f91da87421fdf
               2dfire-cocoapods-spec-binary - git@git.2dfire.net:ios/cocoapods-spec-binary.git @ 2d99f66237c8dff6857caba9f1048e976075d56c
               2dfire-ios-cocoapods-spec - http://git.2dfire.net/ios/cocoapods-spec.git @ ec0cef93a7ddf476b9627b5d0cda6c6cf94aba5d
               master - https://github.com/CocoaPods/Specs.git @ 2f0c5aa09d8467f048a80b92e972e465fbc30084
               private - git@git.2dfire.net:qingmu/cocoapods-spec.git @ 70bc386f7cd16f51f6d1dc901ca964fbbabea718
               private-binary - git@git.2dfire.net:qingmu/binary-cocoapods-spec.git @ b5240723ac6bf6a5413fae565dbfb492861e5d13
               PrivateSpecRepo - https://github.com/tripleCC/PrivateSpecRepo.git @ efa5034567bc2edf9a68314d9934dba8261823bc

Installation Source

Executable Path: /Users/songruiwang/.rvm/gems/ruby-2.4.1/bin/pod

Plugins

claide-plugins                : 0.9.2
cocoapods-bin                 : 0.0.8
cocoapods-deintegrate         : 1.0.2
cocoapods-dependencies        : 1.0.0.beta.1
cocoapods-external-pod-sorter : 0.0.2
cocoapods-open                : 0.0.8
cocoapods-packager            : 1.5.0
cocoapods-plugins             : 1.0.0
cocoapods-search              : 1.0.0
cocoapods-stats               : 1.0.0
cocoapods-tdfire-binary       : 2.0.3
cocoapods-trunk               : 1.3.1
cocoapods-try                 : 1.1.0
cocoapods_debug               : 0.1.0

Project that demonstrates the issue

sample project link https://github.com/tripleCC/podTestLibrary.git

@tripleCC

This comment has been minimized.

Copy link
Contributor Author

tripleCC commented Jan 15, 2019

I found that CocoaPods generated the path of pod cache by podTestLibrary.podspec's checksum , but print the path which was generated by podTestLibrary.podspec.json's checksum.

the podspecs' checksum of podTestLibrary :

Example git:(master) ✗ irb
2.4.1 :001 > require 'cocoapods'
 => true
2.4.1 :002 > Pod::Specification.from_file(Pathname.new('/Users/songruiwang/Library/Caches/CocoaPods/Pods/Specs/Release/podTestLibrary/0.1.podspec.json')).checksum
 => "beec68153b3753f9283eae5f8c84ca55e0fa34ff"
2.4.1 :003 >
Pod::Specification.from_file(Pathname.new('/Users/songruiwang/.cocoapods/repos/PrivateSpecRepo/podTestLibrary/0.1.0/podTestLibrary.podspec')).checksum
 => "479bb0f018b9bbc0704f53c15d31c6dca90f2366"

how about generating checksum by pretty JSON of the specification ?

# lib/cocoapods-core/specification.rb

def checksum
  generate_checksum(to_pretty_json)
end

def file_checksum
  generate_checksum(File.read(defined_in_file)) unless defined_in_file.nil?
end

def generate_checksum(string) 
  require 'digest'
  checksum = Digest::SHA1.hexdigest(string)
  checksum = checksum.encode('UTF-8') if checksum.respond_to?(:encode)
  checksum
end
@dnkoutso

This comment has been minimized.

Copy link
Contributor

dnkoutso commented Jan 15, 2019

Most likely a bug yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.