Issue 13055: Distutils tries to handle null versions but fails (original) (raw)

Created on 2011-09-28 19:32 by bgamari, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
distutils-fix.patch bgamari,2011-09-28 19:32
distutils-workaround.patch bgamari,2011-09-28 19:32
Pull Requests
URL Status Linked Edit
PR 12126 closed python-dev,2019-03-01 15:34
Messages (7)
msg144575 - (view) Author: Ben Gamari (bgamari) Date: 2011-09-28 19:32
The distutils.LooseVersion constructor currently only calls parse if vstring has a value. Unfortunately, this means that a user passing in vstring="" or vstring=None gets a version object with self.vstring and self.version unset. This wreaks havoc later when the user tries to do anything with their object. I've attached two possible solutions. The first attempts to fix the issue by raising an exception when an invalid vstring is given. This seems like the most reasonable treatment of this case as there is no reasonable way to fully initialize the object. The second works around the issue, initializing the uninitialized fields with "" in the event of an invalid vstring.
msg144899 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-04 16:35
Thanks, will fix it.
msg145239 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-09 09:03
The fact that 1) StrictVersion and LooseVersion have None as default argument for vstring in __init__ 2) __init__ does not raise an exception if vstring is not given makes me think that the intended behavior is that the vstring argument is optional. Making it required would be a behavior change which would run contrary to the distutils code freeze*. I don’t feel that the workaround (set self.vstring to '') is okay; I’d rather fix the methods that fail when self.vstring is not defined, like __str__, or document the limitations. What is your use case for these classes, and what methods need fixing? * There is a lot of code out there that will break if we start to add and remove things, so a freeze was decided and we work on distutils2, a new version. distutils only gets fixes for real bugs.
msg145255 - (view) Author: Ben Gamari (bgamari) Date: 2011-10-09 13:51
The bug was encountered while trying to install a package. As it turns out, a dependency was incorrectly installed, resulting in a null version being passed around which quickly caused a crash in setup.py. While this is definitely not a normal circumstance, the fact that this bug existed made finding the issue substantially more time consuming. If the constructor of the LooseVersion can accept None, then so should its other members.
msg145304 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-10 15:38
> The bug was encountered while trying to install a package. As it turns > out, a dependency was incorrectly installed, resulting in a null > version being passed around which quickly caused a crash in setup.py. > While this is definitely not a normal circumstance, the fact that this > bug existed made finding the issue substantially more time consuming. I agree. You don’t happen to have the log available, do you? > If the constructor of the LooseVersion can accept None, then so should > its other members. Sure. From a quick glance, we need to fix __str__ and _cmp.
msg145315 - (view) Author: Ben Gamari (bgamari) Date: 2011-10-10 22:49
Sorry, no log is available.
msg386311 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:16
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils. If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2022-04-11 14:57:22 admin set github: 57264
2021-02-03 18:16:25 steve.dower set status: open -> closednosy: + steve.dowermessages: + resolution: out of datestage: patch review -> resolved
2019-03-01 15:34:35 python-dev set keywords: + patchstage: needs patch -> patch reviewpull_requests: + <pull%5Frequest12129>
2014-06-29 00:06:15 BreamoreBoy set nosy: + dstufftcomponents: - Distutils2versions: + Python 3.4, Python 3.5, - 3rd party, Python 3.2, Python 3.3
2011-10-10 22:49:15 bgamari set messages: +
2011-10-10 15:38:13 eric.araujo set keywords: + easy, - patchmessages: + stage: test needed -> needs patch
2011-10-09 13:51:11 bgamari set messages: +
2011-10-09 09:03:14 eric.araujo set messages: +
2011-10-04 16:35:35 eric.araujo set versions: + 3rd party, Python 3.2, Python 3.3nosy: + alexismessages: + assignee: tarek -> eric.araujocomponents: + Distutils2
2011-09-29 00:00:36 ezio.melotti set type: crash -> behaviorstage: test needed
2011-09-28 19:32:35 bgamari set versions: + Python 2.7nosy: + eric.araujo, tarekassignee: tarekcomponents: + Distutilstype: crash
2011-09-28 19:32:14 bgamari set files: + distutils-workaround.patch
2011-09-28 19:32:02 bgamari create