zsh-workers
 help / color / mirror / code / Atom feed
From: "Daniel Shahaf" <d.s@daniel.shahaf.name>
To: "Peter Stephenson" <p.w.stephenson@ntlworld.com>
Cc: zsh-workers@zsh.org
Subject: Re: Bug + patch: `zstyle ':completion:*' menu select=long-list` fails to start menu selection
Date: Sat, 13 Mar 2021 13:40:37 +0000	[thread overview]
Message-ID: <8dcedcce-b95c-4097-a379-f0777d708f72@www.fastmail.com> (raw)
In-Reply-To: <884654866.425858.1615560127191@mail2.virginmedia.com>

Replying on-list with permission and fullquote.

Peter Stephenson wrote on Fri, 12 Mar 2021 14:42 +00:00:
> > On 12 March 2021 at 14:14 Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > Peter Stephenson wrote on Fri, 12 Mar 2021 13:36 +00:00:
> > > 
> > > > On 12 March 2021 at 13:11 Marlon Richert <marlon.richert@gmail.com> wrote:
> > > > 
> > > > 
> > > > I found the culprit: I had
> > > > 
> > > > export GREP_OPTIONS='--color=always'
> > > > 
> > > > in my `.zshrc` file and that mangled the .mdd file names.
> > > 
> > > It's probably worth having the following.  It doesn't cover all the
> > > possible cases where you can get into trouble, but it's a useful
> > > blanket for the standard case where everything is done immediately
> > > from configure.
> > > 
> > 
> > I'm not sure I agree.
> > 
> > - This seems to be a cases of "hard cases make bad law".  Setting
> >   --color=always in the environment will break any script that expects
> >   grep(1)'s standard semantics, not just configure.  The patch just
> >   papers over the problem.
> > 
> > - We shouldn't second-guess the user.  If the user has GREP_OPTIONS set
> >   in the environment, that might actually be needed in order to have
> >   grep(1) behave correctly.  What if some system uses GREP_OPTIONS to
> >   make its grep(1) tool behave POSIX compatibly?
> 
> I think that's missing the point of the patch, which is that for anyone
> setting up zsh, configure should just run in a sandbox with whatever is
> going on outside irrelevant to it;

It is an API promise of autoconf that AC_PROG_GREP will use the
environment variable $GREP to find a grep program.

I would therefore expect «GREP=/bin/foo GREP_OPTIONS=bar ./configure» to
also be supported, even for values of foo other than GNU grep.

> it's an implementation detail that it's a shell script at all.

Well, yes, configure could be implemented in Rust for all anyone cares,
but it would still have to obey that API promise about the "GREP"
environment variable.

> GREP_OPTIONS is a user extension, there's no
> question of it being needed for POSIX --- GNU do things this way exactly so
> that if you have a vanilla environment it is basically (but not necessarily
> completely, as this is a complicated area) POSIXy.
> 

In GNU's case, yes, but non-GNU implementations of grep may also use
envvars named GREP_OPTIONS, and your patch could easily break those.

Even with GNU grep, I could imagine someone setting
GREP_OPTIONS=--exclude='.git', and then a configure script using «grep -R»
if $GREP happened to be GNU grep.  (even if zsh's configure script doesn't do that)

Also, someone might run «CC=/my/wrapper ./configure» where /my/wrapper
is a shell script that uses grep and relies on GREP_OPTIONS being set.

> If you do feel the need to pursue a more complicated path, however, you're
> welcome to do so and I'll keep out of the way.
> 

Let's take a step back, please.  You proposed a change.  I don't think
that change is a good one to make.  For instance, consider that if the
patch is a good change, it would need to be applied to every single
configure script out there; actually, to _every single portable script_
that uses grep.

I view the issue as a bug in Marlon's dotfiles; a bug which he has
discovered and fixed.  The failure mode wasn't ideal, of course, and we
could look into improving that; for example, by s/grep/$GREP/ as I
suggested and proposing a "look for colour codes in the output" logic to
AC_PROG_GREP.

I did propose further alternatives upthread and I welcome feedback and
questions on them.

And needless to say, I didn't mean to discourage you from participating.

> > - If this fix is needed, we should send it to autoconf upstream to be
> >   incorporated into AC_PROG_GREP.
> 
> That does sound entirely reasonable, if no one's noticed yet.

*nod*

Cheers,

Daniel


  parent reply	other threads:[~2021-03-13 13:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04  8:56 Marlon Richert
2021-03-04 20:17 ` Daniel Shahaf
2021-03-04 22:26   ` Marlon Richert
2021-03-07 17:22     ` Daniel Shahaf
2021-03-09 17:01       ` Marlon Richert
2021-03-09 21:19         ` Daniel Shahaf
2021-03-09 21:48         ` Bart Schaefer
2021-03-10  7:21           ` Marlon Richert
2021-03-10 18:50             ` Bart Schaefer
2021-03-11  2:17               ` Bart Schaefer
2021-03-11  7:33               ` Marlon Richert
2021-03-11 18:22                 ` Bart Schaefer
2021-03-12 13:11                 ` Marlon Richert
2021-03-12 13:36                   ` Peter Stephenson
2021-03-12 14:14                     ` Daniel Shahaf
2021-03-12 20:53                       ` Mikael Magnusson
     [not found]                       ` <884654866.425858.1615560127191@mail2.virginmedia.com>
2021-03-13 13:40                         ` Daniel Shahaf [this message]
2021-03-13 17:38                           ` Peter Stephenson
2021-03-13 18:08                             ` Bart Schaefer
2021-03-14  7:39                               ` dana
2021-03-14  9:30   ` Marlon Richert
2021-03-17 18:01     ` dana
2021-03-25  0:46       ` Daniel Shahaf

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=8dcedcce-b95c-4097-a379-f0777d708f72@www.fastmail.com \
    --to=d.s@daniel.shahaf.name \
    --cc=p.w.stephenson@ntlworld.com \
    --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).