KRun and Redirection

David Faure faure at kde.org
Sun Apr 18 21:05:00 BST 2004


On Sunday 18 April 2004 21:54, Dawit A. wrote:
> On Sunday 18 April 2004 14:36, David Faure wrote:
> > On Wednesday 14 April 2004 20:56, Dawit A. wrote:
> >
> > Hmm, but you're talking about ::stat, not about ::mimetype... Why should
> > redirections in ::stat() matter? There again, if KRun finds out "it's a
> > directory" it will open it (and get redirected again)
> 
> It does matter because what you originally stat'ed and what you eventually end 
> up opening might be different, no ? Or in the least you end up performing the 
> same another unnecessary stat in the ioslave.

Sure. I'm not saying it can't be optimized to work a bit better, I'm just saying
it should work already. Sorry for not making that clear.

Hmm, although, here, it's a matter of definition. In kio_ftp, stat() does
NOT emit the redirect. The only purpose of stat() is to return information
about the type of something (dir? file? etc.). A bit like the real
system stat(), which automatically follows symlinks (and doesn't emit
a redirect signal or whatever :).

> For the sake of simplicity let  
> me go through the kio_sftp problem I mentioned in sequence:
> 
> 1.) User types "sftp://somehost" (note no path).
> 2.) Konqueror says I need to find out mime type and call KonqRun.
> 3.) KonqRun calls all its parents which eventually ends up in KRun::init.
> 4.) KonqRun::init does a KIO::stat.
> 5.) kio_sftp gets the stat call and says ahhh no path, let me ask the remote 
> server for the default path and does exactly that.
> 6.) Remote ssh server sends back the default path based on the logged in user.
> 7.) kio_sftp says thanks and sends a redirect request to the new path and 
> returns.

Then kio_sftp is wrong IMHO. It doesn't answer the question "file or dir",
it only answers "hey, ask me again with another path".

I suggest to do it like in kio_ftp.
For an empty path stat() returns "this is a directory", and the redirect only 
happens when listing.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list