[Rd] Issues with tempdir() using short path names

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Sun Aug 10 21:22:03 CEST 2025


I recently found out about Paul Murrell's excellent xdvir package that 
renders LaTeX in a graphics device.  I thought this would be useful and 
put a wrapper around the latexGrob() function into rgl.

Testing it on Github workflows worked fine on Ubuntu and MacOS runners, 
but failed on Windows.  Here's a typical error message:

> This is XeTeX, Version 3.141592653-2.6-0.999997 (TeX Live 2025) (preloaded format=xelatex)
>    restricted \write18 enabled.
>   entering extended mode
>   Error: LaTeX failed to compile C:\Users\RUNNER~1\AppData\Local\Temp\Rtmp6TD7wY/working_dir\RtmpmitpVG\file130053037941.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips.
>   Execution halted

(taken from 
https://github.com/dmurdoch/rgl/actions/runs/16861206133/job/47761646553).

After a long series of experiments, I think I found the cause:  xdvir 
creates a file in tempdir(), and passes it to lualatex or xelatex (along 
with various command line options).  If that file contains the 
"RUNNER~1" directory, which is the 8.3 form of "runneradmin", the 
compile fails.

I have a workaround for this: I setwd(tempdir()) and use the basename of 
the temp file.

Another workaround that I tried doesn't work:  normalizePath(tempfile()) 
generally does nothing, because normalizePath() won't modify a path that 
doesn't exist.  If I write to the tempfile() and then normalize the 
name, that does work.

I think there are one or more bugs here that should be fixed.  I'm just 
not sure what they are.

Is it a bug in TeXLive 2025, that those programs won't accept short 
names?  Or has Windows deprecated them, and R shouldn't be producing 
them?  Is it a bug that tempfile() doesn't produce a normalized path?

Duncan Murdoch



More information about the R-devel mailing list