KIO errors (CVS HEAD)

David Faure dfaure at klaralvdalens-datakonsult.se
Mon Jun 14 22:24:27 BST 2004


On Monday 14 June 2004 23:21, Andras Mantia wrote:
> On Monday 14 June 2004 23:54, David Faure wrote:
> > On Monday 14 June 2004 17:19, Andras Mantia wrote:
> > > Hi,
> > >
> > >  Today I encountered two KIO::NetAccess errors. The first one is
> > > with download (but affects file_copy as well), the second is with
> > > file_copy. The problem with the first one is that if you do the
> > > following: QString tmp;
> > >        KIO::NetAccess::download(absUrl, tmp, this);
> > >        QFile f(tmp);
> > >        if (!f.open(IO_ReadOnly))
> > >          kdDebug(24000) << "Cannot open: " << f.name() << ". The
> > > error was: " << f.errorString() << endl;
> > >        else {
> > >         f.close();
> > >        }
> > >        KIO::NetAccess::removeTempFile(tmp);
> > >
> > > From time to time you will see that the file cannot be opened, and
> > > the error is "No such file or directory".
> >
> > I can't think of a reason why this should happen...
> 
> I know this is strange, but it happens. I forgot to tell you that when 
> the error happens the temporary file is not removed with the  
> KIO::NetAccess::removeTempFile(tmp).
> 
> >
> > > The result is the same. Sometimes the file cannot be opened. An
> > > ugly int k = 0;
> > >       while (!f.exists() && k < 1000000) k++;
> > > before f.open() usually helps.
> >
> > How could it? No event processing happens in that loop, so nothing
> > can e.g. receive a late qt event or something. It might give time to
> > the kio_file slave, but there's no need for any of this since the job
> > is done before that... Did you write your own filesystem which delays
> > the actual creation of the file? :-P
> 
> I use SuSE 9.1 with it's standard reiserfs (don't know which version). 
> But it doesn't look like a filesystem bug, as it constantly happens 
> with the FTP ioslave, but I couldn't reproduce with sftp (nor with the 
> file ioslave, as the code is executed for local files as well).

NetAccess::download doesn't use KIO at all for local files :)
file_copy does (but using a "direct copy" method, so it's a bit different).

FTP only? Maybe it's actually related to the direct copy thing....
but well, I'd see it too then. Please try the attached.

> > About the dialog: that's impossible. 
I was wrong. FileCopyJob shows the dialog if the a .part file exists and
resuming is supported. Hmm. Maybe the .part -> final file renaming is the
problem, somehow.

-- 
David Faure -- faure at kde.org, dfaure at klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proof.diff
Type: text/x-diff
Size: 2794 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040614/12f345be/attachment.diff>


More information about the kde-core-devel mailing list