Hi vim,

I have currently experienced crashes with vim binaries which got compiled in MSYS, i.e. an UNIX-like environment, but executed in a cmd.exe shell.

The MSYS compiler identifies itself as a UNIX compiler, i.e. it has unix, __unix and __unix__ defined. In a UNIX environment, one can safely expect the HOME variable to be present and point to a valid location. This is what happens in misc1.c around line 3528.

However, programs compiled in the MSYS environment (and I believe the same is true for CYGWIN as well) can offhand get executed from the Windows cmd.exe shell as well, as long as the compatibility libraries are available.

In the cmd.exe environment, though, the HOME variable is generally unset. However, vim does not check if getenv("HOME") returns NULL in this case, because it has been compiled in a different (i.e. UNIX) environment, in which it might expect a valid return value. In the end, vim.exe crashes.

Please do add another check to the "#ifdef UNIX" case in misc1.c to see if HOME is defined and valid and reset it to a reasonable default (maybe ".") if not.

Best Regards,
Fabian Greffrath

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui