#2388 closed defect (fixed)

"AssertionError: paths must be Unicode strings" when starting a node

Reported by: daira Owned by: daira
Priority: critical Milestone: 1.10.1
Component: code-nodeadmin Version: 1.10.0
Keywords: regression tahoe-start unicode blocks-release review-needed Cc: ekodo@…
Launchpad Bug:

Description (last modified by daira)

[reported by ekodo]

I have tried to install tahoe-lafs on ubuntu 14.04.1 from github source.

All tests are passed, like in travis. But when I try to run the binary: tahoe start

I got the following error:

STARTING '/home/tahoe_user/.tahoe'
starting node in '/home/tahoe_user/.tahoe'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/runner.py", line 156, in run
    rc = runner(sys.argv[1:], install_node_control=install_node_control)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/runner.py", line 135, in runner
    rc = startstop_node.dispatch[command](so, stdout, stderr)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/startstop_node.py", line 159, in start
    twistd.runApp(twistd_config)
  File "/usr/lib/python2.7/dist-packages/twisted/scripts/twistd.py", line 23, in runApp
    _SomeApplicationRunner(config).run()
  File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 376, in run
    self.application = self.createOrGetApplication()
  File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 436, in createOrGetApplication
    ser = plg.makeService(self.config.subOptions)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/scripts/startstop_node.py", line 68, in makeService
    return Client(self.basedir)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/client.py", line 151, in __init__
    self.init_sftp_server()
  File "/usr/local/lib/python2.7/dist-packages/allmydata/client.py", line 479, in init_sftp_server
    sftp_portstr, pubkey_file, privkey_file)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/frontends/sftpd.py", line 1988, in __init__
    c = AccountFileChecker(self, accountfile)
  File "/usr/local/lib/python2.7/dist-packages/allmydata/frontends/auth.py", line 34, in __init__
    for line in open(abspath_expanduser_unicode(accountfile), "r"):
  File "/usr/local/lib/python2.7/dist-packages/allmydata/util/fileutil.py", line 314, in abspath_expanduser_unicode
    raise AssertionError("paths must be Unicode strings")
AssertionError: paths must be Unicode strings

And here are my version:

/usr/local/bin/tahoe --version-and-path
allmydata-tahoe: 1.10.0.post272 [master: e9e63c5e72619f4e5811cd1eed31e344db6236c8] (/usr/local/lib/python2.7/dist-packages)
foolscap: 0.6.4 (/usr/lib/python2.7/dist-packages)
pycryptopp: 0.6.0.1206569328141510525648634803928199668821045408958 (/usr/lib/python2.7/dist-packages)
zfec: 1.4.5 (/usr/lib/python2.7/dist-packages)
Twisted: 13.2.0 (/usr/lib/python2.7/dist-packages)
Nevow: 0.11.1 (/usr/local/lib/python2.7/dist-packages)
zope.interface: unknown (/usr/lib/python2.7/dist-packages/zope)
python: 2.7.6 (/usr/bin/python)
platform: Linux-Ubuntu_14.04-x86_64-64bit_ELF (None)
pyOpenSSL: 0.13 (/usr/lib/python2.7/dist-packages)
simplejson: 3.3.1 (/usr/lib/python2.7/dist-packages)
pycrypto: 2.6.1 (/usr/lib/python2.7/dist-packages)
pyasn1: 0.1.7 (/usr/lib/python2.7/dist-packages)
mock: 1.0.1 (/usr/lib/python2.7)
setuptools: 3.3 (/usr/lib/python2.7/dist-packages)
service-identity: 14.0.0 (/usr/local/lib/python2.7/dist-packages)
characteristic: 14.3.0 (/usr/local/lib/python2.7)
pyasn1-modules: 0.0.5 (/usr/local/lib/python2.7/dist-packages)

Change History (8)

comment:1 Changed at 2015-02-28T22:50:04Z by daira

  • Description modified (diff)

comment:2 follow-up: Changed at 2015-03-03T05:01:24Z by warner

Do we know what the tahoe.cfg held for the SFTP accountfile? Was it ASCII, unicode, or maybe an empty string?

comment:3 Changed at 2015-03-03T16:30:18Z by warner

It looks like src/allmydata/frontends/auth.py was recently (30-Jan-2015, in 14f7830) changed to use abspath_expanduser_unicode() instead of os.path.expanduser(). The config code has always been providing bytestrings, but it previously didn't matter because nothing was checking for unicode-ness. With 14f7830, auth.py started rejecting the config strings.

The fix will be to change Client.init_sftp_server to convert the self.get_config strings into unicode before delivering them to SFTPServer.

comment:4 in reply to: ↑ 2 Changed at 2015-03-04T00:48:24Z by daira

Replying to warner:

Do we know what the tahoe.cfg held for the SFTP accountfile? Was it ASCII, unicode, or maybe an empty string?

We know that the home directory path was ASCII, and the accountfile path was ~/.tahoe/private/accounts.

Last edited at 2015-03-04T00:57:02Z by daira (previous) (diff)

comment:6 Changed at 2015-03-20T16:00:30Z by daira

  • Keywords test-needed review-needed added

comment:7 Changed at 2015-03-21T22:16:49Z by warner

  • Keywords test-needed removed

https://github.com/tahoe-lafs/tahoe-lafs/pull/147 adds a test and fixes the missing imports.

comment:8 Changed at 2015-03-24T17:21:40Z by daira

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.