﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	launchpad_bug
2394	"ftp ""ls"" command is broken"	warner	warner	"While testing the fix for #2388, I noticed that FTP's ""ls"" command is broken. Apparently it was broken in 1.10.0 too, so I'm marking this as a release-blocking regression. I suspect it has to do with a change in Twisted, though, so maybe it worked at one point and we just got caught by an API change.

{{{
(ve)206:warner@brian-office-mini% ftp -P 8021 alice@localhost
Trying 127.0.0.1...
Connected to localhost.
220 Twisted 15.0.0 FTP Server
331 Password required for alice.
Password:
230 User logged in, proceed
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (127,0,0,1,220,56).
125 Data connection already open, starting transfer
<HANG>
}}}

twistd.log:

{{{
2015-03-24 10:16:13-0700 [-] Unexpected FTP error
2015-03-24 10:16:13-0700 [-] Unhandled Error
	Traceback (most recent call last):
	  File ""/usr/local/lib/python2.7/site-packages/twisted/internet/base.py"", line 824, in runUntilCurrent
	    call.func(*call.args, **call.kw)
	  File ""/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/foolscap-0.7.0-py2.7.egg/foolscap/eventual.py"", line 26, in _turn
	    cb(*args, **kwargs)
	  File ""/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py"", line 383, in callback
	    self._startRunCallbacks(result)
	  File ""/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py"", line 491, in _startRunCallbacks
	    self._runCallbacks()
	--- <exception caught here> ---
	  File ""/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py"", line 578, in _runCallbacks
	    current.result = callback(current.result, *args, **kw)
	  File ""/usr/local/lib/python2.7/site-packages/twisted/protocols/ftp.py"", line 996, in gotListing
	    self.dtpInstance.sendListResponse(name, attrs)
	  File ""/usr/local/lib/python2.7/site-packages/twisted/protocols/ftp.py"", line 474, in sendListResponse
	    self.sendLine(self._formatOneListResponse(name, *response))
	  File ""/usr/local/lib/python2.7/site-packages/twisted/protocols/ftp.py"", line 464, in _formatOneListResponse
	    'permissions': permissions.shorthand(),
	exceptions.AttributeError: 'int' object has no attribute 'shorthand'
}}}

I'm guessing this involves `allmydata.frontends.ftpd.Handler._populate_row`, where it returns a fake (int) `0600` as the ""permissions"" key for all rows. I'm further guessing that Twisted's changed the API to require some sort of Permissions object.

We need to check the range of Twisteds with which we claim compatibility, look at the variety of `ftp.IFTPShell` interfaces required by that set, and find a way to be compatible with all of them.
"	defect	closed	normal	1.10.1	code-frontend-ftp-sftp	1.10.0	fixed	ftpd regression		
