all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bengt Richter <bokr@bokr.com>
To: Chris Marusich <cmmarusich@gmail.com>
Cc: "Ludovic Courtès" <ludo@gnu.org>,
	53355@debbugs.gnu.org, 51466@debbugs.gnu.org
Subject: bug#53355: bug#51466: bug#53355: guix shell --check: confusing error message
Date: Mon, 20 Jun 2022 19:56:56 +0200	[thread overview]
Message-ID: <20220620175656.GA24590@LionPure> (raw)
In-Reply-To: <20220620101210.GA19777@LionPure>

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	other threads:[~2022-06-20 18:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19  3:29 bug#53355: guix shell --check: confusing error message Chris Marusich
2022-01-24 14:35 ` Ludovic Courtès
2022-01-25  0:55   ` Chris Marusich
2022-01-25 13:39     ` Ludovic Courtès
2022-02-02  7:49       ` bug#51466: " Chris Marusich
2022-02-08  9:26         ` Ludovic Courtès
2022-02-13 23:17           ` Chris Marusich
2022-02-14  9:47             ` Ludovic Courtès
2022-03-08 19:07               ` Ludovic Courtès
2022-05-20 21:37                 ` Ludovic Courtès
2022-05-24  4:42               ` Chris Marusich
2022-06-13 10:03                 ` Ludovic Courtès
2022-06-19 20:40                   ` Chris Marusich
2022-06-20  7:34                     ` bug#51466: " Ludovic Courtès
2022-06-20 10:12                     ` bug#53355: " bokr
2022-06-20 17:56                       ` Bengt Richter [this message]
2022-06-20 23:27                         ` bug#51466: " Bengt Richter
2022-06-21  4:00                           ` Thiago Jung Bauermann via Bug reports for GNU Guix
2022-06-25  9:07                 ` Chris Marusich
2022-06-25  9:37                   ` bug#53355: bug#51466: " Maxime Devos
2022-06-25 16:52                     ` Chris Marusich
2022-06-25 17:40                       ` Maxime Devos
2022-06-25 20:06                         ` bug#51466: " bokr
2022-06-25 21:04                           ` Maxime Devos
2022-06-26 10:33                         ` Josselin Poiret via Bug reports for GNU Guix
2022-06-26 13:07                           ` Maxime Devos
2022-06-26 19:45                             ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2022-06-27 10:17                   ` bug#51466: " Ludovic Courtès
2022-06-27 10:34                     ` bug#53355: " Maxime Devos
2022-06-28  7:45                       ` Ludovic Courtès
2022-06-28 10:38                         ` Maxime Devos
2022-06-28 16:57                           ` bug#53355: " paren--- via Bug reports for GNU Guix
2022-06-28 17:31                             ` bug#51466: " Maxime Devos
2022-07-04  8:11                             ` Ludovic Courtès
2022-06-27 11:23                     ` bokr
2022-06-27 14:22                       ` bug#51466: bug#53355: " Bengt Richter

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=20220620175656.GA24590@LionPure \
    --to=bokr@bokr.com \
    --cc=51466@debbugs.gnu.org \
    --cc=53355@debbugs.gnu.org \
    --cc=cmmarusich@gmail.com \
    --cc=ludo@gnu.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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.