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

E484: Can't open file c:\Users\username~\AppData\Local\Temp\VIo7EE2.tmp #86

Open
0xnandhi opened this issue Sep 2, 2017 · 10 comments
Open
Labels

Comments

@0xnandhi
Copy link

0xnandhi commented Sep 2, 2017

On Windows 10, i am facing this issue. Unable to open the temp dir for writing.

My _vimrc file:

`let $TMPDIR = "C:/Users/Balasubramanian/.vim/temp"

" initial vundle configuration.
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"plugin installation
"vundle plugin

Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-surround'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'DoxygenToolkit.vim'
"Plugin 'rip-rip/clang_complete'
Plugin 'valloric/youcompleteme'
Plugin 'brookhong/cscope.vim'
Plugin 'airblade/vim-rooter'
Plugin 'klen/python-mode'
Plugin 'nlknguyen/papercolor-theme'
Plugin 'google/vim-maktaba'
Plugin 'google/vim-codefmt'
Plugin 'google/vim-glaive'
Plugin 'flazz/vim-colorschemes'
Plugin 'altercation/vim-colors-solarized'
Plugin 'bling/vim-airline'
Plugin 'w0rp/ale'
Plugin 'cython/cython'

call vundle#end()
filetype plugin indent on
" the glaive#Install() should go after the "call vundle#end()"
call glaive#Install()
" Optional: Enable codefmt's default mappings on the = prefix.
Glaive codefmt plugin[mappings]
Glaive codefmt google_java_executable="java -jar C:/Users/Balasubramanian/.vim/bundle/vim-glaive/google-java-format-VERSION-all-deps.jar"
`

Can the community please help me ? every time i have to format the code, i am using a Visual Code to format it and i have to switch back to Vim for coding.

I have also disabled my "RealTime Scanner" , even then, get the same issue.

Thanks

@dbarnett
Copy link
Contributor

dbarnett commented Dec 4, 2017

You're saying this happens only when you have codefmt enabled? Hard for me to see how that would be related. If so, is there a more complete error you could paste?

@jasonwangm
Copy link

I met with the same problem and have found no method to solve this issue.

@dbarnett
Copy link
Contributor

dbarnett commented Jun 3, 2018

So this triggers in particular when you run :FormatCode? Are there any other error details you can provide? Does it trigger the same sort of error if you run

:call maktaba#syscall#Create(['cat']).WithStdin('').Call()

or

:call maktaba#buffer#Overwrite(1, line('$'), [])

?

@dbarnett dbarnett reopened this Jun 3, 2018
@rachaeldawn
Copy link

rachaeldawn commented Jun 7, 2018

@dbarnett
I encounter the same issue using GVim on Windows 10. Of your code snippets, the second one does work perfectly fine. I think the tmp file is either not being created correctly, or vim does not have permission to create the tmp file.

@dbarnett
Copy link
Contributor

dbarnett commented Jun 7, 2018

So you see the same sort of error with the first one?

How about

:echo has('job')

and

:call system(printf('cat > %s 2> %s', tempname(), tempname()), [])

?

@rachaeldawn
Copy link

rachaeldawn commented Jun 8, 2018

@dbarnett
First one responds with 1
Second one flashes a window really quick and doesn't appear to do anything else.

If you need access to my machine, drop me a message and I'll get a TeamViewer session going. But for me it's super reproducible.

  1. Install gvim
  2. Setup plugins
  3. :FormatCode in a TypeScript file
  4. Get error

@dbarnett
Copy link
Contributor

dbarnett commented Jun 8, 2018

Okay, so to summarize observations so far and give you some context, the gist of this bug seems to be that:

  • there's some issue on vim on Windows 10 that makes maktaba syscalls not work
  • may or may not be specific to the way maktaba is invoking the syscalls
  • seems to be specific to using vim job support

Sounds like you see an error with

 :call maktaba#syscall#Create(['cat']).WithStdin('').Call()

but not with

:call system(printf('cat > %s 2> %s', tempname(), tempname()), [])

(can you confirm the first one does give you a E484 error?)

I believe from the details you've given that you can temporarily work around it by disabling syscall job support when you're using Windows 10 by adding this to your .vimrc:

call maktaba#syscall#SetVimjobDisabledForTesting(1)

And then the remaining bit is to figure out whether it's a vim issue for Windows 10 or a maktaba issue.

@rachaeldawn
Copy link

rachaeldawn commented Jun 8, 2018

Result of first call

:call maktaba#syscall#Create(['cat']).WithStdin('').Call()
Error detected while processing function maktaba#syscall#Call[3]..<SNR>112_DoSyscallCommon[16]..maktaba#function#Apply[1]..maktaba#function#Call[0]..maktaba#function#Call[13]..maktaba#syscall#DoCall:
line 5
E484: Can't open file C:\Users\<me>\AppData\Local\Temp\VIoFBAB.tmp

Second one does the flash, and no response

Third code snippet, I put in and get the same result after running :FormatCode
Error formatting file: Vim(let):E484: Can't open file C:\Users\<me>\AppData\Local\Temp\VIoCD01.tmp

@kkkk9
Copy link

kkkk9 commented Jun 13, 2018

I think the problem is in maktaba's usable_shell.
I also met this problem,
my solution is:

  1. add two lines in your _vimrc file.
set shell=cmd
set shellcmdflag =/c
  1. Then goto the ~/bundle/vim-maktaba/autoload/maktaba/syscall.vim
    change th code:
if !exists('s:usable_shell')
  let s:usable_shell = '\v^/bin/sh$'
endif

to

if !exists('s:usable_shell')
  "let s:usable_shell = '\v^/bin/sh$'
  let s:usable_shell = '\v^cmd$'
endif

Alghouth the solution is ugly, but worked for me..(Win7, Vim8)

@dbarnett
Copy link
Contributor

Ah, it makes sense that /bin/sh would be problematic on Windows. I filed google/vim-maktaba#215 with my understanding of the issue and a suggested workaround based on @kkkk9's solution (can you comment there if the other 'shell' and 'shellcmdflag' overrides are actually necessary? IIUC those are vim's defaults).

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

5 participants