[tex4ht] what would cause " Can't close file `index.tmp' (file is not open)" --- error --- Illegal storage address

Karl Berry karl at freefriends.org
Sun Jul 1 00:43:05 CEST 2018

Hi Nasser and all,

    >      --- warning --- Can't close file `index.tmp' (file is not open)

Fixing this so the program can go on is easy enough; patch below (and
committed: tex4ht r417 and TL r48117). Clearly this case never came up
before, since it was dereferencing null pointers all over the place.

Discerning why the file is already closed at that point would
be a lot more work, and I didn't try.

If it is not easy for you to recompile from the TL sources, and you'd
like a new binary with this change, please remind me what platform
you're working on nowadays? --thanks for the report, karl.

--- tex4ht-c.tex	(revision 416)
+++ tex4ht-c.tex	(working copy)
@@ -4430,12 +4430,14 @@
 \<close tex4ht file\><<<
 if( p == (struct files_rec *)  0 ) bad_special( name );
+else { /* if p is null, do nothing more */
 `<fix pointers around file to be closed`>
 if( opened_files !=  (struct files_rec*) 0 )
   { if( out_file == p->file )  out_file = opened_files->file; }
 else out_file = (FILE *) 0;
 (IGNORED) fclose( p->file );   free((void *)  p->name );   
 free((void *) p );

More information about the tex4ht mailing list