diff options
author | Alex White <alex.white@oarcorp.com> | 2021-10-28 14:58:37 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2021-12-16 15:26:39 -0600 |
commit | bdd785a39769d0b59a651171e98532d6783a283a (patch) | |
tree | 6c15fb5b28f6d7d9b272f4330318642086568df9 | |
parent | rtemstoolkit/mailer.py: Add --use-gitconfig option (diff) | |
download | rtems-tools-bdd785a39769d0b59a651171e98532d6783a283a.tar.bz2 |
rtems-bsp-builder: Fix mail support
This fixes a problem with mailer options support that occurred because
check.py uses argparse.ArgumentParser instead of tester.rt.options.
Closes #4553
-rw-r--r-- | rtemstoolkit/mailer.py | 5 | ||||
-rwxr-xr-x | tester/rt/check.py | 17 |
2 files changed, 19 insertions, 3 deletions
diff --git a/rtemstoolkit/mailer.py b/rtemstoolkit/mailer.py index ae51d78..09e4a26 100644 --- a/rtemstoolkit/mailer.py +++ b/rtemstoolkit/mailer.py @@ -61,14 +61,15 @@ def append_options(opts): def add_arguments(argsp): argsp.add_argument('--mail', help = _options['--mail'], action = 'store_true') argsp.add_argument('--use-gitconfig', help = _options['--use-gitconfig'], action = 'store_true') - for o in list(_options)[1:]: + no_add = ['--mail', '--use-gitconfig'] + for o in [opt for opt in list(_options) if opt not in no_add]: argsp.add_argument(o, help = _options[o], type = str) 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 2a38d99..deac19d 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: |