[lltx] filecontents fails with ualatex

Heiko Oberdiek heiko.oberdiek at googlemail.com
Thu Oct 6 16:47:28 CEST 2011

On Thu, Oct 06, 2011 at 03:24:13PM +0200, Ulrike Fischer wrote:

> Well overwriting an existing file is in itself not a problem. E.g.
> there is no problem with aux or toc files. It looks more like a
> timing problem. If I remove the inputcheck from filecontents
>   \openin\@inputcheck#1 %
>   \ifeof\@inputcheck%
>     \@latex at warning@no at line%
>         {Writing file `\@currdir#1'}%
>   \else %
>     \@latex at warning@no at line%
>         {Overwriting file `\@currdir#1'}%
>   \fi %
> it works without problem.  

Package filecontents has the bug that it does not close
the file after the input check with \openin.

This issue is fixed in the LaTeX kernel version of
the environment `filecontents':

% \changes{v1.0m}{1995/04/21}
%         {Close input check stream: latex/1487}

Minimal file for "luatex --ini":

%%% begin test.tex %%%

% Open for reading
\immediate\write16{* File does \ifeof7 not \fi exist}

% \closein7

% Open for writing
\csname @@\endcsname\end
%%% end test.tex %%%

With \closein7, this should also work in MiKTeX.
Without \closein7 writing will fail, if the operating
system has locked the file.

Yours sincerely
  Heiko Oberdiek

More information about the lualatex-dev mailing list