tahoe --version or --version-and-path can show the wrong versions or paths #1287

Closed
opened 2011-01-01 11:18:35 +00:00 by davidsarah · 13 comments
davidsarah commented 2011-01-01 11:18:35 +00:00
Owner

Split from #1258.

At source:src/allmydata/init.py@4796#L227, the versions and paths obtained from pkg_resources.require take precedence over those obtained by importing modules. But in a case such as #1258 where the imported code is different from what pkg_resources attempted to put on the sys.path, the result of pkg_resources.require is the wrong thing to use.

This can cause the output of tahoe --version or tahoe --version-and-path to be incorrect, and it can also cause tests based on that output (such as test_path in source:src/allmydata/test/test_runner.py) to pass when they should fail.

Split from #1258. At source:src/allmydata/*init*.py@4796#L227, the versions and paths obtained from `pkg_resources.require` take precedence over those obtained by importing modules. But in a case such as #1258 where the imported code is different from what `pkg_resources` *attempted* to put on the `sys.path`, the result of `pkg_resources.require` is the wrong thing to use. This can cause the output of `tahoe --version` or `tahoe --version-and-path` to be incorrect, and it can also cause tests based on that output (such as `test_path` in source:src/allmydata/test/test_runner.py) to pass when they should fail.
tahoe-lafs added the
code
critical
defect
1.8.1
labels 2011-01-01 11:18:35 +00:00
tahoe-lafs added this to the 1.9.0 milestone 2011-01-01 11:18:35 +00:00
davidsarah commented 2011-01-01 11:39:21 +00:00
Author
Owner

Although this change doesn't have its own test, it does cause test_path to start failing in the situation of #1258. A deterministic test that would provoke that situation is tricky, although zooko is working on one.

Although this change doesn't have its own test, it does cause `test_path` to start failing in the situation of #1258. A deterministic test that would provoke that situation is tricky, although zooko is working on one.

The patch itself looks good. Now investigating what test we can use to judge this patch...

The patch itself looks good. Now investigating what test we can use to judge this patch...
davidsarah commented 2011-01-01 20:37:33 +00:00
Author
Owner

Attachment fix-1287.darcs.patch (11684 bytes) added

  • allmydata/init.py: don't use pkg_resources.require to get versions and paths. Also change pyOpenSSL to pyopenssl since that is the package name. fixes #1287 * allmydata/_auto_deps.py: add a comment reminding to change init.py when dependencies are added or removed. Clarify a comment in init.py. refs #1287
