fix(tar): drop truthy-string default on store_true argparse flags (#1065)
The `--preserve_mode` and `--preserve_mtime` flags in
`pkg/private/tar/build_tar.py` were declared with `default='False'` (a
string, which is truthy) combined with `action='store_true'`. When the
flags are not passed on the command line, argparse uses the default
verbatim instead of the boolean `False` that `store_true` would produce,
so `options.preserve_mode` and `options.preserve_mtime` end up as the
string `'False'` — truthy under any natural truthy check.
rules_pkg's own use happens to be safe because the check is
`if self.preserve_mode is True`, but the typo is a foot-gun for anyone
copying the pattern.
Drop the bogus default — `action='store_true'` already defaults to
boolean `False`.
Fixes #1064
diff --git a/pkg/private/tar/build_tar.py b/pkg/private/tar/build_tar.py
index 1810207..900f284 100644
--- a/pkg/private/tar/build_tar.py
+++ b/pkg/private/tar/build_tar.py
@@ -414,11 +414,11 @@
action='store_true',
help='')
parser.add_argument(
- '--preserve_mode', default='False',
+ '--preserve_mode',
action='store_true',
help='Preserve original file permissions in the archive. Mode argument is ignored.')
parser.add_argument(
- '--preserve_mtime', default='False',
+ '--preserve_mtime',
action='store_true',
help='Preserve original file mtime in the archive. mtime argument is ignored.')
parser.add_argument(