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

Re: Conditional styles and free-association thereon



Bart Schaefer wrote:

> On May 12,  9:27am, Sven Wischnowsky wrote:
> } Subject: Re: PATCH: Re: "Cancel" menu selection & Co?
> }
> } Aside: I've been playing with a little completer named `_guard' that
> } works a bit like _prefix and _ignored, i.e. it looks up completers
> } and calls them -- based on some condition.  [...]
> } 
> } I then decided that I don't like this approach. Then I thought again
> } about adding conditionals to styles. For testing purposes, this could
> } be implemented by a new completion widget that calls _main_complete,
> } but defines a `zstyle' function before that.  [...]  Using shell syntax
> } here could mean that the wrapper makes every style value be eval'ed as 
> } a whole [...]
> 
> The basic concept here isn't bad, but I'm not excited by the potential
> implementation.  It's a bit like implementing "while" as a function that
> takes the loop condition and loop body in arguments.  (Which I have done,
> long ago and far away in another scripting language, and not been very
> happy about.)  You can make it work, but it's going to feel wrong every
> time you use it, even if you don't have to struggle with the quoting.
> 
> We're reaching the point -- if _arguments hasn't passed it already --
> where we need help from the lexer to proceed sanely.  Writing this kind
> of thing in Tcl, for example, would be much cleaner, because { ... }
> is -always- parsed approximately the way zsh parses a function body.
> (Not that Tcl doesn't have plenty of other warts/problems of its own.)

Right. That's the main reason why I haven't implemented it yet, hoping 
for some nice idea to make this cleaner.

> On a slightly different note ... every time "eval"ing something else
> gets mentioned, I worry again that the completion system has created a
> security hole you culd drop all of Microsoft through.  The number of
> things that autoload and execute when you press TAB has exceeded all my
> expectations from when I first began discussing a function-based system.
> I'm on the verge of suggesting that the zsh/complete module should refuse
> to load if EUID == 0.
> 
> At the least, shouldn't compinit check the directories (and files?) in
> $fpath for unsafe write permissions?

Sounds reasonable.


And, yes, it also exceeded my expectations, too.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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