Okay, many thanks for that diagnosis Wolfgang - it was very helpful.

I've applied Wolfgang's fix and added a "uniq" hack onto the temporary
files function, hopefully this will sort it finally.  I've tested with
two files, file + CVS, CVS + CVS and it all looks like it works now.

I had to simplify the temp file cleanup handling to stop any files
being left behind.

I've attached the patch which you can apply like this:

cd /usr/bin
cp tkdiff /tmp      # just in case
patch < /tmp/tkdiff.diff

Alternatively I'll be dropping you a private email with the new .deb
in it ("dpkg -i tkdiff*.deb" to apply).

If you could confirm that this fixes it for you that'd be great.  I'll
hang off uploading the fix for a couple of days.

Thanks once again for your help and patience.

Not so many thanks to Eclipse internet for leaving me without internet
access for about 28 hours :-(

Adrian
--- tkdiff.orig 2005-11-23 20:06:57.000000000 +0000
+++ tkdiff      2005-11-23 20:30:04.000000000 +0000
@@ -450,18 +450,21 @@
 ###############################################################################
 # Create a temporary file and return its name
 ###############################################################################
-
+set uniq 0
 proc tmpfile {n} {
-    global opts
+    global g opts
+    global uniq
+    set uniq [expr ($uniq + 1) ]
     set tmpdir [file nativename $opts(tmpdir)]
-    set tmpfile [file join $tmpdir "[pid]-$n"]
+    set tmpfile [file join $tmpdir "[pid]-$n-$uniq"]
     set access [list RDWR CREAT EXCL TRUNC]
     set perm 0600
     if {[catch {open $tmpfile $access $perm} fid ]} {
             # something went wrong
-            error "Failed creating temporary file: $errorCode"
+            error "Failed creating temporary file: $fid"
     }
     close $fid
+    lappend g(tempfiles) $tmpfile
     return $tmpfile
 }
 
@@ -746,9 +749,7 @@
         fatal-error "Couldn't open file '$name'."
     }
     set first [open $temp1 w]
-    lappend g(tempfiles) $temp1
     set second [open $temp2 w]
-    lappend g(tempfiles) $temp2
 
     set firstname ""
     set secondname ""
@@ -6359,14 +6360,8 @@
 ###############################################################################
 
 proc del-tmp {} {
-    global g finfo
+    global g
 
-    if {$finfo(tmp,1)} {
-        file delete $finfo(pth,1)
-    }
-    if {$finfo(tmp,2)} {
-        file delete $finfo(pth,2)
-    }
     foreach f $g(tempfiles) {
         file delete $f
     }

Reply via email to