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

Closed
opened 2015-02-28 22:24:07 +00:00 by daira · 6 comments
daira commented 2015-02-28 22:24:07 +00:00
Owner

[by ekodo]reported

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)
[by ekodo]reported 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) ```
tahoe-lafs added the
code-nodeadmin
critical
defect
1.10.0
labels 2015-02-28 22:24:07 +00:00
tahoe-lafs added this to the 1.10.1 milestone 2015-02-28 22:24:07 +00:00

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

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

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.

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`.
daira commented 2015-03-04 00:48:24 +00:00
Author
Owner

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.

Replying to [warner](/tahoe-lafs/trac-2024-07-25/issues/2388#issuecomment-96816): > 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`.
daira commented 2015-03-04 00:50:33 +00:00
Author
Owner
See the <https://github.com/tahoe-lafs/tahoe-lafs/commits/2388.fix-paths-must-be-unicode-strings.1> branch for an untested fix.

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

(https://github.com/tahoe-lafs/tahoe-lafs/pull/147) adds a test and fixes the missing imports.
daira commented 2015-03-24 17:21:40 +00:00
Author
Owner

Rebased and landed in [21226cbb82a51c98361e02a9ac3df5c05f9474a8], [3066039f0f802406675e30f5521f98fb79d444a8], and b6be693cbedb201206a73439584d28b2aeb3ac38.

Rebased and landed in [21226cbb82a51c98361e02a9ac3df5c05f9474a8], [3066039f0f802406675e30f5521f98fb79d444a8], and b6be693cbedb201206a73439584d28b2aeb3ac38.
tahoe-lafs added the
fixed
label 2015-03-24 17:21:40 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 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#2388
No description provided.