#1548 MSYS does not gracefully handle an empty HOME variable

MSYS (75)


during the investigation of a previous bug report, which unfortunately got closed immediately [1], I found out what caused the crashing of vim.exe if run from cmd.exe: It was the fact the cmd.exe generally does not define the HOME variable.
1) If I open cmd.exe, and run vim.exe, it crashes.
2) If I open cmd.exe again, run "set HOME=." (i.e. set the HOME variable to at least something) and then run vim.exe, it works.
3) If I close vim.exe, run "set HOME=" (i.e. reset to an empty HOME variable) and then run vim.exe, it crashes again.

What I still don't understand is, if I run bash and reset the HOME variable inside bash and then run vim, it works. :/

However, I have found out that "HOME" is missing in the list of variables "forced_winenv_vars[]" in source\winsup\cygwin\environ.cc. Simply adding it there does not help, though, but I believe that a whole bunch of problems regarding running MSYS programs in cmd.exe could be solved if the HOME variable would be set to at least something sane (maybe ".", setting it to USERPROFILE might involve directory names with spaces in them) if it is found empty from the enrironment which it was called from. I know it is not your priority to make MSYS programs work from cmd.exe, but I believe fixing this won't hurt anyone. ;)


[1] https://sourceforge.net/tracker/?func=detail&aid=3305053&group_id=2435&atid=102435


  • Earnie Boyd

    Earnie Boyd - 2011-05-20

    Take a look at /etc/profile. We handle it in the default setup. If you wish you could copy the code segments to your ~/.profile file or ~/.bashrc but I don't think this is something we'll fix since your use is unsupported. Adding HOME to your Windows environment setup is our suggestion.

  • Earnie Boyd

    Earnie Boyd - 2011-05-20
    • milestone: --> Known_Feature
    • status: open --> closed-invalid

Log in to post a comment.