Tomas Kalibera
2023-Oct-30 17:34 UTC
[Rd] system()/system2() using short paths of commands on Windows?
On 10/30/23 17:18, Yihui Xie wrote:> Hi, > > It may have been so for 20+ years but I just discovered today that system() > would always try to use the short path of a command on Windows: > https://github.com/wch/r-source/blob/635a67/src/gnuwin32/run.c#L141 If > that's true, I wonder if it could provide an option to disable this > behavior, because we recently ran into a case in which short paths wouldn't > work. I wonder what the original motivation of using short paths was. If it > was to avoid spaces in paths, wouldn't shQuote() work? Thanks!Could you please file a minimal reproducible example that exhibits the problem caused by an attempt to translate to short path names (note there is a fallback to long path names)? In principle, short path names should work when they are returned by Windows, this should not be causing any trouble. Thanks Tomas> > Regards, > Yihui > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
Yihui Xie
2023-Oct-30 18:07 UTC
[Rd] system()/system2() using short paths of commands on Windows?
Sure. I'm not sure if it's possible to make it easier to reproduce, but for now the example would require installing TinyTeX (via tinytex::install_tinytex(), which can be later uninstalled cleanly via tinytex::uninstall_tinytex() after you finish the investigation). Then run: system2('fmtutil-sys', '--all') # or tinytex:::fmtutil() if fmtutil-sys.exe is not on PATH and TeX Live would throw an error like this: ...\username\AppData\Roaming\TinyTeX\bin\windows\runscript.tlu:864: no appropriate script or program found: fmtuti~1 The command "fmtutil-sys" is longer than 8 characters and hence shortened to "fmtutil~1". Yes, in principle, TeX Live should work with short path names, but it doesn't at the moment. I haven't figured out if it was a recent breakage in TeX Live or not (I've tried to contact TeX Live developers). BTW, shell('fmtutil-sys --all') works fine. Regards, Yihui -- https://yihui.org On Mon, Oct 30, 2023 at 12:34?PM Tomas Kalibera <tomas.kalibera at gmail.com> wrote:> > On 10/30/23 17:18, Yihui Xie wrote: > > Hi, > > > > It may have been so for 20+ years but I just discovered today that > system() > > would always try to use the short path of a command on Windows: > > https://github.com/wch/r-source/blob/635a67/src/gnuwin32/run.c#L141 If > > that's true, I wonder if it could provide an option to disable this > > behavior, because we recently ran into a case in which short paths > wouldn't > > work. I wonder what the original motivation of using short paths was. If > it > > was to avoid spaces in paths, wouldn't shQuote() work? Thanks! > > Could you please file a minimal reproducible example that exhibits the > problem caused by an attempt to translate to short path names (note > there is a fallback to long path names)? In principle, short path names > should work when they are returned by Windows, this should not be > causing any trouble. > > Thanks > Tomas > > > > > Regards, > > Yihui > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-devel at r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-devel >[[alternative HTML version deleted]]
Reasonably Related Threads
- system()/system2() using short paths of commands on Windows?
- system()/system2() using short paths of commands on Windows?
- system()/system2() using short paths of commands on Windows?
- system()/system2() using short paths of commands on Windows?
- system()/system2() using short paths of commands on Windows?