a simpler non-latex example

wr.tex

%%%
aaaa

\newwrite\wfile

\immediate\openout\wfile=\jobname.aux

\immediate\write\wfile{boo}

bbb

\bye
%%

if you run this once so a .aux file is written, then

chmod a-w wr.aux

to remove write permission, then using pdftex and hitting return on error
produces:

$ pdftex wr
This is pdfTeX, Version 3.141592653-2.6-1.40.29 (TeX Live 2026) (preloaded
format=pdftex)
 restricted \write18 enabled.
entering extended mode
(./wr.tex
! I can't write on file `wr.aux'.
l.5 \immediate\openout\wfile=\jobname.aux

(Press Enter to retry, or Control-D to exit; default file extension is
`.tex')
Please type another output file name:
! I can't write on file `wr.aux'.
l.5 \immediate\openout\wfile=\jobname.aux

(Press Enter to retry, or Control-D to exit; default file extension is
`.tex')
Please type another output file name:
! I can't write on file `wr.aux'.
l.5 \immediate\openout\wfile=\jobname.aux

(Press Enter to retry, or Control-D to exit; default file extension is
`.tex')
Please type another output file name:
! I can't write on file `wr.aux'.
l.5 \immediate\openout\wfile=\jobname.aux

(Press Enter to retry, or Control-D to exit; default file extension is
`.tex')
Please type another output file name:

and it loops until you give it a file that it can write to.

with luatex you get

$ luatex wr
This is LuaTeX, Version 1.24.0 (TeX Live 2026)
 restricted system commands enabled.
(./wr.tex
! I can't write on file `wr.aux'.
l.5 \immediate\openout\wfile=\jobname.aux

Please type another output file name:
[1{/usr/local/texlive/2026/texmf-var/fonts/map/pdftex/updmap/pdftex.map}])</usr
/local/texlive/2026/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on wr.pdf (1 page, 9886 bytes).
Transcript written on wr.log.

and the source file is over-written.

David

Reply via email to