cmhughes / latexindent.pl

Perl script to add indentation (leading horizontal space) to LaTeX files. It can modify line breaks before, during and after code blocks; it can perform text wrapping and paragraph line break removal. It can also perform string-based and regex-based substitutions/replacements. The script is customisable through its YAML interface.
GNU General Public License v3.0
864 stars 84 forks source link

Error "Can't open file" when using `-g` key with nontrivial path #537

Closed arodomanov closed 3 months ago

arodomanov commented 4 months ago

Hi,

After the recent update of latexindent, I started receiving a new error every time I try to run the script with the -g /dev/null flag (on Linux).

Problem description

Here is a concrete example. I have the following very simple .tex file:

% main.tex
Just some text.

I run the following command in the terminal:

latexindent -g /dev/null main.tex

and receive the error code 2 with the following output:

% main.tex
Just some text.
Can't open file: No such file or directory at /usr/local/texlive/2024/texmf-dist/scripts/latexindent/LatexIndent/UTF8CmdLineArgsFileOperation.pm line 73.

It seems that there is nothing special about /dev/null as the command fails in the exact same way if I run, for example,

latexindent -g /tmp/latexindent-log.txt main.tex

However, strangely enough, everything works fine once I run the above example without the /tmp/ in the path:

latexindent -g latexindent-log.txt main.tex

Version of latexindent

I'm using the most recent version 3.23.9, 2024-04-06 but the problem didn't appear in the version a few months back (I don't remember the exact number).

cmhughes commented 4 months ago

@fengzyf can you take a look at this?

cmhughes commented 3 months ago

This has been fixed as of https://github.com/cmhughes/latexindent.pl/pull/538

It'll be part of the next release. Please leave this issue open until I've made the release, hopefully coming soon...

cmhughes commented 3 months ago

implemented and released at https://github.com/cmhughes/latexindent.pl/releases/tag/V3.24