wolpi / prim-ftpd

FTP server app for android
Other
583 stars 78 forks source link

error while reading: received a short buffer from FXP_READ, but not at EOF #290

Closed dave0003 closed 1 year ago

dave0003 commented 1 year ago

In super user mode, I've found that often when I'm transferring files, I receive this error:

error while reading: received a short buffer from FXP_READ, but not at EOF

And the file that is transferred is cut-off and corrupted.

I'm not sure it's strictly a bug for primitive-ftpd, but it is unusual. I found a note here:

https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/fxp-short-reads.html

Most servers don't present this error, though. The only other report they've had is OpenVMS server.

wolpi commented 1 year ago

Do you use setting to copy files to temp dir before transferring in super-user-mode?

Background: Java code cannot be run as root. Java code needs to run linux commands as root and read their output. To transfer files tool dd is used. Input/output streams of dd process are connected to Java IO-Streams. That is fragile and might cause the behavior you see. When switching of "copy to temp first" that fragile stuff is avoided. But of course temp files need space and time to be created.

dave0003 commented 1 year ago

I hadn't been using that setting. I just tried it, and it seems to fix the issue. Thank you!

Is there a way to set the temp file storage to the sd card, so large files aren't as much of a problem, and to avoid wearing out the phone's flash storage? I have a large high endurance sd card, so it should be fine there.

wolpi commented 1 year ago

Well, usually accessing sd-card is not possible via filesystem API but with SAF-API. That requires additional user interaction, it is slow (at least for listing files) and cumbersome to work with. Currently that "temp-for-root-files" mechanism is implemented with filesystem-API and app-private-storage-area. These app-specific folde structure might be present on sd-card, too. I'll have to check if that can be used. Will take some time until I find time.

dave0003 commented 1 year ago

Thank you.