bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#53355: bug#51466: bug#53355: guix shell --check: confusing error mes


From: Bengt Richter
Subject: bug#53355: bug#51466: bug#53355: guix shell --check: confusing error message
Date: Tue, 21 Jun 2022 01:27:49 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

Sorry again, but I found the source:

tl;dr: These functions are defined in
    /usr/share/bash-completion/bash_completion
which looks awful kludgey to me, (however clever :)

There is a reference to
    http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00155.html
in the header comments for
    _quote_readline_by_ref () 

I also found
    
https://askubuntu.com/questions/571544/bash-tab-completion-bash-unexpected-eof-while-looking-for-matching-bash
My bet is there is at least one bug active now.

Completion is really nice when it works, but IMO they certainly
shouldn't use a name like unadorned ``quote'' in their implementation.

And I think it would be prettier in scheme :)
Lots could be prettier if bash could be extended with scheme.

I'm about out of time to chase this, but I expect to bump into it again ;/
HTH.
--
Regards,
Bengt Richter

On +2022-06-20 19:56:56 +0200, Bengt Richter wrote:
> Sorry to reply to myself, but forgot to illustrate.
> 
> On +2022-06-20 12:12:10 +0200, bokr@bokr.com wrote:
> > Hi Chris,
> [...]
> > 
> > I have had some mystery bash parsing errors, and I noticed
> >     set|less
> > shows a heck of a lot of functions defined that I don't
> > remember seeing in the past. 
> > Anyway, shouldn't stuff like that have better hygiene than just prefixed
> > _underscore ? Or maybe set|less doesn't show all that on your system?
> >
> 
> There are a couple functions without prefixed underscore too,
> which invoke some underscore-prefixed ones that look too trusting
> of their arguments if you ask me: can someone declare these safe?
> 
>     I think I can grok quote () ...
> (escape single quotes and enclose result in single quotes, trusting bash 
> state)
> But what if I want to define my own function quote?? How would I know I was
> overriding this? I really don't like my programming space occupied by 
> unknowns :-(
> 
> --8<---------------cut here---------------start------------->8---
> quote () 
> { 
>     local quoted=${1//\'/\'\\\'\'};
>     printf "'%s'" "$quoted"
> }
> --8<---------------cut here---------------end--------------->8---
> 
>     but this one below will take more time than I want to spend on code
> I'm not intentionally going to use, and which invites name clashes
> in my command name space :-(
> 
> --8<---------------cut here---------------start------------->8---
> quote_readline () 
> { 
>     local quoted;
>     _quote_readline_by_ref "$1" ret;
>     printf %s "$ret"
> }
> --8<---------------cut here---------------end--------------->8---
> 
>     where the above calls this:
> 
> --8<---------------cut here---------------start------------->8---
> _quote_readline_by_ref () 
> { 
>     if [ -z "$1" ]; then
>         printf -v $2 %s "$1";
>     else
>         if [[ $1 == \'* ]]; then
>             printf -v $2 %s "${1:1}";
>         else
>             if [[ $1 == ~* ]]; then
>                 printf -v $2 ~%q "${1:1}";
>             else
>                 printf -v $2 %q "$1";
>             fi;
>         fi;
>     fi;
>     [[ ${!2} == \$* ]] && eval $2=${!2}
> }
> --8<---------------cut here---------------end--------------->8---
> 
> HTH somehow.
> --
> Regards,
> Bengt Richter
> 
> 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]