Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _sh doing _normal completion



2018-03-28 15:46:32 +0200, Leah Neukirchen:
[...]
> The main problem is that it floods the reasonable expansions (from .)
> with the full contents of $PATH.
[...]

Some sh implementations (bash, zsh, AT&T ksh) look-up slash-less
commands in $PATH if not found in the currently directory, some
(mksh, dash, yash) don't. Both behaviours are allowed by POSIX.

ksh88 actually looked it up in $PATH *before* the current
directory, causing security vulnerabilities on systems with
support for setuid scripts for instance.

If you want to run a script in the current directory, I would
suggest you get  used to typing:

sh ./myscr<Tab>

to avoid surprises on those systems that lookup scripts in
$PATH. The fact that zsh completes commands in $PATH when you do
sh myscr<Tab> is actually useful as a reminder that it's not a
wise thing to do.

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author