Skip to content

\input of file outside directory causes builddir creation failure #2303

@user202729

Description

@user202729

If I do this with builddir being set to something other than the default, for example /tmp/:

$ cd /tmp/
$ mkdir -p a/a/a
$ mkdir -p b/b/b
$ vim b/b/b/b.tex

... (add "content" in)

$ vim a/a/a/a.tex

... (add some full TeX file and \input{/tmp/b/b/b/b.tex})


Example ========
%! TEX program = xelatex
\documentclass[12pt]{article}
\begin{document}
content

\input{/tmp/b/b/b/b.tex}
\end{document}

Then restart vim such that vimtex reparse the \input (why would this be necessary...?)

And start compilation in a.tex. Error message

Error detected while processing function vimtex#compiler#compile[4]..vimtex#compiler#start[7]..67[3]..70:
line   30:
E739: Cannot create directory: build_dir//../../../b
E739: Cannot create directory: build_dir//../../../b/b/b

Analysis:

  • \include does tell LaTeX to create new directory, \input does not.
  • So a program that include something outside the compilation directory and the build_dir (output directory) is unusual will fail to compile
    (unless openout_a is set)
    and there's no need for vimtex to handle that.
  • On the other hand, a program that input something outside the compilation directory is completely valid and there's no reason to support that.

Possible fix:

  • Silently ignore the attempts to create directories outside build directory?
  • Check if each included file is \input or \include, then create/not create folder accordingly?

Originally posted by @user202729 in #2204 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions