Re: [PATCH 9/9] new: don't allow new tests in group 'other'

Amir Goldstein
2021-09-16T06:41:07Z

On Thu, Sep 16, 2021 at 2:43 AM Darrick J. Wong <djwong@kernel.org> wrote:
>
> From: Darrick J. Wong <djwong@kernel.org>
>
> The 'other' group is vaguely defined at best -- other than what? It's
> not clear what tests belong in this group, and it has become a dumping
> ground for random stuff that are classified in other groups. Don't let
> people create new other group tests.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> new | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
>
> diff --git a/new b/new
> index 6b7dc5d4..5cf96c50 100755
> --- a/new
> +++ b/new
> @@ -96,9 +96,9 @@ then
>
> while true
> do
> - echo -n "Add to group(s) [other] (separate by space, ? for list): "
> + echo -n "Add to group(s) [auto] (separate by space, ? for list): "
> read ans
> - [ -z "$ans" ] && ans=other
> + [ -z "$ans" ] && ans=auto
> if [ "X$ans" = "X?" ]
> then
> echo $(group_names)
> @@ -109,6 +109,9 @@ then
> echo "Invalid characters in group(s): $inval"
> echo "Only lower cases, digits and underscore are allowed in groups, separated by space"
> continue
> + elif echo "$ans" | grep -q -w "other"; then
> + echo "Do not add more tests to group \"other\"."
> + continue

Should we also filter out "other" from group_names(), so it is not listed
for "?"?
With this patch, "other" does not emit a warning when passed in as a script
command line argument.
If we filter "other" from group_names(), then the warning in "expert mode"
will be a bit confusing (group "other" not defined in documentation).

Also, it is not clear to me if this is intentional behavior that interactive
mode allows non-dcumented groups (with valid chars validation) and
expert mode does not allow non-documented groups?

It may be simpler to use the same helper in both modes (is_group_valid)
to emit the correct warning and either proceed (expert mode) or get
back to prompt (interactive mode).

Thanks,
Amir.