On Thu, 4 Jun 2026 at 10:52, luigi scarso <[email protected]> wrote:

>
>
> On Thu, 4 Jun 2026 at 10:32, Patrick Schulz <[email protected]> wrote:
>
>> Hi List,
>>
>> we presumably discovered a bug in lualatex: When an output file is not
>> writable and the error message is waved through by simply pressing enter,
>> lualatex writes output into the input file, deleting all previous content.
>>
>> We observed this on a multi-user system with .aux files. Here, a minimal
>> example and steps to reproduce:
>>
>> -- main.tex --
>>
>> \documentclass{book}
>>
>> \includeonly{%
>> kap-A,%
>> }
>>
>> \begin{document}
>> \include{kap-A}
>> \end{document}
>>
>> -- /main.tex --
>>
>> -- kap-A.tex --
>>
>> Some Text.
>>
>> -- /kap-A.tex --
>>
>> and then making the kap-A.aux file unwritable with
>>
>> touch kap-A.aux
>> chmod u-rw kap-A.aux
>>
>> With the next run of
>>
>> lualatex main.tex
>>
>> TeX throws an error:
>>
>> ! I can't write on file `kap-A.aux'.
>> \@include ...mmediate \openout \@partaux "#1.aux"
>> \immediate \write \@partau...
>>
>> l.32 \include{kap-A}
>>
>> Please type another output file name
>>
>> If this is answerd with a simple press of <enter>, the content that is
>> supposed to go into the kap-A.aux file is instead written into the
>> kap-A.tex file, deleting its previous content!
>>
>> Ok, I will check .
>
> --
> luigi
>


Seems to be ok:


source/texk/web2c/luatexdir/tex/extensions.c:

 1359│ void wrapup_leader(halfword p)
1360│ {
1361│     /*tex Do some work that has been queued up for \.{\\write}. */
1362│     if (!doing_leaders) {
1363│         int j = write_stream(p);
1364│         if (subtype(p) == write_node) {
1365│             write_out(p);
1366│         } else if (subtype(p) == close_node) {
1367│             close_write_file(j);
1368│         } else if (valid_write_file(j)) {
1369│             char *fn;
1370│             close_write_file(j);
1371│             cur_name = open_name(p);
1372│             cur_area = open_area(p);
1373│             cur_ext = open_ext(p);
1374│             if (cur_ext == get_nullstr())
1375│                 cur_ext = maketexstring(".tex");
1376│             fn = pack_file_name(cur_name, cur_area, cur_ext);
1377│             while (! open_write_file(j,fn)) {
1378├───────────────> fn = prompt_file_name("output file name", ".tex");
1379│             }
1380│         }
1381│     }
1382│ }


source/texk/web2c/luatexdir/tex/filename.c

249│ /*tex
250│
251│     If some trouble arises when \TeX\ tries to open a file, the
following routine
252│     calls upon the user to supply another file name. Parameter~|s| is
used in the
253│     error message to identify the type of file; parameter~|e| is the
default
254│     extension if none is given. Upon exit from the routine, variables
|cur_name|,
255│     |cur_area|, and |cur_ext| are ready for another attempt at file
opening.
256│
257│ */
258│
259│ char *prompt_file_name(const char *s, const char *e)


--
luigi

Reply via email to