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

Re: Bug + patch: `zstyle ':completion:*' menu select=long-list` fails to start menu selection



Peter Stephenson wrote on Fri, 12 Mar 2021 13:36 +00:00:
> 
> > On 12 March 2021 at 13:11 Marlon Richert <marlon.richert@xxxxxxxxx> 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?

- If this fix is needed, we should send it to autoconf upstream to be
  incorporated into AC_PROG_GREP.

Instead, I propose:

- Audit configure.ac and make sure we use $GREP rather than grep.
  Perhaps push this into the makefiles and build scripts too.

- Consider issueing a notice if GREP_OPTIONS is set, or proposing to
  upstream to have AC_PROG_GREP do so.

- Sending a documentation patch to grep(1)'s man page to point out that
  using --color=always globally or on the left hand side of a pipe is
  inadvisable.

Makes sense?

Cheers,

Daniel


> diff --git a/configure.ac b/configure.ac
> index 16dafac05..41006d67d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -30,6 +30,9 @@ AC_CONFIG_SRCDIR([Src/zsh.h])
>  AC_PREREQ([2.69])
>  AC_CONFIG_HEADER(config.h)
>  
> +dnl Configure uses grep widely, make sure output is uncorrupted.
> +unset GREP_OPTIONS
> +
>  dnl What version of zsh are we building ?
>  . ${srcdir}/Config/version.mk
>  echo "configuring for zsh $VERSION"
> 
>




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