Difference between revisions of "Kio fish"

From ThorstensHome
Jump to: navigation, search
(Changing the fishcode)
 
Line 56: Line 56:
 
  "=cut\n"
 
  "=cut\n"
 
  "use Fcntl;\n"
 
  "use Fcntl;\n"
 +
This means, the perl code is contained in the binary:
 +
Linking CXX shared module CMakeFiles/CMakeRelink.dir/kio_fish.so
 +
Install the project...
 +
-- Install configuration: "Debugfull"
 +
-- Installing: /usr/lib64/kde4/kio_fish.so
 +
-- Up-to-date: /usr/share/kde4/services/fish.protocol
 +
tweedleburg:~/svn/kdebase/runtime/kioslave/fish # strings /usr/lib64/kde4/kio_fi
 +
kio_file.so    kio_filter.so  kio_finger.so  kio_fish.so
 +
tweedleburg:~/svn/kdebase/runtime/kioslave/fish # strings /usr/lib64/kde4/kio_fish.so
 +
[...]
 +
#!/usr/bin/perl
 +
=pod
 +
This file was transferred by kio_fish, a network client part of the
 +
KDE project. You may safely delete it, it will be transferred again
 +
when needed. It's only purpose is to make kio_fish access faster and
 +
more reliable.
 +
=cut
 +
use Fcntl;
 +
$|++;
 +
open(DEBUG,">/tmp/kio_fish.debug.$$.log");
 +
if (defined $code) {
 +
unlink('.fishsrv.pl');

Latest revision as of 09:24, 14 February 2009

This is a "blog" from me how I try to understand kio_fish.

I go and edit ~/.fishsrv.pl. There I add a little debugging output:

diff .fishsrv.pl .fishsrv2.pl
10c10,12
< #open(DEBUG,">/tmp/kio_fish.debug.$$.log");
---
>
> open(DEBUG,">/tmp/kio_fish.debug.$$.log");
> print DEBUG "hallo2";
90a93
> print DEBUG "the command is $_";
264a268
> print DEBUG "entering write_loop";

The file /tmp/kio_fish.debug... gets written. I change .fishsrv.pl again - no effect. I have to

killall kio_fish 

before changes to .fishsrv.pl get active.

When deleting a file and pasting it afterwards, the debugging output looks like this:

hallo2the command is DELE /root/bin/bandit.zipthe command is STAT /root/binthe command is STAT /root/bandit.zipthe command is LIST /root/bin/bandit.zipthe command is CHMOD 644 /root/bin bandit.zipthe command is LIST /root/bin

I had to learn this only works if you copy from fish:// to fish://. As soon as you copy from file:// to fish://, .fishsrv gets created freshly and all the work gets wiped out. Now as I write this the work even gets wiped if you copy from fish:// to fish://.

I also have to do a killall perl:

tweedleburg:~ # ps -A | grep perl
26286 pts/2    00:00:00 perl
tweedleburg:~ # ps -ef | grep perl
root     26286 26279  0 21:46 pts/2    00:00:00 perl -e $|=1; print "### 100 transfer fish server\n"; while(<STDIN>) { last if /^__END__/; $code.=$_; } exit(eval($code));
root     26296 24860  0 21:47 pts/4    00:00:00 grep perl
tweedleburg:~ #

Changing the fishcode

Now I want to change .fishsrv.pl as it gets written by KDE. I change fish.pl:

tweedleburg:~/svn/kdebase/runtime/kioslave/fish # kwrite fish.pl
QThreadStorage: Thread 0x602790 exited after QThreadStorage 2147483645 destroyed

And this modifies in a make fishcode.h:

tweedleburg:~/svn/kdebase/runtime/kioslave/fish # make
Generating fishcode.h
Scanning dependencies of target kio_fish
Building CXX object runtime/kioslave/fish/CMakeFiles/kio_fish.dir/fish.o
Linking CXX shared module ../../../lib/kio_fish.so
Built target kio_fish
tweedleburg:~/svn/kdebase/runtime/kioslave/fish #

Because fishcode.h contains the complete code from fish.pl. fishcode.h is generated from fish.pl:

tweedleburg:~/svn/kdebase/runtime/kioslave/fish # head fishcode.h
#define CHECKSUM "29ebf1c00557f5748c7571e6e38b3b68"
static const char *fishCode(
"#!/usr/bin/perl\n"
"=pod\n"
"This file was transferred by kio_fish, a network client part of the\n"
"KDE project. You may safely delete it, it will be transferred again\n"
"when needed. It's only purpose is to make kio_fish access faster and\n"
"more reliable.\n"
"=cut\n"
"use Fcntl;\n"

This means, the perl code is contained in the binary:

Linking CXX shared module CMakeFiles/CMakeRelink.dir/kio_fish.so
Install the project...
-- Install configuration: "Debugfull"
-- Installing: /usr/lib64/kde4/kio_fish.so
-- Up-to-date: /usr/share/kde4/services/fish.protocol
tweedleburg:~/svn/kdebase/runtime/kioslave/fish # strings /usr/lib64/kde4/kio_fi
kio_file.so    kio_filter.so  kio_finger.so  kio_fish.so
tweedleburg:~/svn/kdebase/runtime/kioslave/fish # strings /usr/lib64/kde4/kio_fish.so
[...]
#!/usr/bin/perl
=pod
This file was transferred by kio_fish, a network client part of the
KDE project. You may safely delete it, it will be transferred again
when needed. It's only purpose is to make kio_fish access faster and
more reliable.
=cut
use Fcntl;
$|++;
open(DEBUG,">/tmp/kio_fish.debug.$$.log");
if (defined $code) {
unlink('.fishsrv.pl');