On Thu, Dec 03, 2015 at 05:43:33PM +0100, Bram Moolenaar wrote:
> 
> Does this patch fix your problem:
> 
> 
> --- a/fileio.c        2015-12-03 13:52:48.451584080 +0100
> +++ b/fileio.c        2015-12-03 17:31:53.457770134 +0100
> @@ -7390,8 +7390,9 @@
>  
>           /* expand $TMP, leave room for "/v1100000/999999999" */
>           expand_env((char_u *)tempdirs[i], itmp, TEMPNAMELEN - 20);
> -         if (mch_isdir(itmp))                /* directory exists */
> +         if (itemp[0] != '$' && mch_isdir(itmp))
>           {
> +             /* directory exists */
>  # ifdef __EMX__
>               /* If $TMP contains a forward slash (perhaps using bash or
>                * tcsh), don't add a backslash, use a forward slash!

Doesn't compile, s/itemp/itmp/ fixes that.  Next I cannot seem to
reproduce the problem with or without the patch.  My self-compiled vim
behaves completely different from the distro-supplied vim.  Looks like a
day or so to track down the differences, which I don't have.

But fundamentally this patch is still wrong.  If I run
        export TMPDIR='$TMPDIR' vim
then vim should very much try '$TMPDIR' because I explicitly asked it
to do so.  Might be a silly choice, but that is mine to make.

Correct patch seems hard.  In my case tempdirs[i] is defined to
"$TMPDIR", "/tmp", ".", "$HOME".  We don't want to try "$TMPDIR" or
"$HOME", unless the user explicitly asks us to.  We do want to try
"/tmp" and ".".  Add the other platforms and things get even messier.

Maybe the patch below is close enough to correct and simple enough to
ship?  It doesn't allow TMPDIR='$TMPDIR, but retains
TMPDIR='$SOME_OTHER_DIRECTORY_STARTING_WITH_A_DOLLAR' for those two
users that might have such a monstrosity.

So many bad options to choose from.

Jörn

--
They laughed at Galileo.  They laughed at Copernicus.  They laughed at
Columbus. But remember, they also laughed at Bozo the Clown.
-- unknown

diff --git a/src/fileio.c b/src/fileio.c
index ded95b728abc..5680c02300c7 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -7390,7 +7390,7 @@ vim_tempname(extra_char, keep)
 
            /* expand $TMP, leave room for "/v1100000/999999999" */
            expand_env((char_u *)tempdirs[i], itmp, TEMPNAMELEN - 20);
-           if (mch_isdir(itmp))                /* directory exists */
+           if (!(itmp[0] == '$' && strcmp(itmp, tempdirs[i]) == 0) && 
mch_isdir(itmp))
            {
 # ifdef __EMX__
                /* If $TMP contains a forward slash (perhaps using bash or

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui