public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Eryu Guan <eguan@redhat.com>
Cc: fstests@vger.kernel.org, sandeen@sandeen.net
Subject: Re: [PATCH] new: validate groups when creating new test
Date: Thu, 3 Aug 2017 07:53:43 -0400	[thread overview]
Message-ID: <20170803115342.GC62447@bfoster.bfoster> (raw)
In-Reply-To: <20170728062522.16916-1-eguan@redhat.com>

On Fri, Jul 28, 2017 at 02:25:22PM +0800, Eryu Guan wrote:
> Allow only lower case letters, digits, spaces and underscore when
> adding groups, give prompt if there's any not-allowed characters.
> Also remove redundant spaces between groups.
> 
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  new | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/new b/new
> index eb7da0ff463b..4eacccd3bf8b 100755
> --- a/new
> +++ b/new
> @@ -239,7 +239,7 @@ then
>  
>      while true
>      do
> -	echo -n "Add to group(s) [other] (? for list): "
> +	echo -n "Add to group(s) [other] (separate by space, ? for list): "
>  	read ans
>  	[ -z "$ans" ] && ans=other
>  	if [ "X$ans" = "X?" ]
> @@ -254,7 +254,17 @@ then
>  	    lst=`for word in $grpl; do echo $word; done | sort| uniq `
>  	    echo $lst
>  	else
> -	    break
> +	    # only allow lower cases, spaces, digits and underscore in group
> +	    inval=`echo $ans | tr -d '[:lower:][:space:][:digit:]_'`
> +	    if [ "$inval" != "" ]; then
> +		echo "Invalid characters in group(s): $inval"
> +		echo "Only lower cases, digits and underscore are allowed in groups, separated by space"
> +		continue
> +	    else
> +		# remove redundant spaces/tabs
> +		ans=`echo "$ans" | sed 's/\s\+/ /g'`
> +		break
> +	    fi
>  	fi
>      done
>  else
> -- 
> 2.13.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2017-08-03 11:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28  6:25 [PATCH] new: validate groups when creating new test Eryu Guan
2017-08-03 11:53 ` Brian Foster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170803115342.GC62447@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox