Unexpected FTP session

0 votes
asked Mar 20, 2019 in Bug by ingo (120 points)
edited Mar 20, 2019 by ingo

Below an interactive python session with plantuml in FTP mode. There are some strange / unexpected things happening. I don't kow wether plantuml or python is the cause or even wther it should be seen as a bug.

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import ftplib
>>> ftp = ftplib.FTP()
>>> print(ftp.connect('127.0.0.1', 4242))
220 PlantUML
>>> print(ftp.login())
230 Logged in.
>>> ftp.set_pasv(False)
>>> print(ftp.retrlines("LIST"))
226 Listing completed.
>>> with open("a.txt", 'rb') as fup:
    print(ftp.storlines("STOR a.txt", fup))

226 Transfer complete.

>>> print(ftp.retrlines("LIST"))
total 192
-rw-rw-r--    1 plantuml plantuml     1003 Sep 28  2006 a.txt
-rw-rw-r--    1 plantuml plantuml    96883 Sep 28  2006 a.png
226 Listing completed.


So far so good. a.png starts at length 0. I can start the download straight away while the rendering process isn't finished yet and I don't have to wait for some indefinite time.

>>> ftp.sendcmd('DELE a.txt')
'200 Command okay.'
>>> ftp.sendcmd('DELE a.png')
'200 Command okay.'
>>> print(ftp.retrlines("LIST"))
total 0
-rw-rw-r--    1 plantuml plantuml        0 Sep 28  2006 a.png
-rw-rw-r--    1 plantuml plantuml        0 Sep 28  2006 a.txt
226 Listing completed.


Despite deleting I still see the files, with length 0. Having a look with FileZilla FTP client shows no files.
Simulating the above process on a 'real' FTP server I see no files fron Python nor from FileZilla.

All in it self probably no problem, but then something went wrong with an upload of a.txt, so no new file was rendered. Then download started it tried forever to download the zero length png-file :(

In a moment of lazyness I tried:

>>> ftp.sendcmd('DELE *.*')
'200 Command okay.'
>>> print(ftp.retrlines("LIST"))
total 0
-rw-rw-r--    1 plantuml plantuml        0 Sep 28  2006 a.png
-rw-rw-r--    1 plantuml plantuml        0 Sep 28  2006 *.*
-rw-rw-r--    1 plantuml plantuml        0 Sep 28  2006 a.txt
226 Listing completed.
>>>


Why does the *.* show up as a file??

ingo

1 Answer

0 votes
answered Mar 25, 2019 by plantuml (295,000 points)
The implementation we've done with this mock FTP server is really minimum.

With last beta http://beta.plantuml.net/plantuml.jar we now deal the "DELE *.*" case.

Tell us if you find other issues!
commented Mar 26, 2019 by ingo (120 points)
I'll give it a go, thanks!
...