zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Andrey Butirsky <butirsky@gmail.com>
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: sudo autocompletion
Date: Mon, 10 Feb 2020 17:02:17 -0600	[thread overview]
Message-ID: <A79F7436-C272-45EE-809F-C73E0D85096B@dana.is> (raw)
In-Reply-To: <327afa53-4d22-7cea-9f4f-3bf9bcf82607@gmail.com>

On 10 Feb 2020, at 16:05, Andrey Butirsky <butirsky@gmail.com> wrote:
> Didn't see all the file, but probably 'su' and variants need something similar also?
> One of the "solutions"...:
> zstyle ":completion:*:$i:*" environ PATH="$SUDO_PATH"

FYI, _su doesn't currently support the environ style, so that isn't actually
doing anything for it.

I don't think using environ is a good idea for us. It'd update PATH just like
command-path ultimately does, but it happens sooner, it exports the change,
and because it supports multiple var=value pairs we'd have to do some weird
accounting to provide a default without ruining completion if someone uses it
to set HOME or whatever.

I think you're right that we probably need to do something for su and doas
too, though. I very rarely use them so i'd have to double-check how they
actually handle PATH

On 10 Feb 2020, at 13:20, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Might the user have set the command-path style in this context to
> an empty value (zero strings, which would count as false)? ...
> Could this style setting shadow a style the user had set explicitly?

Yes and yes. The first is easily fixed, but the second is weird due to how
zstyle weights patterns. That's an issue with cache-policy as well

On 10 Feb 2020, at 13:20, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> As an alternative, _sudo could set _comp_command_path=( $path
> $path/%\/bin//sbin ) and then _command_names could use that value if
> the style isn't set then.  The parameter would be made local by
> _main_complete.  This is similar to how, say, $precommands is handled.

That seems like it'd work. We could also give _command_names an option to do
it for us, similar to what we did recently with _normal. Both are API changes,
though, so we'd be stuck with it. Have to think about it

dana


      reply	other threads:[~2020-02-10 23:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <912d22db-8a8f-90f2-6738-f9f395994dcb@gmail.com>
     [not found] ` <CAN=4vMqvzUTZ7bBLcbTzi-pKAVEP1xDbq=f5pLAxmffxUjTszQ@mail.gmail.com>
     [not found]   ` <1770be62-54d8-70a6-8b05-cfc98faa9b9f@gmail.com>
     [not found]     ` <20200210030219.527a3ccf@tarpaulin.shahaf.local2>
     [not found]       ` <ADE72275-1311-44BE-9B1D-5E617E3D9F94@gmail.com>
2020-02-10 17:13         ` dana
2020-02-10 17:40           ` Peter Stephenson
2020-02-10 18:57             ` dana
2020-02-10 19:20           ` Daniel Shahaf
2020-02-11 10:12             ` Oliver Kiddle
2020-02-11 10:28               ` Setting/Querying cache-policy (was: Re: sudo autocompletion) Daniel Shahaf
2020-02-12 16:51                 ` dana
2020-02-13  1:21               ` sudo autocompletion dana
2020-02-13  1:29                 ` Bart Schaefer
2020-02-15 22:22                 ` Andrey Butirsky
2020-02-15 22:48                   ` dana
2020-03-11 21:57                     ` dana
2020-03-12 21:51                       ` Andrey Butirsky
2020-02-10 22:05           ` Andrey Butirsky
2020-02-10 23:02             ` dana [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A79F7436-C272-45EE-809F-C73E0D85096B@dana.is \
    --to=dana@dana.is \
    --cc=butirsky@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).