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

kpsewhich cache causes "List or Blob required" error on completion #2206

Closed
user202729 opened this issue Oct 13, 2021 · 5 comments
Closed

kpsewhich cache causes "List or Blob required" error on completion #2206

user202729 opened this issue Oct 13, 2021 · 5 comments
Labels

Comments

@user202729
Copy link

user202729 commented Oct 13, 2021

Description

Reproduce:

Put this into the kpsewhich.json cache file

{"inputenc.tex":"",
"ucs.sty":"/usr/share/texmf-dist/tex/latex/ucs/ucs.sty",
"geometry.tex":"",
"xparsex.cls":[["",
"/tmp"]],
"inputenc.sty":"/usr/share/texmf-dist/tex/latex/base/inputenc.sty",
"ifvtex.tex":"",
"keyval.tex":"/usr/share/texmf-dist/tex/generic/xkeyval/keyval.tex",
"hyperref.tex":"",
"geometry.sty":"/usr/share/texmf-dist/tex/latex/geometry/geometry.sty",
"iftex.tex":"",
"expl3.tex":"",
"#1.cls":"",
"ifvtex.sty":"/usr/share/texmf-dist/tex/generic/iftex/ifvtex.sty",
"hyperref.sty":"/usr/share/texmf-dist/tex/latex/hyperref/hyperref.sty",
"#1.def":"",
"iftex.sty":"/usr/share/texmf-dist/tex/generic/iftex/iftex.sty",
"amsmath.tex":"",
"kvsetkeys.tex":"",
"shellesc.sty":"/usr/share/texmf-dist/tex/latex/tools/shellesc.sty",
"pdftexcmds.tex":"",
"xparse.tex":"",
"amsmath.sty":"/usr/share/texmf-dist/tex/latex/amsmath/amsmath.sty",
"xparsex.tex":[["",
"/tmp"]],
"kvsetkeys.sty":"/usr/share/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty",
"shellesc.tex":"",
"ucshyper.tex":"",
"atbegshi.tex":"",
"pdftexcmds.sty":"/usr/share/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty",
"xparse.sty":"/usr/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty",
"xparsex.sty":[["",
"/tmp"]],
"ucshyper.sty":"/usr/share/texmf-dist/tex/latex/ucs/ucshyper.sty",
"atbegshi.sty":"/usr/share/texmf-dist/tex/generic/atbegshi/atbegshi.sty",
"expl3.sty":"/usr/share/texmf-dist/tex/latex/l3kernel/expl3.sty"}

is
Open a TeX file with this content

\usepackage{xparse}
\a

Put the cursor after the last a then press ctrl+N.

Error:

Scanning tags.
Error detected while processing function vimtex#include#expr[41]..<SNR>108_search_candidates_kpsewhich[22]..vimtex#kpsewhich#find:
line   27:
E897: List or Blob required
Press ENTER or type command to continue

The problem does not happen without the cache, but because VimTeX (presumably) generate that cache, it's still the plugin's bug?

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

Yes

VimtexInfo

System info
  OS: Arch Linux
  Vim version: VIM 8.2 (1-2891)
  Has clientserver: true
  Servername: undefined (vim started without --servername)

VimTeX project: d
  base: d.tex
  root: /tmp
  tex: /tmp/d.tex
  main parser: current file
  document class: 
  packages: xparse
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -latexoption=--shell-escape
      -interaction=nonstopmode
    build_dir: /tmp/.vimtex_build_dir/
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile
@user202729 user202729 added the bug label Oct 13, 2021
@lervag
Copy link
Owner

lervag commented Oct 13, 2021

Thanks, I'll see if I can improve the error handling here. But the simple solution would be to clear the cache with :VimtexClearCache kpsewhich. After doing that, everything should work well again.

@user202729
Copy link
Author

The problem is that why the cache get into the state in the first place (surely I don't manually modify the file)

@lervag
Copy link
Owner

lervag commented Oct 13, 2021

The cache got in that state because I made a change to the underlying code that changed how the cache was used. I thought I also added necessary error catching with messages to help people clear the cache if necessary, but I'm sorry to say I've missed something.

But you should not get invalid cache after clearing it.

@user202729
Copy link
Author

user202729 commented Oct 13, 2021

(it's okay. I just didn't understand what was going on)

A possible idea to avoid such cases in the future is to write a version number in the cache file, then delete the cache when there's an incompatible change, but it isn't really possible to retroactively apply that now

(besides, the format doesn't change that frequently)

@lervag
Copy link
Owner

lervag commented Oct 13, 2021

A possible idea to avoid such cases in the future is to write a version number in the cache file, then delete the cache when there's an incompatible change, but it isn't really possible to retroactively apply that now

Yes, that's a good idea. I thought of it before, but never found a good way to get the current vimtex git commit hash reliably. But that's not necessary, I can just use a cache specific version that I manually bump if I make a change to the cache.

I'll update and push. Thanks for the suggestion!

lervag added a commit that referenced this issue Oct 13, 2021
This allows us to invalidate caches when necessary and thus prevent
problems with invalid cache due to code changes.

refer: #2206
@lervag lervag closed this as completed Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants