Processed: reassign 822533 to python-debian

Stuart Prescott stuart at debian.org
Tue May 30 01:59:01 UTC 2017


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/   stuart at nanonanonano.net
Debian Developer   http://www.debian.org/         stuart at debian.org
GPG fingerprint    90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7



More information about the pkg-python-debian-maint mailing list