[v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs

Message ID 20200320065002.5410-1-sarosh.arif@emumba.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Sarosh Arif March 20, 2020, 6:50 a.m. UTC
  Bugzilla ID: 419
Cc: stable@dpdk.org
Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
---
 usertools/dpdk-setup.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
  

Comments

Sarosh Arif April 17, 2020, 12:50 p.m. UTC | #1
Hello,
If there is no objection on this patch then it can perhaps be applied.

On Fri, Mar 20, 2020 at 11:50 AM Sarosh Arif <sarosh.arif@emumba.com> wrote:

> Bugzilla ID: 419
> Cc: stable@dpdk.org
> Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
> ---
>  usertools/dpdk-setup.sh | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/usertools/dpdk-setup.sh b/usertools/dpdk-setup.sh
> index e5bbe9fee..c27f89c5f 100755
> --- a/usertools/dpdk-setup.sh
> +++ b/usertools/dpdk-setup.sh
> @@ -592,11 +592,17 @@ while [ "$QUIT" == "0" ]; do
>         echo "[$OPTION_NUM] Exit Script"
>         OPTIONS[$OPTION_NUM]="quit"
>         echo ""
> -       echo -n "Option: "
> -       read our_entry
> +       read -p "Option: " our_entry
> +       [ $? -eq 0 ] || exit 0
> +
>         echo ""
> -       ${OPTIONS[our_entry]} ${our_entry}
> -
> +       numeric="^[[:digit:]]+$"
> +       if [[ "$our_entry" =~ $numeric ]]; then
> +               ${OPTIONS[our_entry]} ${our_entry}
> +       else
> +               echo "Please enter a numeric value"
> +       fi
> +
>         if [ "$QUIT" == "0" ] ; then
>                 echo
>                 echo -n "Press enter to continue ..."; read
> --
> 2.17.1
>
>
  
Thomas Monjalon May 24, 2020, 5:04 p.m. UTC | #2
Hello,

17/04/2020 14:50, Sarosh Arif:
> Hello,
> If there is no objection on this patch then it can perhaps be applied.

There are 3 issues here:
1/ There is no maintainer for this script (and no review of the patch)
2/ There is no explanation in this patch (probably explaining the lack of review)
3/ There is a more recent patch (not a v3), probably superseding this one:
	https://patches.dpdk.org/patch/67855/



> On Fri, Mar 20, 2020 at 11:50 AM Sarosh Arif <sarosh.arif@emumba.com> wrote:
> 
> > Bugzilla ID: 419
> > Cc: stable@dpdk.org
> > Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
> > ---
> >  usertools/dpdk-setup.sh | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
  

Patch

diff --git a/usertools/dpdk-setup.sh b/usertools/dpdk-setup.sh
index e5bbe9fee..c27f89c5f 100755
--- a/usertools/dpdk-setup.sh
+++ b/usertools/dpdk-setup.sh
@@ -592,11 +592,17 @@  while [ "$QUIT" == "0" ]; do
 	echo "[$OPTION_NUM] Exit Script"
 	OPTIONS[$OPTION_NUM]="quit"
 	echo ""
-	echo -n "Option: "
-	read our_entry
+	read -p "Option: " our_entry
+       [ $? -eq 0 ] || exit 0
+
 	echo ""
-	${OPTIONS[our_entry]} ${our_entry}
-
+       numeric="^[[:digit:]]+$"
+       if [[ "$our_entry" =~ $numeric ]]; then
+     		${OPTIONS[our_entry]} ${our_entry}
+       else
+   		echo "Please enter a numeric value"
+       fi
+
 	if [ "$QUIT" == "0" ] ; then
 		echo
 		echo -n "Press enter to continue ..."; read