michaellukashov / Far-NetBox

SFTP/SCP/FTP/FTPS/WebDAV/S3 client for Far Manager 3 (http://farmanager.com/)
https://forum.farmanager.com/viewtopic.php?t=6317
GNU General Public License v2.0
159 stars 52 forks source link

NetBox trimming trailing spaces #378

Open alabuzhev opened 7 months ago

alabuzhev commented 7 months ago

https://github.com/FarGroup/Far-NetBox/issues/5 by @carton-of-mice:

NetBox appears to trim trailing spaces on FTP listings (and in other places). While at least CFtpListResult::parseAsMlsd() honours RFC 3659 and says it does not trim, that function is fed data from CFtpListResult::GetLine(), that explicitly removes tailing spaces and tabs. This leads to an invalid directory listing that can't be used for further operations. Assuming one knows the correct name of a directory, punching in CD "test " in the command line can work around this. Behaviour reproduced at least with pure-ftpd (over MLSD) and vsftpd (on whatever it emits for LIST) and I imagine it should be similar with any backing filesystem and FTP server allowing trailing spaces in filenames. While I agree that this is bad practice, more so with a badly defined protocol, this is compatibility problem first.

From the log for MLSD:

. 2020-09-15 19:18:03.395 type=dir;sizd=2;modify=20200915124101;UNIX.mode=0755;UNIX.uid=1001;UNIX.gid=1001;unique=39g45c4e1; test
. 2020-09-15 19:18:03.396 test;D;0;2020-09-15T12:41:01.000Z;3;"1001" [0];"1001" [0];rwxr-xr-x;0

Related trailing spaces issues I did not investigate much