View Ticket
Not logged in
Ticket UUID: b733bba0b7319ef2dc9d74526dab7eec29460fcd
Title: Fossil crash when doing addremove/add/extras
Status: Fixed Type: Code_Defect
Severity: Important Priority:
Subsystem: Resolution: Fixed
Last Modified: 2011-05-06 13:13:45
Version Found In: [b951baa5c9] 2011-05-02 14:37:40 UTC
Description & Comments:
Fossil crashes when performing commands that involves checking new files (extras, addremove, add) within a checkout of a recently-rebuilt repo. This is on Windows 7 Ultimate x64.

If I use the last release ([047e06193b] 2011-04-13 12:05:18) I experience no issues.


anonymous claiming to be Ingo Koch added on 2011-05-05 21:08:24 UTC:
The bug was introduced with version [53aef2dee1] in

int vfile_top_of_checkout(const char *zPath)

The mprintf is called without zPath. I added some debug output and saw that the first zFile contains a valid path but the second one contained garbage.

I don't know why it works for the first call, but the second crashes fossil under Windows.

Here is a correction:

Index: src/vfile.c
===================================================================
--- src/vfile.c
+++ src/vfile.c
@@ -301,15 +301,15 @@
 */
 int vfile_top_of_checkout(const char *zPath){
   char *zFile;
   int fileFound = 0;
 
-  zFile = mprintf("%s/_FOSSIL_");
+  zFile = mprintf("%s/_FOSSIL_",zPath);
   fileFound = file_size(zFile)>=1024;
   fossil_free(zFile);
   if( !fileFound ){
-    zFile = mprintf("%s/.fos");
+    zFile = mprintf("%s/.fos",zPath);
     fileFound = file_size(zFile)>=1024;
     fossil_free(zFile);
   }
   return fileFound;
 }