unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: "notmuch@notmuchmail.org" <notmuch@notmuchmail.org>
Subject: Re: [PATCH v3] test: replace notmuch_passwd_sanitize() with _libconfig_sanitize()
Date: Fri, 21 May 2021 21:22:26 +0300	[thread overview]
Message-ID: <m2sg2gdk0t.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <CAMP44s3OjCj9x0yrfL2ogGBoEHRnC8j7YkSC3AKEWmvkgTQ+_g@mail.gmail.com>

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...

Anyway, the [PATCH v4] in id:20210520134628.11653-1-tomi.ollila@iki.fi
implemented your suggestion ${NOTMUCH_PYTHON} /dev/fd/3 3<<'EOF' ...

> "If the operating system on which Bash is running provides these
> special files, bash will use them; otherwise it will emulate them
> internally with the behavior described below."
>
> https://www.gnu.org/software/bash/manual/html_node/Redirections.html

... "Bash handles several filenames specially when they are used in
redirections, as described in the following table." is just before
your snippet >;D

>
> 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...


>> Tested the above. That python /dev/fd/3 3<<EOF is so neat it at least
>> have to be tested to see how it looks like and behaves... :D
>
> Yeap. Took me a while to find the right documentation to figure that
> out, but in my opinion it's better to write a helper for the tests
> once, and then forget about it and just re-use it for all.
>
> -- 
> Felipe Contreras

  reply	other threads:[~2021-05-21 18:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18  5:54 [PATCH v3] test: replace notmuch_passwd_sanitize() with _libconfig_sanitize() Tomi Ollila
2021-05-19  7:29 ` Felipe Contreras
2021-05-19  8:44   ` Tomi Ollila
2021-05-19 17:34     ` Tomi Ollila
2021-05-19 19:51       ` Felipe Contreras
2021-05-20  7:43         ` Tomi Ollila
2021-05-21  9:46           ` Felipe Contreras
2021-05-21 18:22             ` Tomi Ollila [this message]
2021-05-24  2:34               ` Felipe Contreras

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

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2sg2gdk0t.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=felipe.contreras@gmail.com \
    --cc=notmuch@notmuchmail.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://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).