31822fe501d11cd0e9409d31d322c37aa63d6341
braney
  Fri Feb 23 14:44:57 2018 -0800
changes in response to code review #20986

diff --git src/hg/lib/trackHub.c src/hg/lib/trackHub.c
index b0f2580..06ac8ef 100644
--- src/hg/lib/trackHub.c
+++ src/hg/lib/trackHub.c
@@ -350,31 +350,31 @@
 {
 char *str;
 if ((str = hashFindVal(hash, name)) == NULL) 
     errAbort("missing required setting '%s' for group on line %d in file %s\n",
 	name, lf->lineIx, lf->fileName);
 return str;
 }
 
 static struct grp *readGroupRa(char *groupFileName)
 /* Read in the ra file that describes the groups in an assembly hub. */
 {
 if (groupFileName == NULL)
     return NULL;
 struct hash *ra;
 struct grp *list = NULL;
-struct lineFile *lf = udcWrapShortLineFile(groupFileName, NULL, 16*1024*1024);
+struct lineFile *lf = udcWrapShortLineFile(groupFileName, NULL, MAX_HUB_GROUP_FILE_SIZE);
 while ((ra = raNextRecord(lf)) != NULL)
     {
     struct grp *grp;
     AllocVar(grp);
     slAddHead(&list, grp);
 
     grp->name = cloneString(getRequiredGrpSetting(ra, "name", lf));
     grp->label = cloneString(getRequiredGrpSetting(ra, "label", lf));
     grp->priority = atof(getRequiredGrpSetting(ra, "priority", lf));
     grp->defaultIsClosed = sqlUnsigned(getRequiredGrpSetting(ra,"defaultIsClosed",lf));
     hashFree(&ra);
     }
 if (list)
     slReverse(&list);
 lineFileClose(&lf);
@@ -474,31 +474,31 @@
 static int genomeOrderKeyCmp(const void *va, const void *vb)
 /* Compare to sort based on order key */
 {
 const struct trackHubGenome *a = *((struct trackHubGenome **)va);
 const struct trackHubGenome *b = *((struct trackHubGenome **)vb);
 
 if (b->orderKey > a->orderKey) return -1;
 else if (b->orderKey < a->orderKey) return 1;
 else return 0;
 }
 
 static struct trackHubGenome *trackHubGenomeReadRa(char *url, struct trackHub *hub, char *singleFile)
 /* Read in a genome.ra format url and return it as a list of trackHubGenomes. 
  * Also add it to hash, which is keyed by genome. */
 {
-struct lineFile *lf = udcWrapShortLineFile(url, NULL, 64*1024*1024);
+struct lineFile *lf = udcWrapShortLineFile(url, NULL, MAX_HUB_GENOME_FILE_SIZE);
 struct trackHubGenome *list = NULL, *el;
 struct hash *hash = hub->genomeHash;
 
 struct hash *ra;
 while ((ra = raNextRecord(lf)) != NULL)
     {
     // allow that trackDb+hub+genome is in one single file
     if (hashFindVal(ra, "hub"))
         continue;
     if (hashFindVal(ra, "track"))
         break;
 
     char *twoBitPath = hashFindVal(ra, "twoBitPath");
     char *genome, *trackDb;
     if (twoBitPath != NULL)
@@ -603,31 +603,31 @@
 if ( trackHubHash == NULL)
     return;
 
 hashMustRemove(trackHubHash, hub->name);
 }
 
 struct trackHub *trackHubOpen(char *url, char *hubName)
 /* Open up a track hub from url.  Reads and parses hub.txt and the genomesFile. 
  * The hubName is generally just the asciified ID number. */
 {
 struct trackHub *hub = grabHashedHub(hubName);
 
 if (hub != NULL)
     return hub;
 
-struct lineFile *lf = udcWrapShortLineFile(url, NULL, 16*1024*1024);
+struct lineFile *lf = udcWrapShortLineFile(url, NULL, MAX_HUB_TRACKDB_FILE_SIZE);
 struct hash *hubRa = raNextRecord(lf);
 if (hubRa == NULL)
     errAbort("empty %s in trackHubOpen", url);
 // no errAbort when more records in hub.txt file: user can stuff
 // trackDb into it
 
 /* Allocate hub and fill in settings field and url. */
 AllocVar(hub);
 hub->url = cloneString(url);
 hub->name = cloneString(hubName);
 hub->settings = hubRa;
 
 /* Fill in required fields from settings. */
 trackHubRequiredSetting(hub, "hub");
 trackHubRequiredSetting(hub, "email");
@@ -900,31 +900,31 @@
 struct trackDb *tdb;
 for (tdb = tdbList; tdb != NULL; tdb = tdb->next)
     {
     validateOneTrack(hub, genome, tdb);
 
     // clear these two pointers which we set in markContainers
     tdb->subtracks = NULL;
     tdb->parent = NULL;
     }
 }
 
 struct trackDb *trackHubTracksForGenome(struct trackHub *hub, struct trackHubGenome *genome)
 /* Get list of tracks associated with genome.  Check that it only is composed of legal
  * types.  Do a few other quick checks to catch errors early. */
 {
-struct lineFile *lf = udcWrapShortLineFile(genome->trackDbFile, NULL, 64*1024*1024);
+struct lineFile *lf = udcWrapShortLineFile(genome->trackDbFile, NULL, MAX_HUB_TRACKDB_FILE_SIZE);
 struct trackDb *tdbList = trackDbFromOpenRa(lf, NULL);
 lineFileClose(&lf);
 
 char *tabMetaName = hashFindVal(genome->settingsHash, "metaTab");
 char *absTabName  = NULL;
 if (tabMetaName)
     absTabName  = trackHubRelativeUrl(hub->url, tabMetaName);
 
 char *tagStormName = hashFindVal(genome->settingsHash, "metaDb");
 char *absStormName  = NULL;
 if (tagStormName)
     absStormName  = trackHubRelativeUrl(hub->url, tagStormName);
 
 /* Make bigDataUrls more absolute rather than relative to genome.ra dir */
 struct trackDb *tdb;