having Tahoe or any dependency installed in site-packages (or any other shared directory) can cause us to run or test the wrong code #1258

Closed
opened 2010-11-14 03:38:29 +00:00 by daira · 39 comments

From /tahoe-lafs/trac/issues/27197#comment:20 :

There is now a test failure on zomp (Mac OS 10.6) which looks like it might be caused by these patches:

http://tahoe-lafs.org/buildbot/builders/Zooko%20zomp%20Mac-amd64%2010.6%20py2.6/builds/208/steps/test/logs/stdio

FAIL
Traceback (most recent call last):
  File "/Users/tahoebuildslave/Zooko zomp Mac-amd64 10.6 py2.6/build/src/allmydata/test/test_system.py", line 1609, in _check_mv_with_http_proxy
    self.failUnlessEqual(rc_or_sig, 0, str(res))
twisted.trial.unittest.FailTest: ('', 'Traceback (most recent call last):\n  File "/Users/tahoebuildslave/Zooko zomp Mac-amd64 10.6 py2.6/build/support/bin/tahoe", line 9, in <module>\n    load_entry_point(\'allmydata-tahoe==1.8.0-r4818\', \'console_scripts\', \'tahoe\')()\n  File "/Library/Python/2.6/site-packages/allmydata/scripts/runner.py", line 114, in run\n    rc = runner(sys.argv[1:], install_node_control=install_node_control)\n  File "/Library/Python/2.6/site-packages/allmydata/scripts/runner.py", line 100, in runner\n    rc = cli.dispatchcommand(so)\n  File "/Library/Python/2.6/site-packages/allmydata/scripts/cli.py", line 504, in mv\n    rc = tahoe_mv.mv(options, mode="move")\n  File "/Library/Python/2.6/site-packages/allmydata/scripts/tahoe_mv.py", line 31, in mv\n    data = urllib.urlopen(from_url + "?t=json").read()\n  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 87, in urlopen\n    return opener.open(url)\n  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 203, in open\n    return getattr(self, name)(url)\n  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 338, in open_http\n    h.endheaders()\n  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 868, in endheaders\n    self._send_output()\n  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 740, in _send_output\n    self.send(msg)\n  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 699, in send\n    self.connect()\n  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 683, in connect\n    self.timeout)\n  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py", line 512, in create_connection\n    raise error, msg\nIOError: [socket error]Errno [60]Errno Operation timed out\n', 1)
not equal:
a = 1
b = 0

and /tahoe-lafs/trac/issues/27197#comment:382171 :

source:src/allmydata/scripts/tahoe_mv.py@4818#L31 is not
"data = urllib.urlopen(from_url + "?t=json").read()". That's what it was
before the fix.

Somehow the code being tested has the test patch changeset:01a53650510a9a4e, but not the fix patch changeset:cb777ad14f12a249.

Oh, it is testing "/Library/Python/2.6/site-packages/allmydata/scripts/tahoe_mv.py". Wrong! This looks like the issue that we fixed for the test-from-egg and test-from-prefixdir steps in #1137.

From [/tahoe-lafs/trac/issues/27197](/tahoe-lafs/trac/issues/27197)#comment:20 : > There is now a test failure on zomp (Mac OS 10.6) which looks like it might be caused by these patches: > > <http://tahoe-lafs.org/buildbot/builders/Zooko%20zomp%20Mac-amd64%2010.6%20py2.6/builds/208/steps/test/logs/stdio> > > ``` > FAIL > Traceback (most recent call last): > File "/Users/tahoebuildslave/Zooko zomp Mac-amd64 10.6 py2.6/build/src/allmydata/test/test_system.py", line 1609, in _check_mv_with_http_proxy > self.failUnlessEqual(rc_or_sig, 0, str(res)) > twisted.trial.unittest.FailTest: ('', 'Traceback (most recent call last):\n File "/Users/tahoebuildslave/Zooko zomp Mac-amd64 10.6 py2.6/build/support/bin/tahoe", line 9, in <module>\n load_entry_point(\'allmydata-tahoe==1.8.0-r4818\', \'console_scripts\', \'tahoe\')()\n File "/Library/Python/2.6/site-packages/allmydata/scripts/runner.py", line 114, in run\n rc = runner(sys.argv[1:], install_node_control=install_node_control)\n File "/Library/Python/2.6/site-packages/allmydata/scripts/runner.py", line 100, in runner\n rc = cli.dispatchcommand(so)\n File "/Library/Python/2.6/site-packages/allmydata/scripts/cli.py", line 504, in mv\n rc = tahoe_mv.mv(options, mode="move")\n File "/Library/Python/2.6/site-packages/allmydata/scripts/tahoe_mv.py", line 31, in mv\n data = urllib.urlopen(from_url + "?t=json").read()\n File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 87, in urlopen\n return opener.open(url)\n File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 203, in open\n return getattr(self, name)(url)\n File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 338, in open_http\n h.endheaders()\n File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 868, in endheaders\n self._send_output()\n File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 740, in _send_output\n self.send(msg)\n File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 699, in send\n self.connect()\n File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 683, in connect\n self.timeout)\n File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/socket.py", line 512, in create_connection\n raise error, msg\nIOError: [socket error]Errno [60]Errno Operation timed out\n', 1) > not equal: > a = 1 > b = 0 > ``` and [/tahoe-lafs/trac/issues/27197](/tahoe-lafs/trac/issues/27197)#[comment:382171](/tahoe-lafs/trac/issues/1258#issuecomment-382171) : > source:src/allmydata/scripts/tahoe_mv.py@4818#L31 is not > "`data = urllib.urlopen(from_url + "?t=json").read()`". That's what it was > before the fix. > > Somehow the code being tested has the test patch changeset:01a53650510a9a4e, but not the fix patch changeset:cb777ad14f12a249. > > Oh, it is testing "/Library/Python/2.6/site-packages/allmydata/scripts/tahoe_mv.py". Wrong! This looks like the issue that we fixed for the test-from-egg and test-from-prefixdir steps in #1137.
daira added the
c/dev-infrastructure
p/major
t/defect
v/1.8.0
labels 2010-11-14 03:38:29 +00:00
daira added this to the 1.8.1 milestone 2010-11-14 03:38:29 +00:00
Author

This might have the same cause as /tahoe-lafs/trac/issues/27190#comment:-1 .

This might have the same cause as [/tahoe-lafs/trac/issues/27190](/tahoe-lafs/trac/issues/27190)#[comment:-1](/tahoe-lafs/trac/issues/1258#issuecomment--1) .

I ran sudo /bin/rm -rf /Library/Python/2.6/site-packages/allmydata* on zomp and then rebuilt a build that had failed. Here is the result:

http://tahoe-lafs.org/buildbot/builders/Zooko%20zomp%20Mac-amd64%2010.6%20py2.6/builds/212

I ran `sudo /bin/rm -rf /Library/Python/2.6/site-packages/allmydata*` on zomp and then rebuilt a build that had failed. Here is the result: <http://tahoe-lafs.org/buildbot/builders/Zooko%20zomp%20Mac-amd64%2010.6%20py2.6/builds/212>
Author

Replying to zooko:

I ran sudo /bin/rm -rf /Library/Python/2.6/site-packages/allmydata* on zomp and then rebuilt a build that had failed. Here is the result:

http://tahoe-lafs.org/buildbot/builders/Zooko%20zomp%20Mac-amd64%2010.6%20py2.6/builds/212

OK, that succeeding is consistent with the underlying issue being the same as in #1246. The site-packages directory has a pycrypto-2.1.0-py2.6.egg-info file, which could have caused it to be put on the sys.path by setuptools.

If I'm understanding correctly, this can cause us to import the wrong code in any buildbot test step, and also when running bin/tahoe.

