Re: [PATCH] Fix GnomeVFS LS parser



On Wed, 2005-10-19 at 19:42 +0200, Christian Neumair wrote:
> Am Mittwoch, den 19.10.2005, 10:20 +0200 schrieb Alexander Larsson:

> > > We seem to convert the incoming char * into a char * array by adding a
> > > new array element to the columns array whenever a space, a carriage
> > > return or a newline character is reached in vfs_split_text. Therefore,
> > > none of the columns array members contains any of these character, and
> > > the information whether we split on a line-break or on a space is lost.
> > 
> > So, the ls text feed into this function is never linewrapped? I'm not
> > sure how e.g. the ftp protocol works. Does it send really wide ls lines
> > if the filename is long?
> 
> Yes, it passes multiple lines at once. Maybe we should add proper
> documentation to the ls parser, only parse the first line, only pass the
> part before '\r' and '\n' in the FTP module, and remove the second part
> of is_last_column? However, I was told that '\n' and '\r' may legally
> occur in filenames. Odd enough to ignore? Or should we pass the whole
> multiline string, and try to vfs_parse_filetype and vfs_parse_filemode
> the string after the first newline?

Thats not really what i meant, i was wondering if an ftp server ever
sends linewrapped text, but it doesn't look so. However, you're right
that the filenames can contain '\n'. I just tried with a local ftp
server, and it handed me this:

---------x    1 500      500             0 Oct 20 07:16 a
b
drwxrwxr-x    2 500      500          4096 Oct 20 07:13 a really really long name, a really really long name,a really really long name,a really really long name,a really really long name,a really really long name,a really really long name
-rw-rw-r--    1 500      500            55 Oct 20 07:16 a.c

Where the first filename is "a\nb".

I'm not sure this is worth worrying about though, it seems pretty
unusual, and might be hard to fix with the current code.

Go ahead and commit your patch, it at least clearly does better than
what we have now.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an obese alcoholic cop haunted by memories of 'Nam. She's a wealthy 
blonde schoolgirl on her way to prison for a murder she didn't commit. They 
fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]