[paramiko] OpenSSH sftp server returns EOF after directory listing, paramiko does not.

Charles Duffy Charles_Duffy at messageone.com
Mon May 5 10:25:20 PDT 2008


Per subject - if my interpretation of the behavior described below is
correct, lftp (even as current as 3.7.1) appears to be relying on this
behavior.

 

Running against my paramiko-based server, lftp hangs indefinitely trying
to run a directory listing:

 

---- path on wire is `/'

---> sending a packet, length=10, type=11(OPENDIR), id=4

<--- got a packet, length=12, type=102(HANDLE), id=4

---- got file handle 687831 (3)

---> sending a packet, length=12, type=12(READDIR), id=5

<--- got a packet, length=231, type=104(NAME), id=5

---- file name count=2

---> sending a packet, length=12, type=12(READDIR), id=6

---> sending a packet, length=12, type=12(READDIR), id=7

<--- got a packet, length=24, type=101(STATUS), id=6

<--- got a packet, length=24, type=101(STATUS), id=7 

  ^^ hangs here until interrupted

 

...whereas when running against an OpenSSH  server, behavior is quite
different:

 

---- path on wire is `//home/cduffy/tmp/a'

---> sending a packet, length=28, type=11(OPENDIR), id=4

<--- got a packet, length=13, type=102(HANDLE), id=4

---- got file handle 00000000 (4)

---> sending a packet, length=13, type=12(READDIR), id=5

<--- got a packet, length=501, type=104(NAME), id=5

---- file name count=5

---> sending a packet, length=13, type=12(READDIR), id=6

---> sending a packet, length=13, type=12(READDIR), id=7

<--- got a packet, length=28, type=101(STATUS), id=6

---- status code=1(EOF), message=End of file

---- eof

<--- got a packet, length=28, type=101(STATUS), id=7

---- status code=1(EOF), message=End of file

drwxr-xr-x    4 cduffy   cduffy       4096 May  4 17:48 .

drwxr-xr-x    4 cduffy   cduffy       4096 May  4 17:33 ..

-rw-r--r--    1 cduffy   cduffy          0 May  4 17:48 A

drwxr-xr-x    3 cduffy   cduffy       4096 May  4 17:33 b

drwxr-xr-x    3 cduffy   cduffy       4096 May  4 17:33 d

---> sending a packet, length=13, type=4(CLOSE), id=8

<--- got a packet, length=24, type=101(STATUS), id=8

---- status code=0(OK), message=Success

 

It appears that STATUS packets 6 and 7 from OpenSSH signal EOF, while
those from paramiko signal some other status (perhaps OK?) which lftp
doesn't see fit to comment on, even on a maximal debug level.

 

Is this difference in behavior intentional? Is it within the letter of
the sftp standard? (Where *is* the sftp standard? I've had a fair bit of
trouble googling it up).

 

Thanks!

 

-- 


Charles Duffy

Systems Engineering

charles_duffy at messageone.com

http://www.messageone.com <http://www.messageone.com/> 

Dell MessageOne
11044 Research Blvd
Building C, Fifth Floor
Austin, TX 78759

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lag.net/pipermail/paramiko/attachments/20080505/39cf3299/attachment.html 


More information about the paramiko mailing list