Replying to [zooko](/tahoe-lafs/trac/issues/1258#issuecomment-382150): > I ran `sudo /bin/rm -rf /Library/Python/2.6/site-packages/allmydata*` on zomp and then rebuilt a build that had failed. Here is the result: > > <http://tahoe-lafs.org/buildbot/builders/Zooko%20zomp%20Mac-amd64%2010.6%20py2.6/builds/212> OK, that succeeding is consistent with the underlying issue being the same as in #1246. The site-packages directory has a `pycrypto-2.1.0-py2.6.egg-info` file, which could have caused it to be put on the `sys.path` by setuptools. If I'm understanding correctly, this can cause us to import the wrong code in any buildbot test step, and also when running `bin/tahoe`.
daira changed title from test step is not testing the right code to having Tahoe or any dependency installed in site-packages (or any other shared directory) can cause us to run or test the wrong code 2010-11-14 17:36:54 +00:00

David-Sarah: I think we can safely put off this ticket til after v1.8.1. Do you agree?

David-Sarah: I think we can safely put off this ticket til after v1.8.1. Do you agree?
Author

Replying to zooko:

David-Sarah: I think we can safely put off this ticket til after v1.8.1. Do you agree?

Yes if we add documentation recommending not to use setup.py install (and saying why).

Replying to [zooko](/tahoe-lafs/trac/issues/1258#issuecomment-382153): > David-Sarah: I think we can safely put off this ticket til after v1.8.1. Do you agree? Yes if we add documentation recommending not to use `setup.py install` (and saying why).
Author

I just saw what is probably another instance of this (on a tree with local changes):

$ python setup.py trial --rterror -s allmydata.test.test_system.SystemTest.test_filesystem
running darcsver
setup.py darcsver: wrote '1.8.1-r4900' into src/allmydata/_version.py
running trial
running egg_info
writing requirements to src\allmydata_tahoe.egg-info\requires.txt
writing src\allmydata_tahoe.egg-info\PKG-INFO
writing top-level names to src\allmydata_tahoe.egg-info\top_level.txt
writing dependency_links to src\allmydata_tahoe.egg-info\dependency_links.txt
writing entry points to src\allmydata_tahoe.egg-info\entry_points.txt
writing manifest file 'src\allmydata_tahoe.egg-info\SOURCES.txt'
running build_ext
allmydata.test.test_system
  SystemTest
    test_filesystem ... Traceback (most recent call last):
  File "d:\tahoe\tahoe-clean\src\allmydata\test\test_system.py", line 1609, in _check_mv_with_http_proxy
    self.failUnlessEqual(rc_or_sig, 0, str(res))
twisted.trial.unittest.FailTest: ('', 'Traceback (most recent call last):\r\n  File "d:\\tahoe\\tahoe-clean\\support\\Sc
ripts\\tahoe.pyscript", line 16, in <module>\r\n    load_entry_point(\'allmydata-tahoe==1.8.1-r4900\', \'console_scripts
\', \'tahoe\')()\r\n  File "c:\\python26\\lib\\site-packages\\allmydata\\scripts\\runner.py", line 118, in run\r\n    rc
 = runner(sys.argv[1:], install_node_control=install_node_control)\r\n  File "c:\\python26\\lib\\site-packages\\allmydat
a\\scripts\\runner.py", line 104, in runner\r\n    rc = cli.dispatch[command](so)\r\n  File "c:\\python26\\lib\\site-pac
kages\\allmydata\\scripts\\cli.py", line 503, in mv\r\n    rc = tahoe_mv.mv(options, mode="move")\r\n  File "c:\\python2
6\\lib\\site-packages\\allmydata\\scripts\\tahoe_mv.py", line 31, in mv\r\n    data = urllib.urlopen(from_url + "?t=json
").read()\r\n  File "c:\\Python26\\lib\\urllib.py", line 87, in urlopen\r\n    return opener.open(url)\r\n  File "c:\\Py
thon26\\lib\\urllib.py", line 203, in open\r\n    return getattr(self, name)(url)\r\n  File "c:\\Python26\\lib\\urllib.p
y", line 342, in open_http\r\n    h.endheaders()\r\n  File "c:\\Python26\\lib\\httplib.py", line 868, in endheaders\r\n
   self._send_output()\r\n  File "c:\\Python26\\lib\\httplib.py", line 740, in _send_output\r\n    self.send(msg)\r\n  F
ile "c:\\Python26\\lib\\httplib.py", line 699, in send\r\n    self.connect()\r\n  File "c:\\Python26\\lib\\httplib.py",
line 683, in connect\r\n    self.timeout)\r\n  File "c:\\Python26\\lib\\socket.py", line 512, in create_connection\r\n
  raise error, msg\r\nIOError: [Errno socket error] [Errno 10060] A connection attempt failed because the connected part
y did not properly respond after a period of time, or established connection failed because connected host has failed to
 respond\r\n', 1)
not equal:
a = 1
b = 0

[FAIL]

Notice the c:\\python26\\lib\\site-packages\\allmydata paths in the traceback. (I don't know how that directory got there; I thought that I'd deleted it and not installed Tahoe since.)

More significantly, when running the whole test suite, this was the only test that failed. I thought that when running tests, this bug was restricted to testing the wrong code and complaining about it, but apparently it can still fail silently, despite [test_the_right_code]source:src/allmydata/test/test_runner.py@4853#L52 that we added for #1137 :-(

I will investigate tomorrow why test_the_right_code didn't detect this.

I just saw what is probably another instance of this (on a tree with local changes): ``` $ python setup.py trial --rterror -s allmydata.test.test_system.SystemTest.test_filesystem running darcsver setup.py darcsver: wrote '1.8.1-r4900' into src/allmydata/_version.py running trial running egg_info writing requirements to src\allmydata_tahoe.egg-info\requires.txt writing src\allmydata_tahoe.egg-info\PKG-INFO writing top-level names to src\allmydata_tahoe.egg-info\top_level.txt writing dependency_links to src\allmydata_tahoe.egg-info\dependency_links.txt writing entry points to src\allmydata_tahoe.egg-info\entry_points.txt writing manifest file 'src\allmydata_tahoe.egg-info\SOURCES.txt' running build_ext allmydata.test.test_system SystemTest test_filesystem ... Traceback (most recent call last): File "d:\tahoe\tahoe-clean\src\allmydata\test\test_system.py", line 1609, in _check_mv_with_http_proxy self.failUnlessEqual(rc_or_sig, 0, str(res)) twisted.trial.unittest.FailTest: ('', 'Traceback (most recent call last):\r\n File "d:\\tahoe\\tahoe-clean\\support\\Sc ripts\\tahoe.pyscript", line 16, in <module>\r\n load_entry_point(\'allmydata-tahoe==1.8.1-r4900\', \'console_scripts \', \'tahoe\')()\r\n File "c:\\python26\\lib\\site-packages\\allmydata\\scripts\\runner.py", line 118, in run\r\n rc = runner(sys.argv[1:], install_node_control=install_node_control)\r\n File "c:\\python26\\lib\\site-packages\\allmydat a\\scripts\\runner.py", line 104, in runner\r\n rc = cli.dispatch[command](so)\r\n File "c:\\python26\\lib\\site-pac kages\\allmydata\\scripts\\cli.py", line 503, in mv\r\n rc = tahoe_mv.mv(options, mode="move")\r\n File "c:\\python2 6\\lib\\site-packages\\allmydata\\scripts\\tahoe_mv.py", line 31, in mv\r\n data = urllib.urlopen(from_url + "?t=json ").read()\r\n File "c:\\Python26\\lib\\urllib.py", line 87, in urlopen\r\n return opener.open(url)\r\n File "c:\\Py thon26\\lib\\urllib.py", line 203, in open\r\n return getattr(self, name)(url)\r\n File "c:\\Python26\\lib\\urllib.p y", line 342, in open_http\r\n h.endheaders()\r\n File "c:\\Python26\\lib\\httplib.py", line 868, in endheaders\r\n self._send_output()\r\n File "c:\\Python26\\lib\\httplib.py", line 740, in _send_output\r\n self.send(msg)\r\n F ile "c:\\Python26\\lib\\httplib.py", line 699, in send\r\n self.connect()\r\n File "c:\\Python26\\lib\\httplib.py", line 683, in connect\r\n self.timeout)\r\n File "c:\\Python26\\lib\\socket.py", line 512, in create_connection\r\n raise error, msg\r\nIOError: [Errno socket error] [Errno 10060] A connection attempt failed because the connected part y did not properly respond after a period of time, or established connection failed because connected host has failed to respond\r\n', 1) not equal: a = 1 b = 0 [FAIL] ``` Notice the `c:\\python26\\lib\\site-packages\\allmydata` paths in the traceback. (I don't know how that directory got there; I thought that I'd deleted it and not installed Tahoe since.) More significantly, when running the whole test suite, this was the only test that failed. I thought that when running tests, this bug was restricted to testing the wrong code and complaining about it, but apparently it can still fail silently, despite [test_the_right_code]source:src/allmydata/test/test_runner.py@4853#L52 that we added for #1137 :-( I will investigate tomorrow why `test_the_right_code` didn't detect this.
Author

Replying to davidsarah:

I will investigate tomorrow why test_the_right_code didn't detect this.

This is a really confusing bug.

python setup.py trial is importing the right code in its own process. The problem is that the subprocess created by [source:src/allmydata/test/test_system.py@4895#L1777 _run_cli_in_subprocess] in test_system.py (called from the [source:src/allmydata/test/test_system.py@4895#L1601 test added] for #1253) is importing the wrong code, from a version installed before #1253 was fixed.

However, that situation -- where we import the wrong code when running bin/tahoe in a subprocess -- should have been picked up by [source:src/allmydata/test/test_runner.py@4853#L85 test_path] in test_runner.py.

_run_cli_in_subprocess does not run bin/tahoe in exactly the same way as test_path (they differ in whether the command uses sys.executable, and in the passed environment), but the differences seem not to be significant. In fact adding code to run bin/tahoe --version-and-path using _run_cli_in_subprocess, like this:

        def _subprocess_tahoe_version(ign):
            env = os.environ
            env['http_proxy'] = env['HTTP_PROXY'] = "http://127.0.0.0:12345"  # invalid address
            return self._run_cli_in_subprocess(["--version-and-path"], env=env)
        d.addCallback(_subprocess_tahoe_version)

        def _check_subprocess_tahoe_version(res):
            print repr(res)
        d.addCallback(_check_subprocess_tahoe_version)

gives output showing a version of

allmydata-tahoe: 1.8.1-r4908 (d:\\tahoe\\tahoe-clean\\src)

which is correct. (The difference between r4908 here and r4900 in comment:382155 is not significant, I committed a few patches.) The value of the PYTHONPATH variable set by d:\tahoe\tahoe-clean\bin\tahoe.pyscript is d:\tahoe\tahoe-clean\support\Lib\site-packages, which is also right.

So, I have no explanation of why the --version-and-path output from the subprocess is correct, but it a subprocess run in exactly the same way is still importing the wrong code. (c:\python26\lib\site-packages\allmydata\_version.py is present, so it is not the case that it is falling back to a later sys.path entry when importing _version.py because that file is missing.)

Replying to [davidsarah](/tahoe-lafs/trac/issues/1258#issuecomment-382155): > I will investigate tomorrow why `test_the_right_code` didn't detect this. This is a really confusing bug. `python setup.py trial` is importing the right code in its own process. The problem is that the subprocess created by [source:src/allmydata/test/test_system.py@4895#L1777 _run_cli_in_subprocess] in `test_system.py` (called from the [source:src/allmydata/test/test_system.py@4895#L1601 test added] for #1253) is importing the wrong code, from a version installed before #1253 was fixed. However, that situation -- where we import the wrong code when running `bin/tahoe` in a subprocess -- should have been picked up by [source:src/allmydata/test/test_runner.py@4853#L85 test_path] in `test_runner.py`. `_run_cli_in_subprocess` does not run `bin/tahoe` in exactly the same way as `test_path` (they differ in whether the command uses `sys.executable`, and in the passed environment), but the differences seem not to be significant. In fact adding code to run `bin/tahoe --version-and-path` using `_run_cli_in_subprocess`, like this: ``` def _subprocess_tahoe_version(ign): env = os.environ env['http_proxy'] = env['HTTP_PROXY'] = "http://127.0.0.0:12345" # invalid address return self._run_cli_in_subprocess(["--version-and-path"], env=env) d.addCallback(_subprocess_tahoe_version) def _check_subprocess_tahoe_version(res): print repr(res) d.addCallback(_check_subprocess_tahoe_version) ``` gives output showing a version of ``` allmydata-tahoe: 1.8.1-r4908 (d:\\tahoe\\tahoe-clean\\src) ``` which is correct. (The difference between r4908 here and r4900 in [comment:382155](/tahoe-lafs/trac/issues/1258#issuecomment-382155) is not significant, I committed a few patches.) The value of the PYTHONPATH variable set by `d:\tahoe\tahoe-clean\bin\tahoe.pyscript` is `d:\tahoe\tahoe-clean\support\Lib\site-packages`, which is also right. So, I have no explanation of why the `--version-and-path` output from the subprocess is correct, but ~~it~~ a subprocess run in exactly the same way is still importing the wrong code. (`c:\python26\lib\site-packages\allmydata\_version.py` is present, so it is not the case that it is falling back to a later `sys.path` entry when importing `_version.py` because that file is missing.)
Author

Replying to [davidsarah]comment:7:

So, I have no explanation of why the --version-and-path output from the subprocess is correct, but a subprocess run in exactly the same way is still importing the wrong code.

It turned out that the --version-and-path output was wrong. 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 this bug 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.

Replying to [davidsarah]comment:7: > So, I have no explanation of why the `--version-and-path` output from the subprocess is correct, but a subprocess run in exactly the same way is still importing the wrong code. It turned out that the `--version-and-path` output was wrong. 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 this bug 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.
daira modified the milestone from 1.8.1 to 1.9.0 2011-01-01 11:42:38 +00:00
Author

Replying to [davidsarah]comment:8:

It turned out that the --version-and-path output was wrong.

That is ticket #1287. attachment:add-test-import-in-repl.darcs.patch adds a different test which would catch any problem with importing the right version of Tahoe in subprocesses, without relying on bin/tahoe --version-and-path to be correct.

Replying to [davidsarah]comment:8: > It turned out that the `--version-and-path` output was wrong. That is ticket #1287. [attachment:add-test-import-in-repl.darcs.patch](/tahoe-lafs/trac/attachments/000078ac-cc7b-8755-a2a1-6f3cb2f4bda5) adds a different test which would catch any problem with importing the right version of Tahoe in subprocesses, without relying on `bin/tahoe --version-and-path` to be correct.
Author

Note that it is still not explained what the difference is between the setup.py process and the bin/tahoe subprocesses, that causes us to import the right code in the former and the wrong code in the latter.

Note that it is still not explained what the difference is between the `setup.py` process and the `bin/tahoe` subprocesses, that causes us to import the right code in the former and the wrong code in the latter.
Author

add-test-import-in-repl.darcs.patch has a confusing shadowing of the srcfile variable. I will fix that.

add-test-import-in-repl.darcs.patch has a confusing shadowing of the `srcfile` variable. I will fix that.
Author

Attachment add-test-import-in-repl.darcs.patch (12108 bytes) added

test_runner: add test_import_in_repl, which uses 'bin/tahoe debug repl' to import the allmydata module and checks that it comes from the right path. Also, fix a latent bug that caused test_the_right_code to incorrectly conclude that a path mismatch was due to a Unicode path (causing a skip rather than a failure). This version of the patch avoids a confusing shadowing of 'srcfile'. refs #1258

**Attachment** add-test-import-in-repl.darcs.patch (12108 bytes) added test_runner: add test_import_in_repl, which uses 'bin/tahoe debug repl' to import the allmydata module and checks that it comes from the right path. Also, fix a latent bug that caused test_the_right_code to incorrectly conclude that a path mismatch was due to a Unicode path (causing a skip rather than a failure). This version of the patch avoids a confusing shadowing of 'srcfile'. refs #1258
daira removed their assignment 2011-01-01 20:21:49 +00:00
Author

Oh, and adding test_import_in_repl has the side-effect of testing bin/tahoe debug repl, which is not tested anywhere else :-)

Oh, and adding `test_import_in_repl` has the side-effect of testing `bin/tahoe debug repl`, which is not tested anywhere else :-)
zooko self-assigned this 2011-01-14 23:30:44 +00:00
Author

In [4940/ticket1306]:

test_runner: add test_import_in_repl, which uses 'bin/tahoe debug repl' to import the allmydata module and checks that it comes from the right path. Also, fix a latent bug that caused test_the_right_code to incorrectly conclude that a path mismatch was due to a Unicode path (causing a skip rather than a failure). This version of the patch avoids a confusing shadowing of 'srcfile'. refs #1258
In [4940/ticket1306]: ``` test_runner: add test_import_in_repl, which uses 'bin/tahoe debug repl' to import the allmydata module and checks that it comes from the right path. Also, fix a latent bug that caused test_the_right_code to incorrectly conclude that a path mismatch was due to a Unicode path (causing a skip rather than a failure). This version of the patch avoids a confusing shadowing of 'srcfile'. refs #1258 ```

Replying to [davidsarah]comment:8

It turned out that the --version-and-path output was wrong. 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 this bug 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.

Two questions about this:

  1. Could we start writing a unit test for this by taking current trunk and adding an assertion in [allmydata/init.py get_package_versions_and_locations()]source:src/allmydata/init.py@4796#L227 that the pkg_resources.require() version and the specific-attribute-of-this-module version have to match or else exit noisily? Then we could hopefully produce a minimal test case which triggered that assertion.

  2. If we "solve" this bug by removing the pkg_resources.require(), as is done by [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d]/ticket1306, is it really a full solution? Could it be then that we are relying on the zetuptoolz-based dependency-resolution to make sure we have deps of the right version number, and there is a bug in zetuptoolz's pkg_resources so that we're actually getting a package of the wrong version number, and [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d] causes us to ignore this fact?

Replying to [davidsarah]comment:8 > > It turned out that the `--version-and-path` output was wrong. 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 this bug 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. Two questions about this: 1. Could we start writing a unit test for this by taking current trunk and adding an assertion in [allmydata/*init*.py get_package_versions_and_locations()]source:src/allmydata/*init*.py@4796#L227 that the `pkg_resources.require()` version and the specific-attribute-of-this-module version have to match or else exit noisily? Then we could hopefully produce a minimal test case which triggered that assertion. 2. If we "solve" this bug by removing the `pkg_resources.require()`, as is done by [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d]/ticket1306, is it really a full solution? Could it be then that we are relying on the `zetuptoolz`-based dependency-resolution to make sure we have deps of the right version number, and there is a bug in `zetuptoolz`'s `pkg_resources` so that we're actually getting a package of the wrong version number, and [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d] causes us to ignore this fact?
Author

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 ```
Author

Replying to [zooko]comment:18:

Replying to [davidsarah]comment:8

It turned out that the --version-and-path output was wrong. 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 this bug 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.

Two questions about this:

  1. Could we start writing a unit test for this by taking current trunk and adding an assertion in [allmydata/init.py get_package_versions_and_locations()]source:src/allmydata/init.py@4796#L227 that the pkg_resources.require() version and the specific-attribute-of-this-module version have to match or else exit noisily? Then we could hopefully produce a minimal test case which triggered that assertion.

  2. If we "solve" this bug by removing the pkg_resources.require(), as is done by [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d]/ticket1306, is it really a full solution? Could it be then that we are relying on the zetuptoolz-based dependency-resolution to make sure we have deps of the right version number, and there is a bug in zetuptoolz's pkg_resources so that we're actually getting a package of the wrong version number, and [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d] causes us to ignore this fact?

The calls to pkg_resources.require() that were removed in [4936/ticket1306], were never relied on to perform version checking. It was the calls in _auto_deps.require_auto_deps() that were supposed to be doing that. But they weren't working either.

In [4942/ticket1306], we replace require_auto_deps with check_all_requirements, which compares the requirement with the imported version as obtained directly from each package module. Then in [4959/ticket1306], we change that check to use verlib and add tests for both verlib and check_requirement.

If we did as you suggest in 1, we'd be using pkg_resources.require only in order to detect the case where it's giving the wrong result. (As it happens, that corresponds to a case where *requires* = ...; import pkg_resources in the support script failed to do the right thing. However, that's almost a coincidence! We shouldn't rely on the fact that two setuptools bugs happen to coincide. The [4942/ticket1306] change already adds a reliable test for what we actually want to know, which is that the imported dependencies satisfy the requirements.)

Caveat: check_all_requirements doesn't currently check indirect dependencies, e.g. pyOpenSSL, pyutil, argparse, and zbase32. require_auto_deps didn't check those either.

Replying to [zooko]comment:18: > Replying to [davidsarah]comment:8 > > > > It turned out that the `--version-and-path` output was wrong. 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 this bug 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. > > Two questions about this: > > 1. Could we start writing a unit test for this by taking current trunk and adding an assertion in [allmydata/*init*.py get_package_versions_and_locations()]source:src/allmydata/*init*.py@4796#L227 that the `pkg_resources.require()` version and the specific-attribute-of-this-module version have to match or else exit noisily? Then we could hopefully produce a minimal test case which triggered that assertion. > > 2. If we "solve" this bug by removing the `pkg_resources.require()`, as is done by [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d]/ticket1306, is it really a full solution? Could it be then that we are relying on the `zetuptoolz`-based dependency-resolution to make sure we have deps of the right version number, and there is a bug in `zetuptoolz`'s `pkg_resources` so that we're actually getting a package of the wrong version number, and [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d] causes us to ignore this fact? The calls to `pkg_resources.require()` that were removed in [4936/ticket1306], were never relied on to perform version checking. It was the calls in `_auto_deps.require_auto_deps()` that were supposed to be doing that. But they weren't working either. In [4942/ticket1306], we replace `require_auto_deps` with `check_all_requirements`, which compares the requirement with the imported version as obtained directly from each package module. Then in [4959/ticket1306], we change that check to use verlib and add tests for both verlib and `check_requirement`. If we did as you suggest in 1, we'd be using `pkg_resources.require` *only* in order to detect the case where it's giving the wrong result. (As it happens, that corresponds to a case where `*requires* = ...; import pkg_resources` in the support script failed to do the right thing. However, that's almost a coincidence! We shouldn't rely on the fact that two setuptools bugs happen to coincide. The [4942/ticket1306] change already adds a reliable test for what we actually want to know, which is that the imported dependencies satisfy the requirements.) Caveat: `check_all_requirements` doesn't currently check indirect dependencies, e.g. pyOpenSSL, pyutil, argparse, and zbase32. `require_auto_deps` didn't check those either.
Author

Replying to [davidsarah]comment:20:

In [4942/ticket1306], we replace require_auto_deps with check_all_requirements, which compares the requirement with the imported version as obtained directly from each package module. Then in [4959/ticket1306], we change that check to use verlib and add tests for both verlib and check_requirement.

I should also have mentioned [4949/ticket1306], which generalizes the check to handle disjunctive requirements like "pycrypto == 2.0.1, == 2.1.0, >= 2.3" (and also exposes check_requirement at module level to make it testable).

Replying to [davidsarah]comment:20: > In [4942/ticket1306], we replace `require_auto_deps` with `check_all_requirements`, which compares the requirement with the imported version as obtained directly from each package module. Then in [4959/ticket1306], we change that check to use verlib and add tests for both verlib and `check_requirement`. I should also have mentioned [4949/ticket1306], which generalizes the check to handle disjunctive requirements like "pycrypto == 2.0.1, == 2.1.0, >= 2.3" (and also exposes `check_requirement` at module level to make it testable).
Author

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 ```
Author

In changeset:727b25f622b01593:

Temporary hack to investigate whether we are getting the right version of foolscap on trunk. refs #1258
In changeset:727b25f622b01593: ``` Temporary hack to investigate whether we are getting the right version of foolscap on trunk. refs #1258 ```

Replying to [davidsarah]comment:20:

Replying to [zooko]comment:18:

  1. If we "solve" this bug by removing the pkg_resources.require(), as is done by [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d]/ticket1306, is it really a full solution? Could it be then that we are relying on the zetuptoolz-based dependency-resolution to make sure we have deps of the right version number, and there is a bug in zetuptoolz's pkg_resources so that we're actually getting a package of the wrong version number, and [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d] causes us to ignore this fact?

The calls to pkg_resources.require() that were removed in [4936/ticket1306], were never relied on to perform version checking. It was the calls in _auto_deps.require_auto_deps() that were supposed to be doing that. But they weren't working either.

I didn't mean either of those, I meant that python setup.py build, python setup.py install, and easy_install allmydata-tahoe rely on pkg-resources-based dependency resolution. (The former two rely on zetuptoolz, the latter relies on either setuptools or distribute, depending on which one provides your local easy_install executable.)

So, if pkg_resources.require() is giving us the wrong version of a dependency, does that suggest that the setup step that we just did may have been satisfied with an extant dependency even though it was of an incompatible version?

Replying to [davidsarah]comment:20: > Replying to [zooko]comment:18: > > > > 2. If we "solve" this bug by removing the `pkg_resources.require()`, as is done by [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d]/ticket1306, is it really a full solution? Could it be then that we are relying on the `zetuptoolz`-based dependency-resolution to make sure we have deps of the right version number, and there is a bug in `zetuptoolz`'s `pkg_resources` so that we're actually getting a package of the wrong version number, and [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d] causes us to ignore this fact? > > The calls to `pkg_resources.require()` that were removed in [4936/ticket1306], were never relied on to perform version checking. It was the calls in `_auto_deps.require_auto_deps()` that were supposed to be doing that. But they weren't working either. I didn't mean either of those, I meant that `python setup.py build`, `python setup.py install`, and `easy_install allmydata-tahoe` rely on `pkg-resources`-based dependency resolution. (The former two rely on `zetuptoolz`, the latter relies on either `setuptools` or `distribute`, depending on which one provides your local `easy_install` executable.) So, if `pkg_resources.require()` is giving us the wrong version of a dependency, does that suggest that the setup step that we just did may have been satisfied with an extant dependency even though it was of an incompatible version?

Replying to [davidsarah]comment:20:

Caveat: check_all_requirements doesn't currently check indirect dependencies, e.g. pyOpenSSL, pyutil, argparse, and zbase32. require_auto_deps didn't check those either.

Hm. If we were using pkg_resources, then pkg_resources.require("allmydata-tahoe") would check all dependencies including indirect ones like pyOpenSSL.

Replying to [davidsarah]comment:20: > Caveat: `check_all_requirements` doesn't currently check indirect dependencies, e.g. pyOpenSSL, pyutil, argparse, and zbase32. `require_auto_deps` didn't check those either. Hm. If we were using `pkg_resources`, then `pkg_resources.require("allmydata-tahoe")` would check all dependencies including indirect ones like `pyOpenSSL`.

I'm unsetting review-needed and assigning to davidsarah for davidsarah (or anyone else who knows) to answer my questions from comment:18 and comment:382170. In short: I think we're depending on pkg_resources to install the right versions of deps, so if pkg_resources is reporting incorrect version numbers when queried, perhaps this indicates a bug that we need to fix more deeply than just to stop asking it what the version numbers are.

I'm unsetting `review-needed` and assigning to davidsarah for davidsarah (or anyone else who knows) to answer my questions from comment:18 and [comment:382170](/tahoe-lafs/trac/issues/1258#issuecomment-382170). In short: I think we're depending on `pkg_resources` to install the right versions of deps, so if `pkg_resources` is *reporting* incorrect version numbers when queried, perhaps this indicates a bug that we need to fix more deeply than just to stop asking it what the version numbers are.
zooko removed their assignment 2011-01-18 06:39:15 +00:00
daira was assigned by zooko 2011-01-18 06:39:15 +00:00
zooko modified the milestone from 1.9.0 to 1.8.2 2011-01-18 06:39:45 +00:00

Brian (Release Master for 1.8.2) says that for 1.8.2 we intend to land a patch to detect if this problem has occurred but not to fix the problem.

David-Sarah: I would give +1 to [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d] if we put back the pkg_resources.require() and add code to abort with a specific error message if the answer provided by pkg_resources.require() differs from the one detected by importing and inspecting the module.

This would satisfy my current uncertainty (re comment:382174), would be in keeping with the intent to detect this problem in 1.8.2, would fail-safe, and would not cause any problem in the case that pkg_resources was behaving correctly. What do you think?

Brian (Release Master for 1.8.2) says that for 1.8.2 we intend to land a patch to detect if this problem has occurred but not to fix the problem. David-Sarah: I would give +1 to [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d] if we put back the `pkg_resources.require()` and add code to abort with a specific error message if the answer provided by `pkg_resources.require()` differs from the one detected by importing and inspecting the module. This would satisfy my current uncertainty (re [comment:382174](/tahoe-lafs/trac/issues/1258#issuecomment-382174)), would be in keeping with the intent to detect this problem in 1.8.2, would fail-safe, and would not cause any problem in the case that `pkg_resources` was behaving correctly. What do you think?
zooko modified the milestone from 1.8.2 to 1.9.0 2011-01-18 07:30:47 +00:00
Author

Replying to zooko:

David-Sarah: I would give +1 to [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d] if we put back the pkg_resources.require() and add code to abort with a specific error message if the answer provided by pkg_resources.require() differs from the one detected by importing and inspecting the module.

This would satisfy my current uncertainty (re comment:382174), would be in keeping with the intent to detect this problem in 1.8.2, would fail-safe, and would not cause any problem in the case that pkg_resources was behaving correctly. What do you think?

+1. This check might have to be disabled for a frozen executable (but in that case the dependencies should also have been frozen at build time, so I don't think the check is needed in that case).

Replying to [zooko](/tahoe-lafs/trac/issues/1258#issuecomment-382178): > David-Sarah: I would give +1 to [20110101110141-93fa1-3557bc2136f970fae05c1d20e336c32fec8e3d6d] if we put back the `pkg_resources.require()` and add code to abort with a specific error message if the answer provided by `pkg_resources.require()` differs from the one detected by importing and inspecting the module. > > This would satisfy my current uncertainty (re [comment:382174](/tahoe-lafs/trac/issues/1258#issuecomment-382174)), would be in keeping with the intent to detect this problem in 1.8.2, would fail-safe, and would not cause any problem in the case that `pkg_resources` was behaving correctly. What do you think? +1. This check might have to be disabled for a frozen executable (but in that case the dependencies should also have been frozen at build time, so I don't think the check is needed in that case).
Author

In changeset:fd6cdc48ae1ccbe1:

src/allmydata/test/test_runner.py: add test_import_from_repl, which checks that we are running the right code in a bin/tahoe subprocess. refs #1258
In changeset:fd6cdc48ae1ccbe1: ``` src/allmydata/test/test_runner.py: add test_import_from_repl, which checks that we are running the right code in a bin/tahoe subprocess. refs #1258 ```

Replying to davidsarah:

+1. This check might have to be disabled for a frozen executable (but in that case the dependencies should also have been frozen at build time, so I don't think the check is needed in that case).

Okay, I did this in a series of patches [20110120070136-92b7f-88ac67b4d3aa7d3402186eac8c4ee7dbb42f0f1f]/ticket1306, [20110120081620-92b7f-6e0039e28365c86a97a2f26072aedf0b742d6c79]/ticket1306, [20110120084014-92b7f-e7777f5b76d7bbd269272cdd9dddf02922f4e197]/ticket1306, [20110120085221-92b7f-cf62522aca14becf31748723fee15458333d7774]/ticket1306, [20110120085325-92b7f-028722d1cf43f20122d2fa022d0c5cf66272eaaf]/ticket1306, [20110120085608-92b7f-aad66de877bf56c05918a921078a7a405130173c]/ticket1306.

Replying to [davidsarah](/tahoe-lafs/trac/issues/1258#issuecomment--1): > > +1. This check might have to be disabled for a frozen executable (but in that case the dependencies should also have been frozen at build time, so I don't think the check is needed in that case). Okay, I did this in a series of patches [20110120070136-92b7f-88ac67b4d3aa7d3402186eac8c4ee7dbb42f0f1f]/ticket1306, [20110120081620-92b7f-6e0039e28365c86a97a2f26072aedf0b742d6c79]/ticket1306, [20110120084014-92b7f-e7777f5b76d7bbd269272cdd9dddf02922f4e197]/ticket1306, [20110120085221-92b7f-cf62522aca14becf31748723fee15458333d7774]/ticket1306, [20110120085325-92b7f-028722d1cf43f20122d2fa022d0c5cf66272eaaf]/ticket1306, [20110120085608-92b7f-aad66de877bf56c05918a921078a7a405130173c]/ticket1306.
Author

Thise check is causing several failures on the buildslaves. Arguably they are false positives from a user's perspective (because we are importing acceptable versions of the dependencies in these cases), even though they indicate that pkg_resources is deeply confused.

I propose that we should only perform this cross-check when one of the version-checking options is used (bin/tahoe --version, --version-and-path or --debug-version-and-path), or when setup.py test or setup.py trial is used. In the latter case, it should not stop us running tests.

Thise check is causing several failures on the buildslaves. Arguably they are false positives from a user's perspective (because we *are* importing acceptable versions of the dependencies in these cases), even though they indicate that pkg_resources is deeply confused. I propose that we should only perform this cross-check when one of the version-checking options is used (`bin/tahoe --version`, `--version-and-path` or `--debug-version-and-path`), or when `setup.py test` or `setup.py trial` is used. In the latter case, it should not stop us running tests.

Replying to davidsarah:

I propose that we should only perform this cross-check when one of the version-checking options is used (bin/tahoe --version, --version-and-path or --debug-version-and-path), or when setup.py test or setup.py trial is used. In the latter case, it should not stop us running tests.

+1

Replying to [davidsarah](/tahoe-lafs/trac/issues/1258#issuecomment-382183): > > I propose that we should only perform this cross-check when one of the version-checking options is used (`bin/tahoe --version`, `--version-and-path` or `--debug-version-and-path`), or when `setup.py test` or `setup.py trial` is used. In the latter case, it should not stop us running tests. +1
Author

Attachment auto-deps-and-init-changes.darcs.patch (55726 bytes) added

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

**Attachment** auto-deps-and-init-changes.darcs.patch (55726 bytes) added 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
Author

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 ```
Author

In changeset:b1f15a630a6389cf:

Add src/allmydata/util/verlib.py, which is a copy of verlib from https://bitbucket.org/tarek/distutilsversion/src/17df9a7d96ef . It is used to normalize and compare versions of dependencies. refs #1258
In changeset:b1f15a630a6389cf: ``` Add src/allmydata/util/verlib.py, which is a copy of verlib from https://bitbucket.org/tarek/distutilsversion/src/17df9a7d96ef . It is used to normalize and compare versions of dependencies. refs #1258 ```
Author

I don't know how to fix this in the general case.

I don't know how to fix this in the general case.
daira modified the milestone from 1.9.0 to eventually 2011-05-28 19:31:12 +00:00

How about if we establish a weaker goal: to detect at run-time whether this has happened and raise an exception if so. That's probably more doable than actually fixing the Python packaging system to always import the right code.

How about if we establish a weaker goal: to detect at run-time whether this *has* happened and raise an exception if so. That's probably more doable than actually fixing the Python packaging system to always import the right code.
Author

Replying to davidsarah:

I don't know how to fix this in the general case.

To be more precise, I don't know how to do it while still using setuptools. If we ditched setuptools then I would know how to do it (by making sure that the dependencies are always added at the start of sys.path, and/or by using a custom import hook). The amount of work needed to replace the affected setuptools functionality shouldn't be underestimated, though.

How about if we establish a weaker goal: to detect at run-time whether this has happened and raise an exception if so.

We already check that the version found by import is acceptable, except in the case of packages that don't declare their version in an easily inspectable manner (#1473). That isn't equivalent to checking whether this bug has occurred, though: we can (and frequently do) import a package that is not the version that setuptools intended to import, but that just happens to have an acceptable version. We know which version and path setuptools intended to import, and the original code I wrote to check for mismatches did treat this as an error. We changed it to be a warning that is only displayed in the situations described in comment:382183, because the error was happening too often :-(

(The ticket1306 branch, which did the more thorough check, has been deleted from the trac, so links to it no longer work. It can still be checked out using darcs get --lazy <http://tahoe-lafs.org/source/tahoe-lafs/ticket1306>, though.)

Replying to [davidsarah](/tahoe-lafs/trac/issues/1258#issuecomment-382178): > I don't know how to fix this in the general case. To be more precise, I don't know how to do it while still using setuptools. If we ditched setuptools then I would know how to do it (by making sure that the dependencies are always added at the start of `sys.path`, and/or by using a custom import hook). The amount of work needed to replace the affected setuptools functionality shouldn't be underestimated, though. > How about if we establish a weaker goal: to detect at run-time whether this has happened and raise an exception if so. We already check that the version found by import is acceptable, except in the case of packages that don't declare their version in an easily inspectable manner (#1473). That isn't equivalent to checking whether this bug has occurred, though: we can (and frequently do) import a package that is not the version that setuptools intended to import, but that just happens to have an acceptable version. We know which version and path setuptools intended to import, and the original code I wrote to check for mismatches did treat this as an error. We changed it to be a warning that is only displayed in the situations described in [comment:382183](/tahoe-lafs/trac/issues/1258#issuecomment-382183), because the error was happening too often :-( (The ticket1306 branch, which did the more thorough check, has been deleted from the trac, so links to it no longer work. It can still be checked out using `darcs get --lazy <http://tahoe-lafs.org/source/tahoe-lafs/ticket1306>`, though.)
Owner

This interacts particularly badly with release tarballs with bad permissions (600, rather than 644), because those tarballs, at least with packaging systems that don't attempt to muck with them, result in installed versions of tahoe were non-root users may not read the egg files. So the next attempt to build tahoe (as a non-root user, because that build stage does not require root) will fail. The workaround is just to remove the old/wrong package.

This interacts particularly badly with release tarballs with bad permissions (600, rather than 644), because those tarballs, at least with packaging systems that don't attempt to muck with them, result in installed versions of tahoe were non-root users may not read the egg files. So the next attempt to build tahoe (as a non-root user, because that build stage does not require root) will fail. The workaround is just to remove the old/wrong package.
Daira Hopwood <daira@jacaranda.org> commented 2014-10-08 11:45:57 +00:00
Owner

In /tahoe-lafs/trac/commit/b0b76a7c5b89c3fed5a65ef6732dc45e578f12f4:

Improve comments in _auto_deps.py. refs #2249, #2028, #2193, #2005, #1258

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
In [/tahoe-lafs/trac/commit/b0b76a7c5b89c3fed5a65ef6732dc45e578f12f4](/tahoe-lafs/trac/commit/b0b76a7c5b89c3fed5a65ef6732dc45e578f12f4): ``` Improve comments in _auto_deps.py. refs #2249, #2028, #2193, #2005, #1258 Signed-off-by: Daira Hopwood <daira@jacaranda.org> ```

We now recommend tox for running tests, and virtualenv for running tahoe at all, which gives us the desired isolation between any system/site-packages -installed python packages and tahoe's own requirements. So we can close this now.

We now recommend tox for running tests, and virtualenv for running tahoe at all, which gives us the desired isolation between any system/site-packages -installed python packages and tahoe's own requirements. So we can close this now.
warner added the
r/fixed
label 2016-03-27 18:31:53 +00:00
warner modified the milestone from eventually to 1.11.0 2016-03-27 18:31:53 +00:00
Owner

I came back to this while reviewing the pkgsrc package. While it is certainly ok to recommend using a virtualenv, it is not ok to say that tahoe working properly outside of a virtualenv is beyond the specification.

Certainly it is fair to expect that the installed versions of dependencies are ok. It's really the separation of the installed, likely previous working tahoe, and the being-built next version for testing that matters. It is normal for packaging systems to build and test not installed versions.

Do people think this problem is resolved, for running tests in a build dir while a previous version is in site packages? Or is this just tahoe adopting an usual definition of correctness? (Really asking; I have no idea.)

I came back to this while reviewing the pkgsrc package. While it is certainly ok to *recommend* using a virtualenv, it is not ok to say that tahoe working properly outside of a virtualenv is beyond the specification. Certainly it is fair to expect that the installed versions of dependencies are ok. It's really the separation of the installed, likely previous working tahoe, and the being-built next version for testing that matters. It is normal for packaging systems to build and test not installed versions. Do people think this problem is resolved, for running tests in a build dir while a previous version is in site packages? Or is this just tahoe adopting an usual definition of correctness? (Really asking; I have no idea.)
Sign in to join this conversation.
No labels
c/code
c/code-dirnodes
c/code-encoding
c/code-frontend
c/code-frontend-cli
c/code-frontend-ftp-sftp
c/code-frontend-magic-folder
c/code-frontend-web
c/code-mutable
c/code-network
c/code-nodeadmin
c/code-peerselection
c/code-storage
c/contrib
c/dev-infrastructure
c/docs
c/operational
c/packaging
c/unknown
c/website
kw:2pc
kw:410
kw:9p
kw:ActivePerl
kw:AttributeError
kw:DataUnavailable
kw:DeadReferenceError
kw:DoS
kw:FileZilla
kw:GetLastError
kw:IFinishableConsumer
kw:K
kw:LeastAuthority
kw:Makefile
kw:RIStorageServer
kw:StringIO
kw:UncoordinatedWriteError
kw:about
kw:access
kw:access-control
kw:accessibility
kw:accounting
kw:accounting-crawler
kw:add-only
kw:aes
kw:aesthetics
kw:alias
kw:aliases
kw:aliens
kw:allmydata
kw:amazon
kw:ambient
kw:annotations
kw:anonymity
kw:anonymous
kw:anti-censorship
kw:api_auth_token
kw:appearance
kw:appname
kw:apport
kw:archive
kw:archlinux
kw:argparse
kw:arm
kw:assertion
kw:attachment
kw:auth
kw:authentication
kw:automation
kw:avahi
kw:availability
kw:aws
kw:azure
kw:backend
kw:backoff
kw:backup
kw:backupdb
kw:backward-compatibility
kw:bandwidth
kw:basedir
kw:bayes
kw:bbfreeze
kw:beta
kw:binaries
kw:binutils
kw:bitcoin
kw:bitrot
kw:blacklist
kw:blocker
kw:blocks-cloud-deployment
kw:blocks-cloud-merge
kw:blocks-magic-folder-merge
kw:blocks-merge
kw:blocks-raic
kw:blocks-release
kw:blog
kw:bom
kw:bonjour
kw:branch
kw:branding
kw:breadcrumbs
kw:brians-opinion-needed
kw:browser
kw:bsd
kw:build
kw:build-helpers
kw:buildbot
kw:builders
kw:buildslave
kw:buildslaves
kw:cache
kw:cap
kw:capleak
kw:captcha
kw:cast
kw:centos
kw:cffi
kw:chacha
kw:charset
kw:check
kw:checker
kw:chroot
kw:ci
kw:clean
kw:cleanup
kw:cli
kw:cloud
kw:cloud-backend
kw:cmdline
kw:code
kw:code-checks
kw:coding-standards
kw:coding-tools
kw:coding_tools
kw:collection
kw:compatibility
kw:completion
kw:compression
kw:confidentiality
kw:config
kw:configuration
kw:configuration.txt
kw:conflict
kw:connection
kw:connectivity
kw:consistency
kw:content
kw:control
kw:control.furl
kw:convergence
kw:coordination
kw:copyright
kw:corruption
kw:cors
kw:cost
kw:coverage
kw:coveralls
kw:coveralls.io
kw:cpu-watcher
kw:cpyext
kw:crash
kw:crawler
kw:crawlers
kw:create-container
kw:cruft
kw:crypto
kw:cryptography
kw:cryptography-lib
kw:cryptopp
kw:csp
kw:curl
kw:cutoff-date
kw:cycle
kw:cygwin
kw:d3
kw:daemon
kw:darcs
kw:darcsver
kw:database
kw:dataloss
kw:db
kw:dead-code
kw:deb
kw:debian
kw:debug
kw:deep-check
kw:defaults
kw:deferred
kw:delete
kw:deletion
kw:denial-of-service
kw:dependency
kw:deployment
kw:deprecation
kw:desert-island
kw:desert-island-build
kw:design
kw:design-review-needed
kw:detection
kw:dev-infrastructure
kw:devpay
kw:directory
kw:directory-page
kw:dirnode
kw:dirnodes
kw:disconnect
kw:discovery
kw:disk
kw:disk-backend
kw:distribute
kw:distutils
kw:dns
kw:do_http
kw:doc-needed
kw:docker
kw:docs
kw:docs-needed
kw:dokan
kw:dos
kw:download
kw:downloader
kw:dragonfly
kw:drop-upload
kw:duplicity
kw:dusty
kw:earth-dragon
kw:easy
kw:ec2
kw:ecdsa
kw:ed25519
kw:egg-needed
kw:eggs
kw:eliot
kw:email
kw:empty
kw:encoding
kw:endpoint
kw:enterprise
kw:enum34
kw:environment
kw:erasure
kw:erasure-coding
kw:error
kw:escaping
kw:etag
kw:etch
kw:evangelism
kw:eventual
kw:example
kw:excess-authority
kw:exec
kw:exocet
kw:expiration
kw:extensibility
kw:extension
kw:failure
kw:fedora
kw:ffp
kw:fhs
kw:figleaf
kw:file
kw:file-descriptor
kw:filename
kw:filesystem
kw:fileutil
kw:fips
kw:firewall
kw:first
kw:floatingpoint
kw:flog
kw:foolscap
kw:forward-compatibility
kw:forward-secrecy
kw:forwarding
kw:free
kw:freebsd
kw:frontend
kw:fsevents
kw:ftp
kw:ftpd
kw:full
kw:furl
kw:fuse
kw:garbage
kw:garbage-collection
kw:gateway
kw:gatherer
kw:gc
kw:gcc
kw:gentoo
kw:get
kw:git
kw:git-annex
kw:github
kw:glacier
kw:globalcaps
kw:glossary
kw:google-cloud-storage
kw:google-drive-backend
kw:gossip
kw:governance
kw:grid
kw:grid-manager
kw:gridid
kw:gridsync
kw:grsec
kw:gsoc
kw:gvfs
kw:hackfest
kw:hacktahoe
kw:hang
kw:hardlink
kw:heartbleed
kw:heisenbug
kw:help
kw:helper
kw:hint
kw:hooks
kw:how
kw:how-to
kw:howto
kw:hp
kw:hp-cloud
kw:html
kw:http
kw:https
kw:i18n
kw:i2p
kw:i2p-collab
kw:illustration
kw:image
kw:immutable
kw:impressions
kw:incentives
kw:incident
kw:init
kw:inlineCallbacks
kw:inotify
kw:install
kw:installer
kw:integration
kw:integration-test
kw:integrity
kw:interactive
kw:interface
kw:interfaces
kw:interoperability
kw:interstellar-exploration
kw:introducer
kw:introduction
kw:iphone
kw:ipkg
kw:iputil
kw:ipv6
kw:irc
kw:jail
kw:javascript
kw:joke
kw:jquery
kw:json
kw:jsui
kw:junk
kw:key-value-store
kw:kfreebsd
kw:known-issue
kw:konqueror
kw:kpreid
kw:kvm
kw:l10n
kw:lae
kw:large
kw:latency
kw:leak
kw:leasedb
kw:leases
kw:libgmp
kw:license
kw:licenss
kw:linecount
kw:link
kw:linux
kw:lit
kw:localhost
kw:location
kw:locking
kw:logging
kw:logo
kw:loopback
kw:lucid
kw:mac
kw:macintosh
kw:magic-folder
kw:manhole
kw:manifest
kw:manual-test-needed
kw:map
kw:mapupdate
kw:max_space
kw:mdmf
kw:memcheck
kw:memory
kw:memory-leak
kw:mesh
kw:metadata
kw:meter
kw:migration
kw:mime
kw:mingw
kw:minimal
kw:misc
kw:miscapture
kw:mlp
kw:mock
kw:more-info-needed
kw:mountain-lion
kw:move
kw:multi-users
kw:multiple
kw:multiuser-gateway
kw:munin
kw:music
kw:mutability
kw:mutable
kw:mystery
kw:names
kw:naming
kw:nas
kw:navigation
kw:needs-review
kw:needs-spawn
kw:netbsd
kw:network
kw:nevow
kw:new-user
kw:newcaps
kw:news
kw:news-done
kw:news-needed
kw:newsletter
kw:newurls
kw:nfc
kw:nginx
kw:nixos
kw:no-clobber
kw:node
kw:node-url
kw:notification
kw:notifyOnDisconnect
kw:nsa310
kw:nsa320
kw:nsa325
kw:numpy
kw:objects
kw:old
kw:openbsd
kw:openitp-packaging
kw:openssl
kw:openstack
kw:opensuse
kw:operation-helpers
kw:operational
kw:operations
kw:ophandle
kw:ophandles
kw:ops
kw:optimization
kw:optional
kw:options
kw:organization
kw:os
kw:os.abort
kw:ostrom
kw:osx
kw:osxfuse
kw:otf-magic-folder-objective1
kw:otf-magic-folder-objective2
kw:otf-magic-folder-objective3
kw:otf-magic-folder-objective4
kw:otf-magic-folder-objective5
kw:otf-magic-folder-objective6
kw:p2p
kw:packaging
kw:partial
kw:password
kw:path
kw:paths
kw:pause
kw:peer-selection
kw:performance
kw:permalink
kw:permissions
kw:persistence
kw:phone
kw:pickle
kw:pip
kw:pipermail
kw:pkg_resources
kw:placement
kw:planning
kw:policy
kw:port
kw:portability
kw:portal
kw:posthook
kw:pratchett
kw:preformance
kw:preservation
kw:privacy
kw:process
kw:profile
kw:profiling
kw:progress
kw:proxy
kw:publish
kw:pyOpenSSL
kw:pyasn1
kw:pycparser
kw:pycrypto
kw:pycrypto-lib
kw:pycryptopp
kw:pyfilesystem
kw:pyflakes
kw:pylint
kw:pypi
kw:pypy
kw:pysqlite
kw:python
kw:python3
kw:pythonpath
kw:pyutil
kw:pywin32
kw:quickstart
kw:quiet
kw:quotas
kw:quoting
kw:raic
kw:rainhill
kw:random
kw:random-access
kw:range
kw:raspberry-pi
kw:reactor
kw:readonly
kw:rebalancing
kw:recovery
kw:recursive
kw:redhat
kw:redirect
kw:redressing
kw:refactor
kw:referer
kw:referrer
kw:regression
kw:rekey
kw:relay
kw:release
kw:release-blocker
kw:reliability
kw:relnotes
kw:remote
kw:removable
kw:removable-disk
kw:rename
kw:renew
kw:repair
kw:replace
kw:report
kw:repository
kw:research
kw:reserved_space
kw:response-needed
kw:response-time
kw:restore
kw:retrieve
kw:retry
kw:review
kw:review-needed
kw:reviewed
kw:revocation
kw:roadmap
kw:rollback
kw:rpm
kw:rsa
kw:rss
kw:rst
kw:rsync
kw:rusty
kw:s3
kw:s3-backend
kw:s3-frontend
kw:s4
kw:same-origin
kw:sandbox
kw:scalability
kw:scaling
kw:scheduling
kw:schema
kw:scheme
kw:scp
kw:scripts
kw:sdist
kw:sdmf
kw:security
kw:self-contained
kw:server
kw:servermap
kw:servers-of-happiness
kw:service
kw:setup
kw:setup.py
kw:setup_requires
kw:setuptools
kw:setuptools_darcs
kw:sftp
kw:shared
kw:shareset
kw:shell
kw:signals
kw:simultaneous
kw:six
kw:size
kw:slackware
kw:slashes
kw:smb
kw:sneakernet
kw:snowleopard
kw:socket
kw:solaris
kw:space
kw:space-efficiency
kw:spam
kw:spec
kw:speed
kw:sqlite
kw:ssh
kw:ssh-keygen
kw:sshfs
kw:ssl
kw:stability
kw:standards
kw:start
kw:startup
kw:static
kw:static-analysis
kw:statistics
kw:stats
kw:stats_gatherer
kw:status
kw:stdeb
kw:storage
kw:streaming
kw:strports
kw:style
kw:stylesheet
kw:subprocess
kw:sumo
kw:survey
kw:svg
kw:symlink
kw:synchronous
kw:tac
kw:tahoe-*
kw:tahoe-add-alias
kw:tahoe-admin
kw:tahoe-archive
kw:tahoe-backup
kw:tahoe-check
kw:tahoe-cp
kw:tahoe-create-alias
kw:tahoe-create-introducer
kw:tahoe-debug
kw:tahoe-deep-check
kw:tahoe-deepcheck
kw:tahoe-lafs-trac-stream
kw:tahoe-list-aliases
kw:tahoe-ls
kw:tahoe-magic-folder
kw:tahoe-manifest
kw:tahoe-mkdir
kw:tahoe-mount
kw:tahoe-mv
kw:tahoe-put
kw:tahoe-restart
kw:tahoe-rm
kw:tahoe-run
kw:tahoe-start
kw:tahoe-stats
kw:tahoe-unlink
kw:tahoe-webopen
kw:tahoe.css
kw:tahoe_files
kw:tahoewapi
kw:tarball
kw:tarballs
kw:tempfile
kw:templates
kw:terminology
kw:test
kw:test-and-set
kw:test-from-egg
kw:test-needed
kw:testgrid
kw:testing
kw:tests
kw:throttling
kw:ticket999-s3-backend
kw:tiddly
kw:time
kw:timeout
kw:timing
kw:to
kw:to-be-closed-on-2011-08-01
kw:tor
kw:tor-protocol
kw:torsocks
kw:tox
kw:trac
kw:transparency
kw:travis
kw:travis-ci
kw:trial
kw:trickle
kw:trivial
kw:truckee
kw:tub
kw:tub.location
kw:twine
kw:twistd
kw:twistd.log
kw:twisted
kw:twisted-14
kw:twisted-trial
kw:twitter
kw:twn
kw:txaws
kw:type
kw:typeerror
kw:ubuntu
kw:ucwe
kw:ueb
kw:ui
kw:unclean
kw:uncoordinated-writes
kw:undeletable
kw:unfinished-business
kw:unhandled-error
kw:unhappy
kw:unicode
kw:unit
kw:unix
kw:unlink
kw:update
kw:upgrade
kw:upload
kw:upload-helper
kw:uri
kw:url
kw:usability
kw:use-case
kw:utf-8
kw:util
kw:uwsgi
kw:ux
kw:validation
kw:variables
kw:vdrive
kw:verify
kw:verlib
kw:version
kw:versioning
kw:versions
kw:video
kw:virtualbox
kw:virtualenv
kw:vista
kw:visualization
kw:visualizer
kw:vm
kw:volunteergrid2
kw:volunteers
kw:vpn
kw:wapi
kw:warners-opinion-needed
kw:warning
kw:weapi
kw:web
kw:web.port
kw:webapi
kw:webdav
kw:webdrive
kw:webport
kw:websec
kw:website
kw:websocket
kw:welcome
kw:welcome-page
kw:welcomepage
kw:wiki
kw:win32
kw:win64
kw:windows
kw:windows-related
kw:winscp
kw:workaround
kw:world-domination
kw:wrapper
kw:write-enabler
kw:wui
kw:x86
kw:x86-64
kw:xhtml
kw:xml
kw:xss
kw:zbase32
kw:zetuptoolz
kw:zfec
kw:zookos-opinion-needed
kw:zope
kw:zope.interface
p/blocker
p/critical
p/major
p/minor
p/normal
p/supercritical
p/trivial
r/cannot reproduce
r/duplicate
r/fixed
r/invalid
r/somebody else's problem
r/was already fixed
r/wontfix
r/worksforme
t/defect
t/enhancement
t/task
v/0.2.0
v/0.3.0
v/0.4.0
v/0.5.0
v/0.5.1
v/0.6.0
v/0.6.1
v/0.7.0
v/0.8.0
v/0.9.0
v/1.0.0
v/1.1.0
v/1.10.0
v/1.10.1
v/1.10.2
v/1.10a2
v/1.11.0
v/1.12.0
v/1.12.1
v/1.13.0
v/1.14.0
v/1.15.0
v/1.15.1
v/1.2.0
v/1.3.0
v/1.4.1
v/1.5.0
v/1.6.0
v/1.6.1
v/1.7.0
v/1.7.1
v/1.7β
v/1.8.0
v/1.8.1
v/1.8.2
v/1.8.3
v/1.8β
v/1.9.0
v/1.9.0-s3branch
v/1.9.0a1
v/1.9.0a2
v/1.9.0b1
v/1.9.1
v/1.9.2
v/1.9.2a1
v/cloud-branch
v/unknown
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: tahoe-lafs/trac#1258
No description provided.