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

Error formatting file: Vim(let):E484: Can't open file /tmp/vC6awwI/8 #106

Closed
sfraczek opened this issue Oct 17, 2018 · 14 comments
Closed

Error formatting file: Vim(let):E484: Can't open file /tmp/vC6awwI/8 #106

sfraczek opened this issue Oct 17, 2018 · 14 comments

Comments

@sfraczek
Copy link

sfraczek commented Oct 17, 2018

Hi,

how can I change the tmp directory? I get this error
Error formatting file: Vim(let):E484: Can't open file /tmp/vC6awwI/8 when truing to :FormatCode.

@sfraczek
Copy link
Author

sfraczek commented Oct 17, 2018

Ok I found how to change it. Wrote at the beginning of ~/.vimrc this: let $TMPDIR = "/home/sfraczek/.vim-tmp"

but this didn't fix the problem...
Error formatting file: Vim(let):E484: Can't open file /home/sfraczek/.vim-tmp/viGs461/2

do you know what might be causing this and how to fix it?

@dbarnett
Copy link
Contributor

Looks like a dupe of #86. See discussion there and the bug I filed for it in the library, google/vim-maktaba#215, and try the suggested "SetUsableShellRegex" workaround there to see if it helps get you unstuck. If you can post your findings we might be able to make some progress towards getting it compatible with Win 10.

@dbarnett
Copy link
Contributor

I'll close this one for now, but please comment/reopen if you don't think it's the same issue after all.

@sfraczek
Copy link
Author

Hi,
thanks for reply.

I think it's a different issue because I'm having this problem on linux not on windows.

This call maktaba#syscall#SetUsableShellRegex('\v^/bin/sh|cmd|cmd\.exe|command\.com$') didn't help.
I have this plugin work on my desktop ubuntu 16.04.5 but I can't get it to work on a server ubuntu 16.04.3.
When I look at the directory pointed by the error like: Error formatting file: Vim(let):E484: Can't open file /tmp/vv5XWOu/2
it exists but the file doesn't. I can create files there myself.

ls -al /tmp/vv5XWOu/
total 356
drwx------  2 sfraczek kmem   4096 Oct 18 00:42 .
drwxrwxrwt 63 root     root 356352 Oct 18 00:41 ..

I tried to follow the windows10 debugging calls from that issue #86 and here are the results:
:call maktaba#buffer#Overwrite(1, line('$'), []) makes my current buffer empty
:echo has('job') responds with 1
:call maktaba#syscall#Create(['cat']).WithStdin('').Call() shows me the same error.
:call system(printf('cat > %s 2> %s', tempname(), tempname()), []) shows no error.
call maktaba#syscall#SetVimjobDisabledForTesting(1) doesn't help.

@dbarnett
Copy link
Contributor

dbarnett commented Nov 7, 2018

If this is in long-running vim sessions, vim has known issues where it doesn't verify tmp directories it previously created still exist, and obviously tmp directories can disappear without warning for various reasons. It sounds like you are saying you can reproduce consistently though, right?

@dbarnett dbarnett reopened this Nov 7, 2018
@sfraczek
Copy link
Author

sfraczek commented Nov 8, 2018

yes, it happens all the time, not just old sessions.

@manikanta226
Copy link

Hi, I'm also facing the same issue.
if I enter this command :FormatCode clang-format . getting error as Error formatting file: Vim(let):E484: Can't open file /tmp/vVJhj2Y/1 .

I Updated the add this line to my vimrc also let $TMPDIR = "/usr2/c_sai/.vim-tmp" But still not working.

colud you please tell me what are the dependencies ?

@dbarnett
Copy link
Contributor

What do you get when you execute

:verbose set shell?

?

I suspect it's still the same basic error as google/vim-maktaba#215, which you'd see if /bin/sh doesn't exist as an executable shell on your system.

If :call system('ls') works without error, try executing this in your vim session:

call maktaba#syscall#SetUsableShellRegex('\v.*')

and then retry to see if it still errors out.

@sfraczek
Copy link
Author

I'm afraid I have lost access to that server where I had this problem so I can't confirm it now. Thank you very much for revisiting it! :) I will close the issue now.

@jgodden
Copy link

jgodden commented Apr 15, 2021

Not sure if it's ok to add a comment to a closed call, so apologies if so.
I was having this issue, and found that opening a Perl file works if logged in as standard user, but gets this error if using a nologin shell (dbarnett's suggestion to check). As you can still sudo to run a bash shell as a nologin user, you should still be able to edit perl files as this user.
Should I open another ticket to get resolved?

@dbarnett
Copy link
Contributor

Either way. New issue w/ thorough details to reproduce would be helpful to back up and clarify exactly what you've tried so far in your case.

I tried using sudo to impersonate a nologin user and didn't get any error from :call maktaba#syscall#Create(['cat']).WithStdin('').Call() which supposedly did error out for sfraczek. It would be especially helpful to know vim version, output of :verbose set shell?, and confirm in this case that:

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

shows no error but that:

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

does show an error.

@jgodden
Copy link

jgodden commented Apr 16, 2021

Have opened a new issue as suggested
#179

@dbarnett
Copy link
Contributor

dbarnett commented Apr 16, 2021

Thanks! I followed up there: I think that issue is unrelated.

I am definitely still interested in getting more findings if anyone runs into cases where maktaba#Syscall# stuff fails with E484 but system() succeeds, though.

@malcolmr
Copy link
Member

Note that for long-running Vim sessions specifically, Vim 8.2.0711 includes a change to lock the Vim temporary directory so that it's no longer reaped (in most cases) while Vim is still running.

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