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

E40: Can't open errorfile #169

Closed
vnazarenko opened this issue Dec 16, 2015 · 4 comments
Closed

E40: Can't open errorfile #169

vnazarenko opened this issue Dec 16, 2015 · 4 comments

Comments

@vnazarenko
Copy link

I'm using MacVim + 10.11 ( El Capitan )
After sleep Ack is not working, i'm getting something like this:

Error detected while processing function ack#Ack..<SNR>91_SearchWithGrep:
line    8:
E40: Can't open errorfile /var/folders/wc/0nswstgn5_9gr0qdym269hj40000gn/T/v9ep9tW/3
Error detected while processing function ack#Ack:
line   27:
E171: Missing :endif 

only app restart fix that.

@ches
Copy link
Collaborator

ches commented Dec 21, 2015

I believe this likely has nothing to do with ack.vim specifically and more to do with OS X, MacVim, and/or your shell… errorfile refers to a Vim setting used by the quickfix feature and thus the search result lists used by ack.vim but also built-in Vim features like :grep—my guess is you'll see similar errors if you just try to use :grep after sleep instead of :Ack.

TL;DR I'd first suggest set shell=bash and see if that resolves it easily. I haven't reproduced this myself, my hunch is that Vim or MacVim is at some level using the $TMPDIR environment variable as part of the default location for 'errorfile' and caching the path, and OS X must be cleansing tmp upon sleep, perhaps a security feature. Not entirely sure why set shell=bash seems to resolve the general issue for some people, but maybe there is some bug in Vim where the environment variable expansion is cached if you're using a different shell.

Please re-open if you have some strong reasoning to suspect that ack.vim is still at fault, but I don't think so since our SearchWithGrep essentially just delegates to Vim's built-in :grep machinery with some temporary settings applied.

@ches ches closed this as completed Dec 21, 2015
@danedavid
Copy link

My Vim is currently using bash as its shell, but still gettin the exact error as above. I'm getting the error only when using special characters like ( in the :Ack command. For normal string searches it's working. It used to work fine on my Ubuntu machine. Now running Vim v8 on Mac OSX High Sierra.
Things I've tried:

  1. set shell=/bin/bash
  2. export $TMPDIR=/tmp/
  3. escaping the search character like \(

@alepez
Copy link

alepez commented Jun 7, 2021

Same problem after switching from Arch Linux to NixOS.

The cause was set shell=/bin/zsh in my init.vim, which in NixOS does not work, because zsh is not in /bin. Changing to set shell=zsh fixed the issue.

@BourgeoisBear
Copy link

I had this happen due to incorrectly escaped/terminated grepprg and/or shellpipe.

For example, with this config:

let &grepprg='rg --no-config --vimgrep $*'
let &shellpipe='2>&1 | tee'

This command:

:grep! -F -t go -- 'FoO

Will be shelled-out as:

rg --no-config --vimgrep -F -t go -- 'FoO 2>&1 | tee

Since the quote on the search term FoO hasn't been closed, the shell will keep trying to complete the token (consuming the redirect, the pipe, and the tee). Without the redirect & the tee, the results file will not be created, & vim will respond with E40: Can't open errorfile. A syntax error in shellpipe would have the same effect.

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

5 participants