8aaedd5ea97c078e37e7634eea3dc996ff8528d9
galt
  Fri Apr 5 23:13:26 2019 -0700
allowing exception for meta.txt, which is usually only directly used with maniSummary.txt, so that it will not try to remove an old symlink and create a new one when meta.txt will have NO symlinks.

diff --git src/hg/cirm/cdw/cdwMakeValidFile/cdwMakeValidFile.c src/hg/cirm/cdw/cdwMakeValidFile/cdwMakeValidFile.c
index 8a46a04..eb9dd5f 100644
--- src/hg/cirm/cdw/cdwMakeValidFile/cdwMakeValidFile.c
+++ src/hg/cirm/cdw/cdwMakeValidFile/cdwMakeValidFile.c
@@ -938,44 +938,58 @@
     dyStringAppend(newName, suffix);
 
     /* Now build full path names and attempt rename in file system. */
     char oldPath[PATH_LEN], newPath[PATH_LEN];
     safef(oldPath, sizeof(oldPath), "%s%s", cdwRootDir, fileName);
     safef(newPath, sizeof(newPath), "%s%s", cdwRootDir, newName->string);
 
     char query[PATH_LEN+256];
 
     // rename symlink to it in submitDir
     sqlSafef(query, sizeof(query), "select url from cdwSubmitDir where id='%d'", ef->submitDirId);
     char *submitDir = sqlQuickString(conn, query);
     if (!submitDir)
 	errAbort("submitDir not found for id %d", ef->submitDirId);
 
-    char *lastPath = findSubmitSymlink(ef->submitFileName, submitDir, oldPath);
+
+    boolean metaException = sameString(ef->submitFileName, "meta.txt");
+    // if meta.txt is being expliictly submitted, this is probably for dataset page meta links.
+    // this makes it an odd exception, because unlike normally submitted files,
+    // this will NOT be converted to a symlink pointing to the cdw/ dir file
+    // during the original cdwSubmit.
+
+    char *lastPath = NULL;
+    if (!metaException)
+	{
+	lastPath = findSubmitSymlink(ef->submitFileName, submitDir, oldPath);
 	freeMem(submitDir);
 	if (!lastPath)
 	    noWarnAbort();
 
 	verbose(3, "lastPath=%s newPath=%s\n", lastPath, newPath);
 	if (unlink(lastPath) == -1)  // drop about to be invalid symlink
 	    errnoAbort("unlink failure %s", lastPath);
+	}
 
     mustRename(oldPath, newPath);
 
+    if (!metaException)
+	{
 	if (symlink(newPath, lastPath) == -1)  // replace with symlink
 	    errnoAbort("symlink failure from %s to %s", lastPath, newPath);
 	freeMem(lastPath);
+	}
 
     verbose(2, "Renamed %s to %s\n", oldPath, newPath);
 
     /* Update database with new name */
     sqlSafef(query, sizeof(query), "update cdwFile set cdwFileName='%s' where id=%lld",
 	newName->string, (long long)ef->id);
     sqlUpdate(conn, query);
 
     dyStringFree(&newName);
 
     /* Update validFile record with license plate. */
     sqlSafef(query, sizeof(query), "update cdwValidFile set licensePlate='%s' where id=%lld", 
 	vf->licensePlate, (long long)vf->id);
     sqlUpdate(conn, query);
     }