macvim icon indicating copy to clipboard operation
macvim copied to clipboard

VIM crashes after executing xelatex and colorscheme

Open AmaruCoder opened this issue 4 years ago • 11 comments

Describe the bug When there is an autocommand to change the colorscheme Vim crashes after executing xelatex.

To Reproduce Detailed steps to reproduce the behavior:

  1. Include the code below in the .vimrc file:
let g:colors = "lucius"
augroup color
    au!
    au WinEnter * exe "colorscheme ".g:colors
augroup END

set makeprg=xelatex\ \-file\-line\-error\ \-interaction=nonstopmode
nmap <leader>k :exec "silent make ".shellescape(expand('%'))<cr>
  1. Load a latex file
  2. Compile with <leader>k
  3. Navigate to another latex file
  4. Vim crashes

See report below:

Process:               MacVim [33498]
Path:                  /Applications/MacVim.app/Contents/MacOS/MacVim
Identifier:            org.vim.MacVim
Version:               8.2.2164 (169)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           MacVim [33498]
User ID:               502

Date/Time:             2021-07-21 18:42:43.350 -0700
OS Version:            Mac OS X 10.15.7 (19H2)
Report Version:        12
Bridge OS Version:     4.6 (17P6610)
Anonymous UUID:        35483298-412C-44A4-AED8-52EE10686945

Sleep/Wake UUID:       A07E24BD-D769-40DF-B2B1-77023F65444C

Time Awake Since Boot: 14000 seconds
Time Since Wake:       4400 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000076141ecb4d88
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [33498]

VM Regions Near 0x76141ecb4d88:
    Stack                  00007000021fc000-000070000227e000 [  520K] rw-/rwx SM=COW  thread 6
--> 
    MALLOC_TINY            00007f84c8400000-00007f84c8500000 [ 1024K] rw-/rwx SM=PRV  

Application Specific Information:
objc_msgSend() selector name: retain

Expected behavior Vim should load new file without crashing.

Environment (please complete the following information):

  • Vim version: 8.2 (Dec 19 2020)
  • OS: MacOS 10.15.7
  • Terminal: GUI

AmaruCoder avatar Jul 22 '21 02:07 AmaruCoder

Thank you for an issue,

Have you tried console vim shipped within MacVim?

eirnym avatar Jul 22 '21 06:07 eirnym

It doesn't happen in the console vim. So I upgraded Vim to the newest release (8.2 April 1 2021, patches 1-2681), and it still crashes.

Investigating the issue further, it seems that the problem happens every time Vim tries to execute an external command, such as ls.

To reproduce:

  1. Include the code below in the .vimrc file:
let g:colors = "lucius"
augroup color
    au!
    au WinEnter * exe "colorscheme ".g:colors
augroup END
  1. Load at least two files.
  2. With file 1 in the active window, execute an external command, such as :!ls.
  3. Navigate to file 2.
  4. Vim crashes.

See report below:

Process:               MacVim [1587]
Path:                  /Applications/MacVim.app/Contents/MacOS/MacVim
Identifier:            org.vim.MacVim
Version:               8.2.2681 (171)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           MacVim [1587]
User ID:               502

Date/Time:             2021-07-22 16:44:25.203 -0700
OS Version:            Mac OS X 10.15.7 (19H2)
Report Version:        12
Bridge OS Version:     4.6 (17P6610)
Anonymous UUID:        35483298-412C-44A4-AED8-52EE10686945


Time Awake Since Boot: 640 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00004f4c183b3798
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [1587]

VM Regions Near 0x4f4c183b3798:
    __LINKEDIT             000000011f55f000-000000011f597000 [  224K] r--/r-- SM=COW  /usr/lib/dyld
--> 
    MALLOC_NANO            0000600000000000-0000600008000000 [128.0M] rw-/rwx SM=PRV  

Environment

  • VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 1 2021 08:37:51)
  • MacOS 10.15.7
  • Terminal: GUI

AmaruCoder avatar Jul 22 '21 23:07 AmaruCoder

I have tested the previous versions of Vim. The last one that works fine, without crashing is Vim patch 8.2.539. Any other version afterwards, crashes.

AmaruCoder avatar Jul 23 '21 00:07 AmaruCoder

The problem seems to arise when in “Preferences” > “Appearance” > “Dark mode selection,” you choose “Use 'background' option.”

AmaruCoder avatar Jul 23 '21 06:07 AmaruCoder

How you installed both Vim and MacVim and in which order?

eirnym avatar Jul 23 '21 08:07 eirnym

Through the tedious process of uninstalling one version and installing the previous one. I have installed now the newest version again, and selected "Automatic" under "Preferences" > "Appearance" > "Dark mode selection." And it works fine.

AmaruCoder avatar Jul 24 '21 05:07 AmaruCoder

You can install both vim and macvim using:

  • using an official binary release from website or GitHub releases
  • using MacPorts
  • using Homebrew
  • by compiling and installing by yourself

Please note, that installing another vim binary over macvim's is not supported as vim part (binary and runtime) in MacVim is also modified to support macvim-related features.

eirnym avatar Jul 24 '21 07:07 eirnym

Thank you for the instructions. I have been using (and installing) MacVim and Vim for more than ten years. I am reporting a bug introduced when the "Dark mode selection" option was added to he "Appearance" under "Preferences."

AmaruCoder avatar Jul 25 '21 04:07 AmaruCoder

I personally install MacVim from GitHub as Vim inside and runtime are modified a bit to support many MacVim-specific things

eirnym avatar Jul 25 '21 08:07 eirnym

I do appreciate the advice about installation. However, this is a bug in the newer version of MacVim. Perhaps somebody can close this issue and I can submit another, more specific, bug report.

AmaruCoder avatar Jul 26 '21 04:07 AmaruCoder

@AmaruCoder feel free to close it by yourself and open anew

eirnym avatar Jul 26 '21 19:07 eirnym