[PATCH rtems-tools] rtems-bsp-builder: Fix mail support

Chris Johns chrisj at rtems.org
Thu Oct 28 23:19:19 UTC 2021


OK

Thanks
Chris

On 29/10/21 7:01 am, Alex White wrote:
> This fixes a problem with mailer options support that occurred because
> check.py uses argparse.ArgumentParser instead of tester.rt.options.
> ---
>  rtemstoolkit/mailer.py |  2 +-
>  tester/rt/check.py     | 17 ++++++++++++++++-
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/rtemstoolkit/mailer.py b/rtemstoolkit/mailer.py
> index 085a2ce..32cbc23 100644
> --- a/rtemstoolkit/mailer.py
> +++ b/rtemstoolkit/mailer.py
> @@ -70,7 +70,7 @@ class mail:
>      def __init__(self, opts):
>          self.opts = opts
>          self.gitconfig_lines = None
> -        if opts.find_arg('--use-gitconfig') is not None:
> +        if self._get_arg('--use-gitconfig'):
>              # Read the output of `git config --list` instead of reading the
>              # .gitconfig file directly because Python 2 ConfigParser does not
>              # accept tabs at the beginning of lines.
> diff --git a/tester/rt/check.py b/tester/rt/check.py
> index c01c25d..ec92e7e 100755
> --- a/tester/rt/check.py
> +++ b/tester/rt/check.py
> @@ -105,7 +105,22 @@ def title():
>      return 'RTEMS Tools Project - RTEMS Kernel BSP Builder, %s' % (version.string())
>  
>  def command_line():
> -    return wrap(('command: ', ' '.join(sys.argv)), lineend = '\\')
> +    # Filter potentially sensitive mail options out.
> +    filtered_args = [
> +        arg for arg in sys.argv
> +        if all(
> +            smtp_opt not in arg
> +            for smtp_opt in [
> +                '--smtp-host',
> +                '--mail-to',
> +                '--mail-from',
> +                '--smtp-user',
> +                '--smtp-password',
> +                '--smtp-port'
> +            ]
> +        )
> +    ]
> +    return wrap(('command: ', ' '.join(filtered_args)), lineend = '\\')
>  
>  def jobs_option_parse(jobs_option):
>      try:
> 


More information about the devel mailing list