Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
user202729 opened this issue Jan 22, 2022 · 1 comment
Closed

Comments

@user202729
Copy link

user202729 commented Jan 22, 2022

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)

lervag added a commit that referenced this issue Jan 22, 2022
@lervag
Copy link
Owner

lervag commented Jan 22, 2022

Thanks, I can reproduce this now. I've gone for the first fix by filtering out directories that are not subdirectories of the project directory. It may not be fully appropriate, but I think it should be a sensible restriction here.

@lervag lervag closed this as completed Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants