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/utils/hubCheck/tests/makefile src/hg/utils/hubCheck/tests/makefile
index 44f71e8a224..3b125708415 100644
--- src/hg/utils/hubCheck/tests/makefile
+++ src/hg/utils/hubCheck/tests/makefile
@@ -1,84 +1,93 @@
 kentSrc = ../../../..
 include ../../../../inc/common.mk
 
 hubCheck = ${DESTBINDIR}/hubCheck
 
-test:: one two errors supertrackChild genomesErrors badType badSubgroups autoScale noLongLabel badGroups goodGroups noCompositeGroup allowWarnings seqNameCheck noSeqNameCheck selfParent dotInName fieldCountMismatch
+test:: one two errors supertrackChild genomesErrors badType badSubgroups autoScale noLongLabel badGroups goodGroups noCompositeGroup allowWarnings seqNameCheck noSeqNameCheck selfParent dotInName fieldCountMismatch relPath
 
 one:	mkout
 	-${hubCheck} input/hub1.txt > output/output1.txt
 	diff expected/output1.txt output/output1.txt
 
 two:	mkout
 	-${hubCheck} input/hub2.txt > output/output2.txt 2> /dev/null
 	diff expected/output2.txt output/output2.txt
 
 supertrackChild: mkout
 	-${hubCheck} input/supertrackChild.txt > output/supertrackChild.txt 2> /dev/null
 	diff expected/supertrackChild.txt output/supertrackChild.txt
 
 errors:	mkout
 	-${hubCheck} input/manyErrorsHub.txt > output/manyErrors.output.txt 2>/dev/null
 	diff expected/manyErrors.output.txt output/manyErrors.output.txt
 
 genomesErrors: mkout
 	-${hubCheck} input/genomesConfigErrorsHub.txt > output/genomesConfigErrors.output.txt 2>/dev/null
 	diff expected/genomesConfigErrors.output.txt output/genomesConfigErrors.output.txt
 
 badType: mkout
 	-${hubCheck} input/badType.txt > output/badType.output.txt 2>/dev/null
 	diff expected/badType.output.txt output/badType.output.txt
 
 badSubgroups: mkout
 	-${hubCheck} input/badSubGroups.txt > output/badSubGroups.output.txt 2>/dev/null
 	diff expected/badSubGroups.output.txt output/badSubGroups.output.txt
 
 autoScale: mkout
 	-${hubCheck} input/autoScaleHub.txt > output/autoScaleHub.output.txt 2>/dev/null
 	diff expected/autoScaleHub.txt output/autoScaleHub.output.txt
 
 noLongLabel:	mkout
 	-${hubCheck} input/noLongLabel.txt > output/noLongLabel.txt
 	diff expected/noLongLabel.txt output/noLongLabel.txt
 
 badGroups: mkout
 	-${hubCheck} input/badGroups.txt > output/badGroups.output.txt 2>/dev/null
 	diff expected/badGroups.output.txt output/badGroups.output.txt
 
 goodGroups: mkout
 	-${hubCheck} input/goodGroups.txt > output/goodGroups.output.txt
 	diff expected/goodGroups.output.txt output/goodGroups.output.txt
 
 noCompositeGroup: mkout
 	-${hubCheck} input/noCompositeGroup.txt > output/noCompositeGroup.output.txt 2>/dev/null
 	diff expected/noCompositeGroup.output.txt output/noCompositeGroup.output.txt
 
 allowWarnings: mkout
 	${hubCheck} -allowWarnings input/supertrackChild.txt > output/allowWarnings.output.txt 2> /dev/null
 	diff expected/allowWarnings.output.txt output/allowWarnings.output.txt
 
 seqNameCheck: mkout
 	-${hubCheck} input/seqNameHub.txt > output/seqNameCheck.output.txt 2>/dev/null
 	diff expected/seqNameCheck.output.txt output/seqNameCheck.output.txt
 
 noSeqNameCheck: mkout
 	-${hubCheck} -noSeqNameCheck input/seqNameHub.txt > output/noSeqNameCheck.output.txt 2>/dev/null
 	diff expected/noSeqNameCheck.output.txt output/noSeqNameCheck.output.txt
 
 selfParent: mkout
 	-${hubCheck} input/selfParent.txt > output/selfParent.output.txt 2>/dev/null
 	diff expected/selfParent.output.txt output/selfParent.output.txt
 
 dotInName: mkout
 	-${hubCheck} input/dotInName.txt > output/dotInName.output.txt 2>/dev/null
 	diff expected/dotInName.output.txt output/dotInName.output.txt
 
 fieldCountMismatch: mkout
 	-cd input && ${hubCheck} fieldCountMismatch.txt > ../output/fieldCountMismatch.output.txt 2>/dev/null
 	diff expected/fieldCountMismatch.output.txt output/fieldCountMismatch.output.txt
 
+# A hub reached by a relative path, with its data file in a subdirectory below
+# hub.txt. Deliberately NOT run from inside input/, because the point is to check
+# that the hub directory is prepended to bigDataUrl once and not twice. The
+# expected output is a field count mismatch, which hubCheck can only report if it
+# found and opened the file.
+relPath: mkout
+	-${hubCheck} input/relPath/hub.txt > output/relPath.output.txt 2>/dev/null
+	diff expected/relPath.output.txt output/relPath.output.txt
+
 mkout::
 	@mkdir -p output
 clean::
 	rm -rf output