{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/29241","labels_url":"https://api.github.com/repos/saltstack/salt/issues/29241/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/29241/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/29241/events","html_url":"https://github.com/saltstack/salt/issues/29241","id":119160186,"number":29241,"title":"pkg.latest fails to update packages under certain circumstances ","user":{"login":"tonyyang132","id":3748823,"avatar_url":"https://avatars.githubusercontent.com/u/3748823?v=3","gravatar_id":"","url":"https://api.github.com/users/tonyyang132","html_url":"https://github.com/tonyyang132","followers_url":"https://api.github.com/users/tonyyang132/followers","following_url":"https://api.github.com/users/tonyyang132/following{/other_user}","gists_url":"https://api.github.com/users/tonyyang132/gists{/gist_id}","starred_url":"https://api.github.com/users/tonyyang132/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonyyang132/subscriptions","organizations_url":"https://api.github.com/users/tonyyang132/orgs","repos_url":"https://api.github.com/users/tonyyang132/repos","events_url":"https://api.github.com/users/tonyyang132/events{/privacy}","received_events_url":"https://api.github.com/users/tonyyang132/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Execution%20Module","name":"Execution Module","color":"006b75"},{"url":"https://api.github.com/repos/saltstack/salt/labels/High%20Severity","name":"High Severity","color":"ff9143"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P2","name":"P2","color":"155fb5"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Platform","name":"Platform","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","html_url":"https://github.com/saltstack/salt/milestones/Approved","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/13/labels","id":9265,"number":13,"title":"Approved","description":"All issues that are ready to be worked on, both bugs and features.","creator":{"login":"thatch45","id":507599,"avatar_url":"https://avatars.githubusercontent.com/u/507599?v=3","gravatar_id":"","url":"https://api.github.com/users/thatch45","html_url":"https://github.com/thatch45","followers_url":"https://api.github.com/users/thatch45/followers","following_url":"https://api.github.com/users/thatch45/following{/other_user}","gists_url":"https://api.github.com/users/thatch45/gists{/gist_id}","starred_url":"https://api.github.com/users/thatch45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatch45/subscriptions","organizations_url":"https://api.github.com/users/thatch45/orgs","repos_url":"https://api.github.com/users/thatch45/repos","events_url":"https://api.github.com/users/thatch45/events{/privacy}","received_events_url":"https://api.github.com/users/thatch45/received_events","type":"User","site_admin":false},"open_issues":2800,"closed_issues":3029,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-12-09T02:39:55Z","due_on":null,"closed_at":null},"comments":14,"created_at":"2015-11-27T09:24:42Z","updated_at":"2015-12-09T03:04:32Z","closed_at":null,"body":"We've recently identified an issue with pkg.latest, that it fails to update packages in ubuntu intermittently.\r\n\r\nI've been doing some digging and it turns out that with apt_pkg, `version_compare` returns integer values (per [this document](https://apt.alioth.debian.org/python-apt-doc/library/apt_pkg.html)), while `salt.utils.compare_versions` only accept -1, 0 and 1.\r\n\r\nTake our case today as an example, a package that's been updated from 1.2-12-gf27225d to 1.2-18-g45016fd. `apt_pkg.version_compare` returns -6 with these two versions, indicating an update is in order. However, `salt.utils.compare_versions` doesn't believe -6 is a proper code for operation `<` and thus returns False.\r\n\r\nBTW the code level we've been using is\r\n\r\n```\r\nroot@server3:~# dpkg -l 'salt*'\r\nDesired=Unknown/Install/Remove/Purge/Hold\r\n| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend\r\n|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)\r\n||/ Name                                   Version                  Architecture             Description\r\n+++-======================================-========================-========================-=================================================================================\r\nii  salt-common                            2015.5.3+ds-1trusty1     all                      shared libraries that salt requires for all packages\r\nun  salt-doc                               <none>                   <none>                   (no description available)\r\nii  salt-minion                            2015.5.3+ds-1trusty1     all                      client package for salt, the distributed remote execution system\r\n```"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/163091137","html_url":"https://github.com/saltstack/salt/issues/29241#issuecomment-163091137","issue_url":"https://api.github.com/repos/saltstack/salt/issues/29241","id":163091137,"user":{"login":"tonyyang132","id":3748823,"avatar_url":"https://avatars.githubusercontent.com/u/3748823?v=3","gravatar_id":"","url":"https://api.github.com/users/tonyyang132","html_url":"https://github.com/tonyyang132","followers_url":"https://api.github.com/users/tonyyang132/followers","following_url":"https://api.github.com/users/tonyyang132/following{/other_user}","gists_url":"https://api.github.com/users/tonyyang132/gists{/gist_id}","starred_url":"https://api.github.com/users/tonyyang132/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonyyang132/subscriptions","organizations_url":"https://api.github.com/users/tonyyang132/orgs","repos_url":"https://api.github.com/users/tonyyang132/repos","events_url":"https://api.github.com/users/tonyyang132/events{/privacy}","received_events_url":"https://api.github.com/users/tonyyang132/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T03:04:32Z","updated_at":"2015-12-09T03:04:32Z","body":"@jtand Yes, it does, though we had to change the launchpad PPA for the saltstack repository for the salt-* packages to be updated. But I guess that's a separate story."}}