Difference between revisions of "147948"

From ThorstensHome
Jump to: navigation, search
Line 1: Line 1:
[http://bugs.kde.org/147948 KDE bug 147948] is about kio_fish stalling. The last words on konsole of kio_fish should be:
+
[http://bugs.kde.org/147948 KDE bug 147948] is about kio_fish stalling.
 +
The bug can be reproduced with the follwing testcase:
 +
CMakeLists.txt
 +
<pre>
 +
PROJECT( browser )
 +
FIND_PACKAGE(KDE4 REQUIRED)
 +
INCLUDE_DIRECTORIES( ${KDE4_INCLUDES} . )
 +
 
 +
 
 +
SET(kde4startSources main.cpp browser.cpp )
 +
 
 +
 
 +
KDE4_ADD_EXECUTABLE(browser ${kde4startSources} )
 +
 
 +
TARGET_LINK_LIBRARIES(browser ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} )
 +
 
 +
install(TARGETS browser  DESTINATION ${BIN_INSTALL_DIR} )
 +
</pre>
 +
main.cpp
 +
<pre>
 +
#include <QString>
 +
#include <kapplication.h>
 +
#include <kaboutdata.h>
 +
#include <klocalizedstring.h>
 +
#include <kmessagebox.h>
 +
#include <kcmdlineargs.h>
 +
#include <KMainWindow>
 +
#include <browser.h>
 +
 
 +
int main (int argc, char *argv[])
 +
{
 +
  const QByteArray& ba=QByteArray("test");
 +
  const KLocalizedString name=ki18n("myName");
 +
  KAboutData aboutData( ba, ba, name, ba, name);
 +
  KCmdLineArgs::init( argc, argv, &aboutData );
 +
  KApplication khello;
 +
 
 +
  Browser *mw = new Browser();
 +
  mw->show();
 +
  khello.exec();
 +
}
 +
</pre>
 +
browser.cpp
 +
<pre>
 +
#include <kio/scheduler.h>     
 +
#include <kurl.h>               
 +
#include <kio/jobclasses.h>     
 +
#include <kdebug.h>             
 +
#include <browser.h>           
 +
#include <kio/copyjob.h>       
 +
 
 +
class TransferJob;
 +
 
 +
Browser::Browser() : QWidget(NULL)
 +
{
 +
  slotButtonClicked();
 +
}
 +
 
 +
void Browser::slotButtonClicked()
 +
{
 +
  kDebug() << "entering function";
 +
  // creating a kioslave
 +
  kDebug() << "getting via fish*************************************************************";
 +
  KUrl::List selectedUrls;
 +
 
 +
  for (int i=1; i<100; i++)
 +
  {
 +
    QString filename=QString("/tmp/fishtest");
 +
    filename.append(QString::number(i)).append(".txt");
 +
    kDebug() << filename;
 +
    selectedUrls.push_back(KUrl(filename));
 +
  }
 +
  KUrl destUrl("fish://root@localhost/tmp/test");
 +
  KIO::CopyJob* job0 = KIO::copy( selectedUrls, destUrl );
 +
  job0->start();
 +
}
 +
 
 +
void Browser::dataishere(KIO::Job *,const QByteArray & data )
 +
{
 +
  static int counter=0;
 +
  kDebug() << ++counter << " data is here*************************************************************";
 +
  kDebug() << data;
 +
}
 +
</pre>
 +
browser.h
 +
<pre>
 +
#ifndef KDE4START_H__
 +
#define KDE4START_H__
 +
 
 +
#include <kmainwindow.h>
 +
#include <kio/scheduler.h>
 +
#include <kurl.h>
 +
#include <kio/jobclasses.h>
 +
 
 +
class Browser : public QWidget
 +
{
 +
  Q_OBJECT
 +
  public:
 +
    Browser();
 +
  public slots:
 +
    void slotButtonClicked();
 +
    void dataishere(KIO::Job *,const QByteArray &);
 +
};
 +
#endif
 +
</pre>
 +
for i in $(seq 1 1 100); do touch /tmp/fishtest${i}.txt; done
 +
cmake . && make && ./browser &
 +
 
 +
The last words on konsole of kio_fish should be:
 
  fish(2273)/kio_fish fishProtocol::writeStdin: 1231 :  ---------
 
  fish(2273)/kio_fish fishProtocol::writeStdin: 1231 :  ---------
 
  fish(2273)/kio_fish fishProtocol::handleResponse: 824 :  handling:  "### 200"
 
  fish(2273)/kio_fish fishProtocol::handleResponse: 824 :  handling:  "### 200"

Revision as of 05:40, 5 January 2009

KDE bug 147948 is about kio_fish stalling. The bug can be reproduced with the follwing testcase: CMakeLists.txt

PROJECT( browser )
FIND_PACKAGE(KDE4 REQUIRED)
INCLUDE_DIRECTORIES( ${KDE4_INCLUDES} . )


SET(kde4startSources main.cpp browser.cpp )


KDE4_ADD_EXECUTABLE(browser ${kde4startSources} )

TARGET_LINK_LIBRARIES(browser ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} )

