Development/Tutorials/Debugging/Debugging IOSlaves/Debugging kio fish: Difference between revisions

From KDE TechBase
Line 26: Line 26:
So here is how you can have a sensible communication with a fish server:
So here is how you can have a sensible communication with a fish server:
  (echo __END__; cat)| cat .fishsrv.pl -  | perl .fishsrv.pl
  (echo __END__; cat)| cat .fishsrv.pl -  | perl .fishsrv.pl


== Write to a file ==
== Write to a file ==

Revision as of 22:08, 28 February 2009

This page is a starting point for debugging kio_fish. Please also read how to debug IO slaves generically.

Bugs

Interesting bugs to get into the topic

Overview

When you point your konqueror to fish://user@target, the fish kioslave opens a process that calls the executable ssh. If a password is needed, this question is passed on to you (search for "password" in fish.cpp). Then a perl script is copied over to the target host and executed there. On the target host, the file is named .fishsrv.pl. This perl script is compiled into your binary kio_fish.o. If you want to change it sustainably, you will have to change fish.pl in your source dir and then compile and install the directory kioslave/fish.

The perl script, running on the target computer, is (t)here to execute fish commands like LIST, STAT, WRITE and APPEND. They are sent from fish.cpp running on the source computer.

Test case

If you want a test case to get some debugging output from kio_fish, get a fresh checkout of kdebase. There you find a test case in runtime/kioslave/fish/tests. I had the problem that the STOR commands from the fish kioslave were not logged as long as I had localhost as target computer. When I changed it to my local address (192.168.0.7), it worked.

Logging

You may want to switch on logging for fish.cpp and for fish.pl.

Manually testing fish

To test fish manually, call ~/.fishsrv.pl. The fish server will ask you in friendly words (it says ### 100) to transmit its own code, followed by a line __END__. Transmit it. Then the fish server is ready to talk with you (it says ### 200). You can have a conversation like this:

### 200
#VER
VER 0.0.3 copy lscount lslinks lsmime exec stat
### 200

So here is how you can have a sensible communication with a fish server:

(echo __END__; cat)| cat .fishsrv.pl -  | perl .fishsrv.pl

Write to a file

itchy:~/kdebase/runtime/kioslave/fish # cat fish.pl - | perl fish.pl
### 100 transfer fish server
### 200
#WRITE 0 6 /t
123456
### 100
132345
### 200
itchy:~/kdebase/runtime/kioslave/fish # ll /t
-rw-r--r-- 1 root root 6 Feb 28 08:17 /t