36571a13121e1edcd7f193ec7e02e76d146b9ba0
max
  Fri Oct 3 08:37:19 2014 -0700
fixing gbib bug due to rsync 3.1, refs #14091
diff --git src/hg/lib/fileUi.c src/hg/lib/fileUi.c
index a45a773..60d5ff7 100644
--- src/hg/lib/fileUi.c
+++ src/hg/lib/fileUi.c
@@ -97,30 +97,42 @@
 
 FILE *fd = NULL;
 if ((fd = fopen(buFile.forCgi, "w")) != NULL)
     {
     struct fileDb *oneFile = fileList;
     for (;oneFile != NULL;oneFile=oneFile->next)
         {
         char buf[1024];
         safef(buf,sizeof buf,"%s %ld %s\n",oneFile->fileName,oneFile->fileSize,oneFile->fileDate);
         fwrite(buf, strlen(buf), 1, fd);
         }
     fclose(fd);
     }
 }
 
+void removeChar(char* str, char c) {
+    /* removes all occurences of a character in a string, in place (libify?) */
+    char *pFrom = str;
+    char *pTo = str;
+    while (*pFrom!='\0') {
+        *pTo = *pFrom;
+        pFrom++;
+        if (*pTo != c)
+            pTo++;
+    }
+    *pTo = '\0';
+}
 struct fileDb *fileDbGet(char *db, char *dir, char *subDir, char *fileName)
 // Returns NULL or if found a fileDb struct with name, size and date filled in.
 {
 static char *savedDb     = NULL;
 static char *savedDir    = NULL;
 static char *savedSubDir = NULL;
 static struct fileDb *foundFiles = NULL;// Use static list to save excess IO
 struct fileDb *oneFile = NULL;
 if (foundFiles == NULL
 ||  savedDb  == NULL    || differentString(savedDb, db)
 ||  savedDir == NULL    || differentString(savedDir,dir)
 ||  savedSubDir == NULL || differentString(savedSubDir,subDir))
     {
     // free up any static mem
     freeMem(savedDb);
@@ -150,31 +162,34 @@
             }
         else
             safef(cmd,sizeof(cmd),"rsync -n rsync://%s/goldenPath/%s/%s/%s/",
                   server, db, dir, subDir);
 
         scriptOutput = popen(cmd, "r");
         while (fgets(buf, sizeof(buf), scriptOutput))
             {
             eraseTrailingSpaces(buf);
             if (!endsWith(buf,".md5sum")) // Just ignore these
                 {
                 int count = chopLine(buf, words);
                 if (count == 5)
                     {
                     //-rw-rw-r-- 26420982 2009/09/29 14:53:30 wgEncodeBroadChipSeq/wgEncode...
+                    // rsync 3.1 adds commas:
+                    //-rw-rw-r-- 26,420,982 2009/09/29 14:53:30 wgEncodeBroadChipSeq/wgEncode...
                     AllocVar(oneFile);
+                    removeChar(words[1], ',');
                     oneFile->fileSize = sqlUnsignedLong(words[1]);
                     oneFile->fileDate = cloneString(words[2]);
                     strSwapChar(oneFile->fileDate,'/','-');// Standardize YYYY-MM-DD, no time
                     oneFile->fileName = cloneString(words[4]);
                     slAddHead(&foundFiles,oneFile);
                     }
                 }
             }
         pclose(scriptOutput);
         if (foundFiles == NULL)
             {
             foundFiles = fileDbReadFromBackup(db, dir, subDir);
             if (foundFiles == NULL)
                 {
                 AllocVar(oneFile);