Patch 8.2.4860
Problem:    MS-Windows: always uses current directory for executables.
Solution:   Check the NoDefaultCurrentDirectoryInExePath environment variable.
            (Yasuhiro Matsumoto, closes #10341)
Files:      runtime/doc/builtin.txt, src/os_win32.c,
            src/testdir/test_functions.vim


*** ../vim-8.2.4859/runtime/doc/builtin.txt     2022-04-28 15:26:29.210947840 
+0100
--- runtime/doc/builtin.txt     2022-05-03 11:00:20.822947244 +0100
***************
*** 2013,2020 ****
                On MS-Windows it only checks if the file exists and is not a
                directory, not if it's really executable.
                On MS-Windows an executable in the same directory as Vim is
!               always found.  Since this directory is added to $PATH it
!               should also work to execute it |win32-PATH|.
                The result is a Number:
                        1       exists
                        0       does not exist
--- 2016,2025 ----
                On MS-Windows it only checks if the file exists and is not a
                directory, not if it's really executable.
                On MS-Windows an executable in the same directory as Vim is
!               normally found.  Since this directory is added to $PATH it
!               should also work to execute it |win32-PATH|.  This can be
!               disabled by setting the $NoDefaultCurrentDirectoryInExePath
!               environment variable.  *NoDefaultCurrentDirectoryInExePath*
                The result is a Number:
                        1       exists
                        0       does not exist
*** ../vim-8.2.4859/src/os_win32.c      2022-04-12 15:08:36.673207621 +0100
--- src/os_win32.c      2022-05-03 10:54:13.823359629 +0100
***************
*** 2237,2243 ****
                retval = FALSE;
                goto theend;
            }
!           STRCPY(pathbuf, ".;");
            STRCAT(pathbuf, p);
        }
      }
--- 2237,2247 ----
                retval = FALSE;
                goto theend;
            }
! 
!           if (mch_getenv("NoDefaultCurrentDirectoryInExePath") == NULL)
!               STRCPY(pathbuf, ".;");
!           else
!               *pathbuf = NUL;
            STRCAT(pathbuf, p);
        }
      }
***************
*** 2411,2417 ****
       * Otherwise the default "findstr /n" is used.
       */
      if (!executable_exists("findstr.exe", NULL, TRUE, FALSE))
!       set_option_value((char_u *)"grepprg", 0, (char_u *)"grep -n", 0);
  
  # ifdef FEAT_CLIPBOARD
      win_clip_init();
--- 2415,2422 ----
       * Otherwise the default "findstr /n" is used.
       */
      if (!executable_exists("findstr.exe", NULL, TRUE, FALSE))
!       set_option_value_give_err((char_u *)"grepprg",
!                                                   0, (char_u *)"grep -n", 0);
  
  # ifdef FEAT_CLIPBOARD
      win_clip_init();
*** ../vim-8.2.4859/src/testdir/test_functions.vim      2022-05-02 
22:53:41.384211031 +0100
--- src/testdir/test_functions.vim      2022-05-03 10:54:13.823359629 +0100
***************
*** 2906,2909 ****
--- 2906,2927 ----
    endif
  endfunc
  
+ " Test for exepath()
+ func Test_exepath()
+   if has('win32')
+     call assert_notequal(exepath('cmd'), '')
+ 
+     let oldNoDefaultCurrentDirectoryInExePath = 
$NoDefaultCurrentDirectoryInExePath
+     call writefile(['@echo off', 'echo Evil'], 'vim-test-evil.bat')
+     let $NoDefaultCurrentDirectoryInExePath = ''
+     call assert_notequal(exepath("vim-test-evil.bat"), '')
+     let $NoDefaultCurrentDirectoryInExePath = '1'
+     call assert_equal(exepath("vim-test-evil.bat"), '')
+     let $NoDefaultCurrentDirectoryInExePath = 
oldNoDefaultCurrentDirectoryInExePath
+     call delete('vim-test-evil.bat')
+   else
+     call assert_notequal(exepath('sh'), '')
+   endif
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4859/src/version.c       2022-05-02 23:50:24.389602160 +0100
--- src/version.c       2022-05-03 10:57:21.243157672 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4860,
  /**/

-- 
There's no place like $(HOME)!

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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

--- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220503100311.5AF5B1C191E%40moolenaar.net.

Raspunde prin e-mail lui