bf60df82401b1c11eb4cc0d9f67e76a0f0749849 max Fri Sep 4 12:02:30 2026 -0700 hubCheck: stop resolving bigDataUrl a second time, refs #38256 trackHubTracksForGenome() already runs expandBigDataUrl() over every stanza, which rewrites bigDataUrl and bigDataIndex in the settings hash so they are no longer relative to the trackDb file. hubCheckBigDataUrl() then resolved them again against genome->trackDbFile, which prepended the hub's directory a second time. For a local hub reached by a relative path that turned a file which is present into a file which is reported missing: hubCheck out/hub.txt Couldn't open out/out/hg19/x.bb Remote hubs and local hubs given by an absolute path were unaffected, because the second resolution is a no-op once the path is a URL or already absolute, which is why this went unnoticed. The tests/makefile has been working around it: the fieldCountMismatch case has to cd into input/ before it can find its bigBed. Added a tests/ case that does not cd, with the data file in a subdirectory below hub.txt, the shape 'hubtools import session' now writes. Its bigBed is deliberately declared 'type bigBed 9' when it holds 6 fields, because hubCheck can only report that mismatch if it really opened the file. Before this change the test reported "Couldn't open input/relPath/input/relPath/data/test6field.bb". Verified against a binary built from the unmodified tree: this changes the output of no other test in hubCheck/tests. Seven of those tests were already failing before this commit and still are. diff --git src/hg/lib/trackHub.c src/hg/lib/trackHub.c index ca08288f003..ba379532c57 100644 --- src/hg/lib/trackHub.c +++ src/hg/lib/trackHub.c @@ -1484,40 +1484,40 @@ } boolean trackHubGetBlatParams(char *database, boolean isTrans, char **pHost, char **pPort, char **pGenomeDataDir) { char *type = isTrans ? "transBlat" : "blat"; char *setting = trackHubAssemblyField(database, type); if (setting == NULL) return FALSE; parseBlatPcrParams(database, type, setting, pHost, pPort, pGenomeDataDir); return TRUE; } void hubCheckBigDataUrl(struct trackHub *hub, struct trackHubGenome *genome, struct trackDb *tdb) /* Check remote file exists and is of correct type. Wrap this in error catcher */ { -char *relativeUrl = trackDbSetting(tdb, "bigDataUrl"); -if (relativeUrl != NULL) +/* trackHubTracksForGenome() has already run expandBigDataUrl() on this tdb, so + * bigDataUrl and bigDataIndex are no longer relative to genome->trackDbFile and must + * be used as they are. Resolving them a second time here prepended the hub directory + * twice whenever a local hub was reached by a relative path, so that + * "hubCheck out/hub.txt" looked for out/out/hg19/x.bb and reported it missing. */ +char *bigDataUrl = trackDbSetting(tdb, "bigDataUrl"); +if (bigDataUrl != NULL) { char *type = trackDbRequiredSetting(tdb, "type"); - char *bigDataUrl = trackHubRelativeUrl(genome->trackDbFile, relativeUrl); - - char *bigDataIndex = NULL; - char *relIdxUrl = trackDbSetting(tdb, "bigDataIndex"); - if (relIdxUrl != NULL) - bigDataIndex = trackHubRelativeUrl(genome->trackDbFile, relIdxUrl); + char *bigDataIndex = trackDbSetting(tdb, "bigDataIndex"); verbose(2, "checking %s.%s type %s at %s\n", genome->name, tdb->track, type, bigDataUrl); if (startsWithWord("bigWig", type)) { /* Just open and close to verify file exists and is correct type. */ struct bbiFile *bbi = bigWigFileOpen(bigDataUrl); bbiFileClose(&bbi); } else if (startsWithWord("bigNarrowPeak", type) || startsWithWord("bigBed", type) || startsWithWord("bigGenePred", type) || startsWithWord("bigPsl", type)|| startsWithWord("bigChain", type)|| startsWithWord("bigMaf", type) || startsWithWord("bigBarChart", type) || startsWithWord("bigInteract", type) || startsWithWord("bigLolly", type) || startsWithWord("bigRmsk",type) || startsWithWord("bigMethyl", type)) { @@ -1569,31 +1569,30 @@ if (halClose(handle, &errString) < 0) errAbort("HAL close error: %s", errString); #else warn("Note: can not check track %s, validation of halSnake tracks not compiled into this copy of hubCheck", trackHubSkipHubName(tdb->track)); #endif } else if (startsWithWord("hic", type)) { struct hicMeta *header; char *errString = hicLoadHeader(bigDataUrl, &header, genome->name); if (errString != NULL) errAbort("hic file error: %s", errString); } else errAbort("unrecognized type %s in genome %s track %s", type, genome->name, tdb->track); - freez(&bigDataUrl); } } static void outHubHeader(struct dyString *dy, char *db) // output a track hub header { dyStringPrintf(dy,"hub quickLiftHub%s\n\ shortLabel QuickLift from %s\n\ longLabel QuickLift from %s\n\ useOneFile on\n\ email genome-www@soe.ucsc.edu\n\n", db, db, db); dyStringPrintf(dy,"genome %s\n\n", db); } static char *getHubName(struct cart *cart, char *db)