62926Re: HOME variable in cmd.exe for vim compiled in an UNIX-like environment
- Oct 22 9:04 AMFabian Greffrath wrote:
> Am 02.06.2011 17:07, schrieb Bram Moolenaar:Hmm, keep in mind you are using code written for Unix on MS-Windows.
> > Where does Vim crash when homedir is NULL? That should be fixed.
> I have investigated this crash a bit further and tailored it down to a
> completely unrelated issue. It is just that vim takes a completely
> different code path depending on whether a HOME directory is set and
> whether it succeeds to call a shell or not (i.e. sh is in PATH). this
> is why I first suspected the missing HOME variable to be the culprit,
> but it isn't.
> Remember, I had the problem that vim compiled in an MSYS environment
> crashes when started from a cmd.exe shell when both (a) HOME is not
> set (which is quite common in a cmd.exe shell) and (b) sh.exe is found
> in PATH (i.e. it works with zsh-nt but not with MSYS's bash).
> I can perfectly start vim under the aforementioned conditions if I
> comment out the line calling "fclose(stderr);" in src/os_unix.c around
> line 3994, that's function mch_call_shell() with (!pipe_error) && (pid
> == 0). The code block which contains the malicious line is introduced
> with the following paragraph:
> > * Don't want to show any message from the shell. Can't just
> > * close stdout and stderr though, because some systems will
> > * break if you try to write to them after that, so we must
> > * use dup() to replace them with something else -- webb
> > * Connect stdin to /dev/null too, so ":n `cat`" doesn't hang,
> > * waiting for input.
> And this is exactly what happens, both stdout and stderr are closed
> and the system breaks afterwards. The following calls to dup() aren't
> even reached. How can I circumvent this breakage? It seems that
> cmd.exe needs to have at least one file decriptor open?
That's never going to work perfectly.
Perhaps a few #ifdefs will make the code work for MS-Windows. I do hope
we can keep that to a minimum though, otherwise it gets messy.
From "know your smileys":
2B|^2B Message from Shakespeare
/// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
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
- << Previous post in topic Next post in topic >>