NFS race bug patch for kdevelop
Nils Ulltveit-Moe
Nils.Ulltveit-Moe at hia.no
Thu Jan 13 15:13:32 UTC 2000
Hello
I tried installing Kdevelop-1.0 on diskless workstations, and
discovered a strange bug that caused kdevelop to hang or generate
faulty new projects when the home directory was NFS mounted. The fault
did not occur on local harddisk.
The bug was caused by files that was opened, modified, and then not
closed. The kflushd made the changes visible soon enough on local
harddisk, but the results were never flushed on NFS mounted disks.
There was also a bug in processes.pl. Some template files was not
updated as they should be. (I do not know exactly why..) The fix
involved avoiding the temporary file newfile.txt, and instead store
the temporary data in an internal list since the changes in
this file disappeared in the NFS filesystem. (Do not ask me why..)
Best regards,
Nils Ulltveit-Moe
Assistant Professor
Agder University College
diff -u --recursive kdevelop-1.0/kdevelop/ckappwizard.cpp kdevelop-1.0-hia/kdevelop/ckappwizard.cpp
--- kdevelop-1.0/kdevelop/ckappwizard.cpp Fri Dec 3 21:08:04 1999
+++ kdevelop-1.0-hia/kdevelop/ckappwizard.cpp Thu Jan 13 12:56:54 2000
@@ -1155,6 +1155,7 @@
entries << "LOGMESSAGE\n";
entries << QString(messageline->text()) + "\n";
+ entries.close();
namelow = nameline->text();
namelow = namelow.lower();
diff -u --recursive kdevelop-1.0/kdevelop/cproject.cpp kdevelop-1.0-hia/kdevelop/cproject.cpp
--- kdevelop-1.0/kdevelop/cproject.cpp Sat Nov 13 16:03:20 1999
+++ kdevelop-1.0-hia/kdevelop/cproject.cpp Thu Jan 13 14:20:02 2000
@@ -60,7 +60,7 @@
if(str.contains( PROJECT_VERSION_STR ) ){
return false;
}
-
+ qfile.close();
QFileInfo fileinfo(prjfile);
dir = fileinfo.dirPath() + "/";
setSourcesHeaders();
@@ -924,6 +924,7 @@
for(str = list.first();str != 0;str = list.next()){
stream << str + "\n";
}
+ file.close();
}
}
@@ -1016,7 +1017,7 @@
stream << str + "\n";
}
}
-
+ file.close();
}
void CProject::writeWorkspace(TWorkspace ws){
Only in kdevelop-1.0-hia/kdevelop/tools: processes.pl
diff -u --recursive kdevelop-1.0/kdevelop/tools/processes.pl.in kdevelop-1.0-hia/kdevelop/tools/processes.pl.in
--- kdevelop-1.0/kdevelop/tools/processes.pl.in Wed Sep 15 17:03:19 1999
+++ kdevelop-1.0-hia/kdevelop/tools/processes.pl.in Thu Jan 13 14:54:35 2000
@@ -137,15 +137,14 @@
my $wordlength = 0;
my $word = "";
my $replace = "";
- my $newfile = $overDirectory . "/newfile.txt";
- open (INPUT,$oldfile) || die "cannot open file: $oldfile";
- open (OUTPUT,">$newfile");
+ open (INPUT,"<$oldfile") || die "cannot open file: $oldfile";
# setup filename replacement...
$hashref->{"|FILENAME|"}=$oldfile;
$hashref->{"|FILENAME|"}=$newfilename if ($newfilename);
-
+ my @lines;
+ my $i=0;
while ( defined ($line = <INPUT> ))
{
# scan the hash
@@ -167,14 +166,14 @@
}
}
}
-
- print OUTPUT $line;
+ $lines[$i++]=$line;
}
close (INPUT);
+ open (OUTPUT,">$oldfile") || die "cannot open file: $oldfile";
+ foreach $line (@lines) {
+ print OUTPUT $line;
+ }
close (OUTPUT);
- unlink ($oldfile);
- rename ($newfile,$oldfile);
- unlink ($newfile);
}
More information about the KDevelop-devel
mailing list