Control: reassign -1 reportbug As promised, reassigning back to reportbug since it is failing to use compare_versions() correctly.
(quoting the full mail below since it didn't get to the bug last time) On Tuesday, 30 May 2017 11:59:01 AEST Stuart Prescott wrote: > Hi Sandro, > > > the crash is in > > /usr/lib/python2.7/dist-packages/debian/debian_support.py which is in > > python-debian, reassigning > > Raising exceptions is not buggy behaviour and is not a crash.; failing to > catch exceptions that may be reasonably raised is the problem. Just because > the exception is raised inside python-debian doesn't make it a bug in > python- debian. > > I can't see that debian_support.py's compare_versions() can return any > sensible value for an illegal comparison. Is an illegal version greater > than, equal to or less than some other value? That's an undefined > comparison and it is not correct to return -1/0/+1. The pythonic answer is > to raise a ValueError on illegal input, which is what is happening here. > > I'd say compare_versions is correct: ValueError: Invalid version string > '(gtIEMobile7)'. > > compare_versions(a, b) is supposed to be given two valid version strings. If > it is given something that is not a legal version string, then raising a > ValueError seems appropriate. It's the responsibility of the calling code > to either ensure that only valid version strings are sent to > compare_versions() or handle the exception that is raised if illegal input > is given. > > I don't think it's appropriate to change the semantics of > compare_versions(); I think it's doing the right thing in raising an > exception. My current intention is to reassign this bug back to reportbug > -- do you agree? > > cheers > Stuart -- Stuart Prescott http://www.nanonanonano.net/ stu...@nanonanonano.net Debian Developer http://www.debian.org/ stu...@debian.org GPG fingerprint 90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7