install(TARGETS browser  DESTINATION ${BIN_INSTALL_DIR} )

main.cpp

#include <QString>
#include <kapplication.h>
#include <kaboutdata.h>
#include <klocalizedstring.h>
#include <kmessagebox.h>
#include <kcmdlineargs.h>
#include <KMainWindow>
#include <browser.h>

int main (int argc, char *argv[])
{
  const QByteArray& ba=QByteArray("test");
  const KLocalizedString name=ki18n("myName");
  KAboutData aboutData( ba, ba, name, ba, name);
  KCmdLineArgs::init( argc, argv, &aboutData );
  KApplication khello;

  Browser *mw = new Browser();
  mw->show();
  khello.exec();
}

browser.cpp

#include <kio/scheduler.h>       
#include <kurl.h>                
#include <kio/jobclasses.h>      
#include <kdebug.h>              
#include <browser.h>             
#include <kio/copyjob.h>         

class TransferJob;

Browser::Browser() : QWidget(NULL)
{
  slotButtonClicked();
}

void Browser::slotButtonClicked()
{
  kDebug() << "entering function";
  // creating a kioslave
  kDebug() << "getting via fish*************************************************************";
  KUrl::List selectedUrls;

  for (int i=1; i<100; i++)
  {
    QString filename=QString("/tmp/fishtest");
    filename.append(QString::number(i)).append(".txt");
    kDebug() << filename;
    selectedUrls.push_back(KUrl(filename));
  }
  KUrl destUrl("fish://root@localhost/tmp/test");
  KIO::CopyJob* job0 = KIO::copy( selectedUrls, destUrl );
  job0->start();
}

void Browser::dataishere(KIO::Job *,const QByteArray & data )
{
  static int counter=0;
  kDebug() << ++counter << " data is here*************************************************************";
  kDebug() << data;
}
browser.h
#ifndef KDE4START_H__
#define KDE4START_H__

#include <kmainwindow.h>
#include <kio/scheduler.h>
#include <kurl.h>
#include <kio/jobclasses.h>

class Browser : public QWidget
{
  Q_OBJECT
  public:
    Browser();
  public slots:
    void slotButtonClicked();
    void dataishere(KIO::Job *,const QByteArray &);
};
#endif
for i in $(seq 1 1 100); do touch /tmp/fishtest${i}.txt; done
cmake . && make && ./browser &

The last words on konsole of kio_fish should be:

fish(2273)/kio_fish fishProtocol::writeStdin: 1231 :  ---------
fish(2273)/kio_fish fishProtocol::handleResponse: 824 :  handling:  "### 200"
fish(2273)/kio_fish fishProtocol::handleResponse: 831 :  result:  200 , errorCount:  0
fish(2273)/kio_fish fishProtocol::finished: 1403 :  _______ emitting finished()

The functions are implemented in /kdebase/runtime/kioslave/fish/fish.cpp

Important commands: fishProtocol::sendCommand; writeStdin

get,put,stat,mimetype,listDir,mkdir,rename,symlink,chmod,copy,del,special -(call)-> run -(calls)-> received -(calls)-> manageConnection -(calls)-> handleResponse