Skip to content

An empty build_dir option makes :VimtexClean attempt to delete files from root directory / #2715

@doronbehar

Description

@doronbehar

Description

Continuing the discussion from #2677 (comment), steps to reproduce the issue are below.

Steps to reproduce

  1. Add the following to your init.vim:
let g:vimtex_compiler_method = 'tectonic'
let g:vimtex_compiler_tectonic = {
	\'build_dir' : '',
	\'hooks' : [],
	\'options' : [
	\	'--keep-logs',
	\	'--synctex',
	\],
\}
  1. Open a tex file.
  2. Compile it.
  3. Run :!ls
  4. Observe there are auxiliary files.
  5. Run :VimtexClean
  6. Run :!ls again
  7. Observe no files were deleted.

A screencast is attached:

asciicast

Also, I applied the following patch to debug this issue:

diff --git i/autoload/vimtex/compiler/_template.vim w/autoload/vimtex/compiler/_template.vim
index 8bd4b30b..b829297b 100644
--- i/autoload/vimtex/compiler/_template.vim
+++ w/autoload/vimtex/compiler/_template.vim
@@ -136,6 +136,7 @@ function! s:compiler.clean(full) abort dict " {{{1
   call map(l:files, {_, x -> printf('%s/%s.%s',
         \ self.build_dir, fnamemodify(self.state.tex, ':t:r:S'), x)})
 
+  call vimtex#jobs#run('echo files to be cleaned are: ' . join(l:files) . ' > /tmp/files-to-clean', {'cwd': self.state.root})
   call vimtex#jobs#run('rm -f ' . join(l:files), {'cwd': self.state.root})
 endfunction
 

And the /tmp/files-to-clean shows:

files to be cleaned are: /test.synctex.gz /test.toc /test.out /test.aux /test.log /test.xdv

Expected behavior

Auxiliary files are deleted.

Actual behavior

No auxiliary files are deleted.

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: NixOS 23.05 (Stoat)
  Vim version: NVIM v0.9.0
  Has clientserver: true
  Servername: /run/user/1000/nvim.1060012.0

VimTeX project: test
  base: test.tex
  root: /home/doron/desktop/init-tests/nvim/pack/testing/start/vimtex/test/test-doc
  tex: /home/doron/desktop/init-tests/nvim/pack/testing/start/vimtex/test/test-doc/test.tex
  main parser: current file verified
  document class: article
  packages: amsmath mathtools tikz
  compiler: tectonic
    options:
      --keep-logs
      --synctex
  viewer: General
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions