Re: [PATCH v3] test: replace notmuch_passwd_sanitize() with _libconfig_sanitize()

Subject: Re: [PATCH v3] test: replace notmuch_passwd_sanitize() with _libconfig_sanitize()

Date: Sun, 23 May 2021 21:34:03 -0500

To: Tomi Ollila

Cc: notmuch@notmuchmail.org

From: Felipe Contreras


On Fri, May 21, 2021 at 1:22 PM Tomi Ollila <tomi.ollila@iki.fi> wrote:
>
> On Fri, May 21 2021, Felipe Contreras wrote:
>
> > On Thu, May 20, 2021 at 2:43 AM Tomi Ollila <tomi.ollila@iki.fi> wrote:
> >>
> >> On Wed, May 19 2021, Felipe Contreras wrote:
> >>
> >> > On Wed, May 19, 2021 at 12:34 PM Tomi Ollila <tomi.ollila@iki.fi> wrote:
> >> >
> >> >> Haha, as we do _libconfig_sanitize < OUTPUT > OUTPUT.clean
> >> >> reading python script from stdin don't work (perl has __DATA__ ;).
> >> >> (bitten again, I did and tested the change... :D).
> >> >
> >> > That can be fixed with:
> >> >
> >> >   python /dev/fd/3 3<<EOF
> >> >   EOF
> >>
> >> According to
> >>
> >> https://unix.stackexchange.com/questions/123602/portability-of-file-descriptor-links
> >>
> >> that solution could be portable enough.
> >
> > What the operating system does doesn't really matter, bash emulates /dev/fd/x:
>
> In this case, /dev/fd/3 is given as a parameter to a command, not part of
> redirections -- bash cannot know how the program is going to use the
> arguments it gets...

Right. I did try doing the redirection inside the python code. That
also works fine, but I don't think there's a need of doing that unless
there's an actual issue with /dev/fd/3.

> > And as far as I know the testing framework only works correctly on bash... So...
> >
> >> Another way still using -c ... I've played to look how it actually looks is
> >> (diff since patch v3)
> >>
> >> -        sq = chr(39) # single quote
> >> -        l = l.replace(sq + name, sq + "USER_FULL_NAME", 1)
> >> +        l = l.replace("'\''" + name, "'\''USER_FULL_NAME", 1)
> >
> > Yes, that works too. But that's what I said in another mail that is
> > weird stuff. I had to read it again three times and then copy to a
> > proper text editor with monospace font to see if it was correct.
>
> To me '\'' is /idiomatic/ way to embed ' in the middle of a long argument
> string...

Maybe. I've written a lot of shell code and whenever that happens I
switch to double quotes. "foo 'quote' bar" is much more readable to me
than 'foo '\''quote'\'' bar'.

Cheers.

-- 
Felipe Contreras
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: