James McCoy wrote:

> On Tue, May 03, 2022 at 11:03:11AM +0100, Bram Moolenaar wrote:
> > 
> > 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*
> 
> Shouldn't the default behavior be NOT to add that directory to the
> path?  If a user really wants to add Vim's directory to their path, they
> already have a means to do that -- their vimrc.  Why should Vim be doing
> it?

This is how MS-Windows works by default.  For example, if you build Vim,
resulting in vim.exe, then typing "vim" will find vim.exe in the current
directory.  Many users depend on this.

Obviously this is a trojan horse security issue, which is why on
Unix-like systems adding dot to $PATH is very unusual or generates
warnings.

Apparently using the $NoDefaultCurrentDirectoryInExePath environment
variable is the standard way how later MS-Windows "solved" this.  So Vim
should respect it.

-- 
I AM THANKFUL...
...for a lawn that needs mowing, windows that need cleaning
and gutters that need fixing because it means I have a 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/20220504122845.2054A1C1A34%40moolenaar.net.

Raspunde prin e-mail lui