a213081a5106754b3f3ec4899c7b54ce3b6352f1
hiram
  Wed Jul 29 16:01:33 2026 -0700
claude fixing claude errors refs #37958

diff --git src/hg/utils/automation/doNcbiGene.pl src/hg/utils/automation/doNcbiGene.pl
index 4484f38bdf7..cbeda8e064e 100755
--- src/hg/utils/automation/doNcbiGene.pl
+++ src/hg/utils/automation/doNcbiGene.pl
@@ -234,31 +234,38 @@
 sub doNcbiGene {
   my $gffFile = "$assemblySource/${asmId}_genomic.gff.gz";
   if ( ! -s "${gffFile}" ) {
     &HgAutomate::verbose(1, "# step ncbiGene: no gff file found at:\n#  $gffFile\n");
     return;
   }
   if ( ! needsUpdate($gffFile, "$buildDir/$db.ncbiGene.bb") ) {
     &HgAutomate::verbose(1, "# ncbiGene step previously completed\n");
     return;
   }
   &HgAutomate::mustMkdir($buildDir);
 
   archivePriorVersion();
 
   my $whatItDoes = "translate NCBI GFF3 gene definitions into a track";
-  my $bossScript = newBash HgRemoteScript("$buildDir/doNcbiGene.bash",
+  # NOTE: must not be named doNcbiGene.bash -- doAssemblyHub.pl's own
+  # wrapper script that invokes this program is *already* named
+  # $buildDir/doNcbiGene.bash and is still running (mid-ssh-exec) at the
+  # moment this line runs.  Reusing that filename here truncates and
+  # rewrites the file the outer shell is still reading, corrupting its
+  # read position and producing a bogus "syntax error" once the outer
+  # shell resumes -- after the real work below has already succeeded.
+  my $bossScript = newBash HgRemoteScript("$buildDir/buildNcbiGene.bash",
                     $workhorse, $buildDir, $whatItDoes);
 
   my $dupList = "";
   # this list is curated by hand into the build's own download/ area,
   # not something NCBI supplies in $assemblySource
   if ( -s "${buildDir}/../../download/${asmId}.remove.dups.list" ) {
     $dupList = " | (grep -v -f \"${buildDir}/../../download/${asmId}.remove.dups.list\"  || true)";
   }
 
   $bossScript->add(<<_EOF_
 export asmId=$db
 export gffFile=$gffFile
 export chromSizes=$chromSizes
 
 function cleanUp() {