Bug 107335 - temporary file from sftp connection is deleted when kate is started from konqueror
Summary: temporary file from sftp connection is deleted when kate is started from konq...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-13 16:43 UTC by Christoph Burger-Scheidlin
Modified: 2005-06-21 22:09 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Burger-Scheidlin 2005-06-13 16:43:25 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    Gentoo Packages
Compiler:          g++ (GCC) 3.3.5-20050130 (Gentoo Linux 3.3.5.20050130-r1, ssp-3.3.5.20050130-1,pie-8.7.7.1)
OS:                Linux

After opening a file from an sftp connection in konqueror, kate complains that "The file 'file:/var/tmp/kdecache-cbs/krun/11404.0.test.aux' was changed (deleted) on disk by another program!". Checking /var/tmp/kdecache-cbs/krun, the file is indeed gone. Changes to the file (saving in kate) are not uploaded to the remote location. This behaviour does not occur when opening the file in kword or kwrite. Neither does it occur, when opening the file directly with kate.

Steps to reproduce:
Open sftp connection in Konqueror
Open any file to edit with kate
Refocus or close kate window

Expected behavior:
File is deleted once kate exits and changes are uploaded.
Comment 1 Christoph Burger-Scheidlin 2005-06-13 17:17:30 UTC
I am not so sure that this is kio related any longer. I edited the File association in the command center to replace "kate" with "kate %u" as the executable. Now opening by clicking and by "open with" works.

The only reason of this strange behavior that I can think of is that kate detaches itself when executed. If no file association is set in KDE then konqueror downloads the file and executes the program, waits for it to finish and then prompts the user, if the file should be uploaded (if it has changed). This works nicely for kword and kwrite, but for kate, control is returned immediately to konqueror. Since the file has not changed, it gets deleted and kate is stuck without connection, not knowing where the file originally came from. If konqueror passes the entire url to kate, kate knows what to do with the temporary file and when, so the problem no longer exists (and one also does not get the "file has changed" dialog when using kwrite).
Comment 2 Dik Takken 2005-06-14 11:34:00 UTC
"kate %u" in the desktop file of Kate tells Konqueror that Kate understands KIO URL's and can edit files directly via sftp.

In the default desktop file of Kate does not contain

exec="kate %u"

this should be fixed. This can differ from distro to distro, but on my Gentoo install the desktop file is correct.

So, my guess is that you simply broke your desktop file. Reassigning to Kate anyway.
Comment 3 Christoph Burger-Scheidlin 2005-06-14 11:46:42 UTC
I am not sure if it is a problem with kate at all and if it should not be reassigned to konqueror. It is very liekly that my desktop file broke, since I remember using konqueror/kate successfully earlier.

In konqueror the problem remains, that for applications that detach, like kate does, remote connections do not work correctly. Take OpenOffice as an example. It cannot use KIO URLs AFAIK, but works nicely with konqueror, konqueror downloading the file and prompting for upload when oocalc exits. Suppose oocalc would detach like kate does, then konqueror would delete the file like in my example, without the user having the possibility to upload the changes.
Comment 4 Christoph Burger-Scheidlin 2005-06-21 17:32:28 UTC
Apparently, my desktop file breaks, when I add a new association for kate. In the filetypes, "kate %U" is replaced by "kate", leading to the behaviour outlined above. I filed this as bug 107860 for kcmfiletypes.

As far as I can tell, this is not a problem of kate. Should this maybe reassigned to konqueror (see comment 3)?
Comment 5 David Faure 2005-06-21 22:09:44 UTC
SVN commit 427780 by dfaure:

Keep the full Exec line from the existing service, when checking "remember application association for this type of file".
BUG:107860
BUG:107335


 M  +6 -3      kopenwith.cpp  


--- branches/KDE/3.4/kdelibs/kio/kfile/kopenwith.cpp #427779:427780
@@ -624,7 +624,8 @@
 
 void KOpenWithDlg::slotOK()
 {
-  QString fullExec(edit->url());
+  QString typedExec(edit->url());
+  QString fullExec(typedExec);
 
   QString serviceName;
   QString initialServiceName;
@@ -634,7 +635,7 @@
     // No service selected - check the command line
 
     // Find out the name of the service from the command line, removing args and paths
-    serviceName = KRun::binaryName( fullExec, true );
+    serviceName = KRun::binaryName( typedExec, true );
     if (serviceName.isEmpty())
     {
       // TODO add a KMessageBox::error here after the end of the message freeze
@@ -653,6 +654,7 @@
         if ( serv && serv->type() == "Application")
         {
             QString exec = serv->exec();
+            fullExec = exec;
             exec.replace("%u", "", false);
             exec.replace("%f", "", false);
             exec.replace("-caption %c", "");
@@ -660,7 +662,7 @@
             exec.replace("%i", "");
             exec.replace("%m", "");
             exec = exec.simplifyWhiteSpace();
-            if (exec == fullExec)
+            if (exec == typedExec)
             {
                 ok = true;
                 m_pService = serv;
@@ -680,6 +682,7 @@
     // Existing service selected
     serviceName = m_pService->name();
     initialServiceName = serviceName;
+    fullExec = m_pService->exec();
   }
 
   if (terminal->isChecked())