Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Fun with shellslash (was: Errors when using python/python syntax checker) #814

Open
arecarn opened this issue Oct 9, 2013 · 11 comments
Open

Comments

@arecarn
Copy link

arecarn commented Oct 9, 2013

Using:

  • Windows 7
  • python 2.7.5
  • gVim 7.4.27 or 7.4.50
  • Current version of Syntastic (master HEAD) as of this posting

When using SyntasticCheck python on a python file I get the following error. This error causes no syntax errors to be reported.

Error detected while processing function <SNR>63_UpdateErrors..<SNR>63_CacheErrors..47..SyntaxCheckers_python_python_GetLocList..SyntasticMake:
line   28:
E484: Can't open file C:/Users/arecarn/AppData/Local/Temp/VIoB307.tmp
Error detected while processing function <SNR>63_UpdateErrors..<SNR>63_CacheErrors:
line   25:
E170: Missing :endfor
Error detected while processing function <SNR>63_UpdateErrors:
line   10:
E171: Missing :endif

It also appears that this error may have also been reported, by @TypedLambda here

Like @TypedLambda's comment the file *.tmp file is writable, but does not exist.

P.S. Thanks for making Syntastic awesome!

@lcd047
Copy link
Collaborator

lcd047 commented Oct 9, 2013

Please set g:syntastic_debug, run the checker, and post the output of :mes.

@arecarn
Copy link
Author

arecarn commented Oct 9, 2013

As you requested:

syntastic: debug: CacheErrors: g:syntastic_aggregate_errors = 0                                                                                                                                            
syntastic: debug: CacheErrors: Invoking checker: python                                                                                                                                                    
syntastic: debug: SyntasticMake: called with options: {'errorformat': '%E  File "%f"\, line %l,%C    %p^,%C    %.%#,%Z%m,%-G%.%#', 'makeprg': 'python -c ''compile(open(''\''''catAnimation.py''\'''').rea~
d(), ''\''''catAnimation.py''\'''', ''\''''exec''\'''')''  '}                                                                                                                                            
Error detected while processing function <SNR>63_UpdateErrors..<SNR>63_CacheErrors..47..SyntaxCheckers_python_python_GetLocList..SyntasticMake:                                                            
line   28:                                                                                                                                                                                                 
E484: Can't open file C:/Users/arecarn/AppData/Local/Temp/VIo99CE.tmp                                                                                                                                      
Error detected while processing function <SNR>63_UpdateErrors..<SNR>63_CacheErrors:                                                                                                                        
line   25:                                                                                                                                                                                                 
E170: Missing :endfor                                                                                                                                                                                      
Error detected while processing function <SNR>63_UpdateErrors:                                                                                                                                             
line    8:                                                                                                                                                                                                 
E171: Missing :endif                                                                                                                                                                                       

@lcd047
Copy link
Collaborator

lcd047 commented Oct 9, 2013

Please post your settings of shell, shellcmdflag, shellquote, shellxquote, and shellredir.

@arecarn
Copy link
Author

arecarn commented Oct 9, 2013

    shell = "C:\Windows\system32\cmd.exe"                                                           
    shellcmdflag = "/c"                                                                             
    shellquote = ""                                                                                 
    shellxquote = "("                                                                               
    shellredir = ">%s 2>&1"                                                                         

@lcd047
Copy link
Collaborator

lcd047 commented Oct 9, 2013

Please post your setting of shellslash.

@TypedLambda
Copy link

shellslash is set!

switching to noshellslash fixes the problem....

@lcd047
Copy link
Collaborator

lcd047 commented Oct 9, 2013

Right: what seems to be going on here is that when shellslash is set, Vim function shellescape() won't escape single quotes in a way suitable for cmd.exe. Ideally this should be fixed in Vim, but I suppose there are already a zillion plugins that depend on the current behaviour. :) On the other hand, I don't know enough about Windows quoting rules to fix it in syntastic, and (having dealt almost exclusively with UNIX for the past ~25 years) I don't really care enough to find out how others are doing it. shrug

So, what I'm saying here is, if anybody has a fix for this, please step forward and post a pull request. Otherwise don't mix shellslash with cmd.exe. Or just stay away from Windows. :)

@pgilad
Copy link
Contributor

pgilad commented Apr 7, 2014

I can confirm that the problem was escaping filenames in windows, which fails on certain cases when shellslash is set...
@lcd047 - thanks for the help! Besides setting noshellslash for particular bad filenames in windows, is there any other recommended solution you can think of?

I know that Shougou handles this somehow in NeoBundle so it must be possible?

@lcd047
Copy link
Collaborator

lcd047 commented Apr 7, 2014

Besides setting noshellslash for particular bad filenames in windows, is there any other recommended solution you can think of?

Besides what I wrote above? Well, I'm afraid my knowledge about Windows hasn't improved dramatically in the mean time. Sorry about that. shrug

I know that Shougou handles this somehow in NeoBundle so it must be possible?

I'm not sure I'm following you:

$ git clone https://github.com/Shougo/neobundle.vim.git
[...]
$ cd neobundle.vim
$ fgrep -rw shellslash . | wc -l
0
$ fgrep -rw ssl . | wc -l
0

But, if you have reasons to believe Shougo has a solution, perhaps ask him?

@pgilad
Copy link
Contributor

pgilad commented Apr 7, 2014

Hmm, I looked for it too now, and couldn't find where he worked it out. I found a patch he added to Vundle that handles shellslash:
https://github.com/Shougo/Vundle.vim/commit/726ee0915a45d8f03b30605b01433bfc8ed529af

Can you point me to where Syntastic handles the escaping for the filename? I'll try to workout a PR if I can fix it...

@lcd047
Copy link
Collaborator

lcd047 commented Apr 7, 2014

If you're serious about trying to fix it, I'd suggest you to start by reading this survery. It isn't the entire story, as a lot of details are actually hidden in the context of the call, and in the difference between system() and :!. Syntastic's escape function is actually copied from vim-dispatch, but hoping for a drop-in replacement seems naive.

@lcd047 lcd047 changed the title Errors when using python/python syntax checker Fun with shellslash (was: Errors when using python/python syntax checker) May 10, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants