unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: Joseph Mingrone <jrm@ftfl.ca>, Tomi Ollila <tomi.ollila@iki.fi>
Cc: notmuch@freelists.org, notmuch@notmuchmail.org
Subject: Re: proposed patches to notmuch-emacs-mua
Date: Sun, 20 Aug 2017 15:33:09 +0300	[thread overview]
Message-ID: <87fucml8qi.fsf@nikula.org> (raw)
In-Reply-To: <861so7i9xy.fsf@phe.ftfl.ca>

On Sat, 19 Aug 2017, Joseph Mingrone <jrm@ftfl.ca> wrote:
> Hello Tomi,
>
> Tomi Ollila <tomi.ollila@iki.fi> writes:
>> I'd like to know why bash is to be replaced; (e.g. since it is not in base
>> system, but so not is e.g. emacs...)
>
>> if this couple of order of magnitude heavier solution is used, then it
>> could be first checked whether to do so; e.g using case $3 in *['"\']*) and
>> and then do escaping on the need basis (an option to use posix shell
>> constructs to do such a thing looks probably too complicated... (*))
>
> Indeed, bash could be pulled in as a dependency to notmuch, but I'm
> shell shocked to hear you say the POSIX sh solution is an order of
> magnitude heavier than the bash solution.  Building on your suggestion,
> maybe this function is a reasonable alternative that doesn't call an
> external command.
>
> escape ()
> {
>   r=$3 p=
>   while case $r in *\\*) true ;; *) false ;; esac; do
>     p=$p${r%%\\*}\\\\ r=${r#*\\}
>   done
>   r="$p$r" p=
>
>   while case $r in *\"*) true ;; *) false ;; esac; do
>     p=$p${r%%\"*}\\\" r=${r#*\"}
>   done
>
>   eval "$2=\$p\$r"
> }
>
> It's no big deal either way.  I just followed a convention when updating
> the FreeBSD notmuch package.  If the script is close to POSIX
> compliance, then patch out the bashisms, otherwise pull in bash.  Why
> not attempt to comply to a standard and not pull in an external
> dependency (for some systems) when the script is already so close?  I
> thought I would upstream those changes in case they were useful.

IMHO don't fix it if it isn't broken. The proposed solutions to "fix"
the bashism are more complicated than the original, and might introduce
bugs. And sticking to sh here blocks future use of useful bashisms.

BR,
Jani.

      parent reply	other threads:[~2017-08-20 12:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <86lgngplvt.fsf@phe.ftfl.ca>
2017-08-19 11:32 ` proposed patches to notmuch-emacs-mua Tomi Ollila
     [not found]   ` <861so7i9xy.fsf@phe.ftfl.ca>
2017-08-19 21:31     ` Tomi Ollila
2017-08-20 12:33     ` Jani Nikula [this message]

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=87fucml8qi.fsf@nikula.org \
    --to=jani@nikula.org \
    --cc=jrm@ftfl.ca \
    --cc=notmuch@freelists.org \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /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).