**Attachment** fix-1287.darcs.patch (11684 bytes) added * allmydata/*init*.py: don't use pkg_resources.require to get versions and paths. Also change pyOpenSSL to pyopenssl since that is the package name. fixes #1287 * allmydata/_auto_deps.py: add a comment reminding to change *init*.py when dependencies are added or removed. Clarify a comment in *init*.py. refs #1287
david-sarah@jacaranda.org commented 2011-01-15 05:14:15 +00:00
Author
Owner

In [4936/ticket1306]:

allmydata/__init__.py: don't use pkg_resources.require to get versions and paths. Also change pyOpenSSL to pyopenssl since that is the package name. fixes #1287
In [4936/ticket1306]: ``` allmydata/__init__.py: don't use pkg_resources.require to get versions and paths. Also change pyOpenSSL to pyopenssl since that is the package name. fixes #1287 ```
tahoe-lafs added the
fixed
label 2011-01-15 05:14:15 +00:00
david-sarah@jacaranda.org commented 2011-01-15 05:14:15 +00:00
Author
Owner

In [4937/ticket1306]:

allmydata/_auto_deps.py: add a comment reminding to change __init__.py when dependencies are added or removed. Clarify a comment in __init__.py. refs #1287
In [4937/ticket1306]: ``` allmydata/_auto_deps.py: add a comment reminding to change __init__.py when dependencies are added or removed. Clarify a comment in __init__.py. refs #1287 ```
davidsarah commented 2011-01-15 10:11:17 +00:00
Author
Owner

Auto-close on a branch again.

Auto-close on a branch again.
tahoe-lafs removed the
fixed
label 2011-01-15 10:11:17 +00:00
david-sarah@jacaranda.org commented 2011-01-16 01:39:28 +00:00
Author
Owner

In [4959/ticket1306]:

Use a copy of verlib from https://bitbucket.org/tarek/distutilsversion/src/17df9a7d96ef (in allmydata.util.verlib) to normalize and compare versions of dependencies. refs #1258, #1287
In [4959/ticket1306]: ``` Use a copy of verlib from https://bitbucket.org/tarek/distutilsversion/src/17df9a7d96ef (in allmydata.util.verlib) to normalize and compare versions of dependencies. refs #1258, #1287 ```
david-sarah@jacaranda.org commented 2011-01-16 02:46:13 +00:00
Author
Owner

In [4960/ticket1306]:

_auto_deps.py: mock might not have a __version__ attribute. For mock, zope.interface, pyasn1 and pywin32, try to get the version number but fall back to 'unknown'. refs #1258, #1287
In [4960/ticket1306]: ``` _auto_deps.py: mock might not have a __version__ attribute. For mock, zope.interface, pyasn1 and pywin32, try to get the version number but fall back to 'unknown'. refs #1258, #1287 ```
tahoe-lafs modified the milestone from 1.9.0 to 1.8.2 2011-01-16 21:25:29 +00:00

[20110116021421-93fa1-8d6a72b8f66c1b818b13bda1639d322e793f164a]/ticket1306, [20110116010606-93fa1-27445f74ad733c9cb8cd4b24a99788fa0eca6c49]/ticket1306, [20110101200502-93fa1-cc889abf8cbc3ce244a6b7fb599c1acaf17f47fb]/ticket1306 look good to me.

[20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d]/ticket1306 looks good to me modulo my reservations expressed in comment:81149.

[20110116021421-93fa1-8d6a72b8f66c1b818b13bda1639d322e793f164a]/ticket1306, [20110116010606-93fa1-27445f74ad733c9cb8cd4b24a99788fa0eca6c49]/ticket1306, [20110101200502-93fa1-cc889abf8cbc3ce244a6b7fb599c1acaf17f47fb]/ticket1306 look good to me. [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d]/ticket1306 looks good to me modulo my reservations expressed in [comment:81149](/tahoe-lafs/trac-2024-07-25/issues/1258#issuecomment-81149).

David-Sarah will merge into trunk.

David-Sarah will merge into trunk.
david-sarah@jacaranda.org commented 2011-01-21 06:26:20 +00:00
Author
Owner

In changeset:29336a09163cd3d5:

Refactor _auto_deps.py and __init__.py, adding more robust checking of dependency versions, and not trusting pkg_resources to get the versions right. refs #1258, #1287
In changeset:29336a09163cd3d5: ``` Refactor _auto_deps.py and __init__.py, adding more robust checking of dependency versions, and not trusting pkg_resources to get the versions right. refs #1258, #1287 ```

so, is that all the code that needs landing for this one? I can't quite tell from the comments on changeset:29336a09163cd3d5. If the only thing left is NEWS, let's close this.

so, is that all the code that needs landing for this one? I can't quite tell from the comments on changeset:29336a09163cd3d5. If the only thing left is NEWS, let's close this.
tahoe-lafs added the
fixed
label 2011-01-21 22:40:09 +00:00
david-sarah@jacaranda.org commented 2011-01-22 03:42:30 +00:00
Author
Owner

In changeset:f84f2aa98777c10d:

tests: use verlib to compare versions, and get the versions of Twisted and Nevow from get_package_versions() instead of pkg_resources. refs #1287
In changeset:f84f2aa98777c10d: ``` tests: use verlib to compare versions, and get the versions of Twisted and Nevow from get_package_versions() instead of pkg_resources. refs #1287 ```
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#1287
No description provided.