#1287 closed defect (fixed)

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

Reported by: davidsarah Owned by: davidsarah
Priority: critical Milestone: 1.8.2
Component: code Version: 1.8.1
Keywords: version setuptools reviewed news-needed Cc:
Launchpad Bug:

Description

Split from #1258.

At 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 src/allmydata/test/test_runner.py) to pass when they should fail.

Attachments (1)

fix-1287.darcs.patch (11.4 KB) - added by davidsarah at 2011-01-01T20:37:33Z.
* 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

Download all attachments as: .zip

Change History (17)

comment:1 Changed at 2011-01-01T11:39:21Z by davidsarah

  • Keywords review-needed added

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.

comment:2 Changed at 2011-01-01T11:39:32Z by davidsarah

  • Owner changed from somebody to zooko

comment:3 Changed at 2011-01-01T11:53:26Z by davidsarah

  • Keywords news-needed added

comment:4 Changed at 2011-01-01T20:03:52Z by zooko

  • Status changed from new to assigned

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

Changed at 2011-01-01T20:37:33Z by davidsarah

  • 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

comment:5 Changed at 2011-01-15T05:14:15Z by david-sarah@…

  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:6 Changed at 2011-01-15T05:14:15Z by david-sarah@…

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

comment:7 Changed at 2011-01-15T10:11:17Z by davidsarah

  • Resolution fixed deleted
  • Status changed from closed to reopened

Auto-close on a branch again.

comment:8 Changed at 2011-01-16T01:39:28Z by david-sarah@…

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

comment:20 Changed at 2011-01-16T02:46:13Z by david-sarah@…

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

comment:21 Changed at 2011-01-16T21:25:29Z by davidsarah

  • Milestone changed from 1.9.0 to 1.8.2

comment:22 Changed at 2011-01-18T08:02:44Z by zooko

  • Keywords reviewed added; review-needed removed
  • Owner changed from zooko to davidsarah
  • Status changed from reopened to new

[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:26:ticket:1258.

comment:23 Changed at 2011-01-20T09:36:28Z by zooko

David-Sarah will merge into trunk.

comment:24 Changed at 2011-01-21T06:26:20Z by david-sarah@…

In 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

comment:25 Changed at 2011-01-21T17:13:09Z by warner

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

comment:26 Changed at 2011-01-21T22:40:09Z by davidsarah

  • Resolution set to fixed
  • Status changed from new to closed

comment:27 Changed at 2011-01-22T03:42:30Z by david-sarah@…

In 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

Note: See TracTickets for help on using tickets.