[PATCH] mail: don't complain about a multi-word email.method config value

Yuya Nishihara yuya at tcha.org
Fri Nov 29 23:40:53 EST 2019


On Fri, 29 Nov 2019 19:20:50 +0100, Julien Cristau wrote:
> # HG changeset patch
> # User Julien Cristau <jcristau at debian.org>
> # Date 1575051591 -3600
> #      Fri Nov 29 19:19:51 2019 +0100
> # Node ID e962071e8bee30af8b3432e61b7f04acabbde0db
> # Parent  640bae94f2f31b1c1325ad2e5cf7f4a5a9dbebdd
> mail: don't complain about a multi-word email.method config value
> 
> I want to be able to set email.method to "ssh relay /usr/sbin/sendmail"
> without needing an extra trivial shell script.
> This works fine since we pass the full command to a shell, except for
> validateconfig trying to find it in $PATH.
> 
> diff --git a/mercurial/mail.py b/mercurial/mail.py
> --- a/mercurial/mail.py
> +++ b/mercurial/mail.py
> @@ -241,17 +241,18 @@ def validateconfig(ui):
>          if not ui.config(b'smtp', b'host'):
>              raise error.Abort(
>                  _(
>                      b'smtp specified as email transport, '
>                      b'but no smtp host configured'
>                  )
>              )
>      else:
> -        if not procutil.findexe(method):
> +        program = method.split(None, 1)[0]

b''.split() will return an empty list, and it's probably better to use
procutil.shellsplit().


More information about the Mercurial-devel mailing list