Tk Library Source Code

View Ticket
Login
Ticket UUID: 1720144
Title: Unable to ftp files with multiple spaces together
Type: Bug Version: None
Submitter: nobody Created on: 2007-05-16 16:22:59
Subsystem: ftpd Assigned To: andreas_kupries
Priority: 8 Severity:
Status: Closed Last Modified: 2007-08-21 03:41:30
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2007-08-20 20:41:30
Description:
In ftp::read there is a line:

set parts [split $command]

The problem with splitting on a space is that multiple spaces will turn into empty list elements {}.

I understand the split is needed to make sure $command is a valid list, but perhaps there could be some sort of statement to remove empty list elements.  Something like:

set parts [string map {\{\} ""} [split $command]]
User Comments: andreas_kupries added on 2007-08-21 03:41:30:
Logged In: YES 
user_id=75003
Originator: NO

Committed to head.

andreas_kupries added on 2007-05-23 03:48:26:

File Added - 230163: ftpd.diff.2

Logged In: YES 
user_id=75003
Originator: NO

File Added: ftpd.diff.2

andreas_kupries added on 2007-05-23 03:17:38:

File Added - 230158: ftpd.diff

Logged In: YES 
user_id=75003
Originator: NO

File Added: ftpd.diff

andreas_kupries added on 2007-05-23 03:05:45:
Logged In: YES 
user_id=75003
Originator: NO

Re-reading the RFC 959 I think that the whole command/argument processing in the server is wrong. We are treating the line as  Tcl list (set parts [...]) but the RFC says that after the command comes one separating space char, and everything after to the end of the line is one argument field, spaces and all. Which means that the code separating command and argument has to be redone ... Hm ... Possible solution is 'regexp' to find and split on first space.

regexp {^([^ ]+) (.*)$} $command -> cmd argument

and the lindex/lrange commands in lines 538 and 553 can be removed, replaced by the variables set by the regexp.

[email protected] added on 2007-05-17 01:46:15:
Logged In: NO 

Yeah, I forgot to mention that I rewrote the STOR command in my ftp server.  The ftpd::read command will get a line like:

"STOR this is my file name.txt"

If you split that line, it looks exactly the same.  Then it calls ftpd::command::STOR and currently: 

set filename [lindex $list 0]  which would have a file on the server called "this"

However, my STOR command says: set filename $list

I think it's important that this package allow spaces in the names, since most windows users like to have spaces.  That's just my two cents.

lvirden added on 2007-05-16 23:26:54:
Logged In: YES 
user_id=15949
Originator: NO

won't there also be a problem if the file to be ftp'd has spaces in the name?

Attachments: