Bug 89105

Summary: Could not upload the temporary file to the destination location
Product: [Applications] kompare Reporter: John T. Ellis <john.ellis>
Component: generalAssignee: Otto Bruggeman <bruggie>
Status: RESOLVED FIXED    
Severity: normal CC: matthew.herrmann
Priority: NOR    
Version: 3.3   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description John T. Ellis 2004-09-08 20:04:33 UTC
Version:           3.3 (using KDE 3.3.0, SuSE)
Compiler:          gcc version 3.3.3 (SuSE Linux)
OS:                Linux (i686) release 2.6.5-7.108-default

I'm comparing two directories:
Source: /home/username/hosted/web/
Dest: /home/username/hosted_sites/web/sp/

If I merge a difference from the source to destination file then attempt to save, I get the following error:

Could not upload the temporary file to the destination location <b>/home/username/hosted/web/</b>. The temporary file is still available under: <b>/tmp/kde-username/kompare4VWGia.tmp</b>. You can manually copy it to the right place.

If I attempt to compare two files in the same directory however (say /home/username/hosted/web/version1.html and /home/username/hosted/web/version2.html), I do not get this error.

Nothing is printed to stdout or stderr when I get the dialog.
Comment 1 John T. Ellis 2004-09-08 21:10:49 UTC
To narrow things down a bit more...

The bug happens when two directories are compared instead of two files. It appears that kompare is trying to save the file to the _directory_ being compared, not the _file_ being compared.

So if I use:
Source: /home/username/hosted/web/version.html
Dest: /home/username/hosted_sites/web/sp/version.html

things work. This kinda defeats kompare's nice file-iteration interface, of course.
Comment 2 John T. Ellis 2004-09-09 07:03:49 UTC
Getting even more specific (won't... sleep... until... fixed... <collapses>)

The bug is in komparemodellist.cpp line 362:
result = KIO::NetAccess::mkdir( KURL( destination ).path(), (QWidget*)parent() );

So if the directory already exists then things bomb. The best thing would be to detect the presence of the directory, then create it if it doesn't exist. Then bomb upon failure.

I tried to see if this is fixed in CVS, but ViewCVS for KDE seems to be busted.
Comment 3 Otto Bruggeman 2004-09-12 06:02:03 UTC
I screwed up on the commit message...

----------  Forwarded Message  ----------

Subject: kdesdk/kompare/libdiff2
Date: Saturday 11 September 2004 22:33
From: Otto Bruggeman <bruggie@home.nl>
To: kde-cvs@kde.org
Cc: 89015-done@bugs.kde.org

CVS commit by bruggie:

Test if the directory exists before trying to create it. This should fix bug
 89105. Can you test this version (i'll backport to the 3.3.x branch in a few
 minutes) ? CCMAIL: 89015-done@bugs.kde.org


  M +8 -4      komparemodellist.cpp   1.81


--- kdesdk/kompare/libdiff2/komparemodellist.cpp  #1.80:1.81
@@ -359,4 +359,7 @@ bool KompareModelList::saveDestination(
                 kdDebug(8101) << "Tempfilename   : " << temp->name() <<
 endl; kdDebug(8101) << "DestinationURL : " << destination << endl; +        
        KIO::UDSEntry entry;
+                if ( !KIO::NetAccess::stat( KURL( destination ).path(),
 entry, (QWidget*)parent() ) ) +                {
                 result = KIO::NetAccess::mkdir( KURL( destination ).path(),
 (QWidget*)parent() ); if ( !result )
@@ -365,4 +368,5 @@ bool KompareModelList::saveDestination(
                         return false;
                 }
+                }
                 result = KIO::NetAccess::upload( temp->name(), KURL(
 destination ), (QWidget*)parent() ); }

-------------------------------------------------------

Comment 4 John T. Ellis 2004-09-13 18:12:14 UTC
Looks good.
Comment 5 Matthew Herrmann 2006-02-10 01:01:10 UTC
I'm using Kompare 3.4.1 and I get this error using

svn diff | kompare -

There are diffs for 3 files, which are displayed correctly in the lower pane:
./Jamroot
./utility/constants.hpp
./dna/Jamfile

The source and destination folders are incorrectly displayed in the tree:

utility/Jamroot
utility/constants.hpp
utility/dna/Jamfile

I suspect that the bogus source/destination folder trees are used to write back instead of the separate mechanism that the lower pane is using to (correctly) read the full contents of the original files.

Hence, hitting save gives me "Could not upload the temporary file to the destination location".

As a troubleshooting note, it would be good for the error to indicate exactly where it is trying to write the file, since this has come back before.
Comment 6 Bill j. 2008-01-25 00:56:38 UTC
This issue also occurs under kdesvn 3.5.6 with Kompare 3.4.