patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs
       [not found] <20200319174423.28378>
@ 2020-03-20  6:50 ` Sarosh Arif
  2020-04-17 12:50   ` Sarosh Arif
  2020-06-01  8:40   ` [dpdk-stable] [PATCH v3] " Sarosh Arif
  0 siblings, 2 replies; 5+ messages in thread
From: Sarosh Arif @ 2020-03-20  6:50 UTC (permalink / raw)
  To: dev; +Cc: Sarosh Arif, stable

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs
  2020-03-20  6:50 ` [dpdk-stable] [PATCH v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs Sarosh Arif
@ 2020-04-17 12:50   ` Sarosh Arif
  2020-05-24 17:04     ` Thomas Monjalon
  2020-06-01  8:40   ` [dpdk-stable] [PATCH v3] " Sarosh Arif
  1 sibling, 1 reply; 5+ messages in thread
From: Sarosh Arif @ 2020-04-17 12:50 UTC (permalink / raw)
  To: dev; +Cc: stable

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
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [PATCH v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs
  2020-04-17 12:50   ` Sarosh Arif
@ 2020-05-24 17:04     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2020-05-24 17:04 UTC (permalink / raw)
  To: Sarosh Arif; +Cc: dev, stable, m.bilal

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(-)




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-stable] [PATCH v3] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs
  2020-03-20  6:50 ` [dpdk-stable] [PATCH v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs Sarosh Arif
  2020-04-17 12:50   ` Sarosh Arif
@ 2020-06-01  8:40   ` " Sarosh Arif
  2020-06-02  7:38     ` [dpdk-stable] [PATCH v4] " Sarosh Arif
  1 sibling, 1 reply; 5+ messages in thread
From: Sarosh Arif @ 2020-06-01  8:40 UTC (permalink / raw)
  To: dev, thomas; +Cc: m.bilal, stable, john.mcnamara, Sarosh Arif

Combine https://patches.dpdk.org/patch/67855/ with v2 of this patch to fix
the overall behaviour of dpdk-setup.sh on non-alphanumeric inputs.
Instead of crashing the script will prompt the user to re-enter the input 
in case of non-alphanumberic input. 

Bugzilla ID: 419
Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com> Muhammad Bilal <m.bilal@emumba.com>
---
 usertools/dpdk-setup.sh | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/usertools/dpdk-setup.sh b/usertools/dpdk-setup.sh
index e5bbe9fee..c18a6f3ee 100755
--- a/usertools/dpdk-setup.sh
+++ b/usertools/dpdk-setup.sh
@@ -320,14 +320,18 @@ set_non_numa_pages()
 	echo "  enter '64' to reserve 64 * 2MB pages"
 	echo -n "Number of pages: "
 	read Pages
+	numeric="^[[:digit:]]+$"
+	PG_PATH="/sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}"
+    if [[ $Pages =~ $numeric ]]; then
+		echo "echo $Pages > $PG_PATH/nr_hugepages" > .echo_tmp
+		echo "Reserving hugepages"
+		sudo sh .echo_tmp
+		rm -f .echo_tmp
+		create_mnt_huge
+	else
+		echo "Please enter a numeric value"
+	fi
 
-	echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" > .echo_tmp
-
-	echo "Reserving hugepages"
-	sudo sh .echo_tmp
-	rm -f .echo_tmp
-
-	create_mnt_huge
 }
 
 #
@@ -343,10 +347,16 @@ set_numa_pages()
 	echo "  enter '64' to reserve 64 * 2MB pages on each node"
 
 	echo > .echo_tmp
+	numeric="^[[:digit:]]+$"
 	for d in /sys/devices/system/node/node? ; do
 		node=$(basename $d)
 		echo -n "Number of pages for $node: "
 		read Pages
+		while [[ ! "$Pages" =~ $numeric ]]; do
+			echo "Please enter a numeric value"
+			echo -n "Number of pages for $node: "
+			read Pages
+		done
 		echo "echo $Pages > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp
 	done
 	echo "Reserving hugepages"
@@ -595,7 +605,11 @@ while [ "$QUIT" == "0" ]; do
 	echo -n "Option: "
 	read our_entry
 	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
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-stable] [PATCH v4] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs
  2020-06-01  8:40   ` [dpdk-stable] [PATCH v3] " Sarosh Arif
@ 2020-06-02  7:38     ` " Sarosh Arif
  0 siblings, 0 replies; 5+ messages in thread
From: Sarosh Arif @ 2020-06-02  7:38 UTC (permalink / raw)
  To: dev, thomas; +Cc: m.bilal, stable, john.mcnamara, Sarosh Arif

Combine https://patches.dpdk.org/patch/67855/ with v2 of this patch to fix
the overall behaviour of dpdk-setup.sh on non-alphanumeric inputs.
Instead of crashing the script will prompt the user to re-enter the input 
in case of non-alphanumeric input. 

Bugzilla ID: 419
Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
Signed-off-by: Muhammad Bilal <m.bilal@emumba.com>
---
v4: fix signoff
---
 usertools/dpdk-setup.sh | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/usertools/dpdk-setup.sh b/usertools/dpdk-setup.sh
index e5bbe9fee..69cd1d2bd 100755
--- a/usertools/dpdk-setup.sh
+++ b/usertools/dpdk-setup.sh
@@ -320,14 +320,18 @@ set_non_numa_pages()
 	echo "  enter '64' to reserve 64 * 2MB pages"
 	echo -n "Number of pages: "
 	read Pages
+	numeric="^[[:digit:]]+$"
+	PG_PATH="/sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}"
+       if [[ $Pages =~ $numeric ]]; then
+		echo "echo $Pages > $PG_PATH/nr_hugepages" > .echo_tmp
+		echo "Reserving hugepages"
+		sudo sh .echo_tmp
+		rm -f .echo_tmp
+		create_mnt_huge
+	else
+		echo "Please enter a numeric value"
+	fi
 
-	echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" > .echo_tmp
-
-	echo "Reserving hugepages"
-	sudo sh .echo_tmp
-	rm -f .echo_tmp
-
-	create_mnt_huge
 }
 
 #
@@ -343,10 +347,16 @@ set_numa_pages()
 	echo "  enter '64' to reserve 64 * 2MB pages on each node"
 
 	echo > .echo_tmp
+	numeric="^[[:digit:]]+$"
 	for d in /sys/devices/system/node/node? ; do
 		node=$(basename $d)
 		echo -n "Number of pages for $node: "
 		read Pages
+		while [[ ! "$Pages" =~ $numeric ]]; do
+			echo "Please enter a numeric value"
+			echo -n "Number of pages for $node: "
+			read Pages
+		done
 		echo "echo $Pages > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp
 	done
 	echo "Reserving hugepages"
@@ -592,10 +602,15 @@ while [ "$QUIT" == "0" ]; do
 	echo "[$OPTION_NUM] Exit Script"
 	OPTIONS[$OPTION_NUM]="quit"
 	echo ""
-	echo -n "Option: "
-	read our_entry
-	echo ""
-	${OPTIONS[our_entry]} ${our_entry}
+	read -p "Option: " our_entry
+       [ $? -eq 0 ] || exit 0
+
+ 	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
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200319174423.28378>
2020-03-20  6:50 ` [dpdk-stable] [PATCH v2] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs Sarosh Arif
2020-04-17 12:50   ` Sarosh Arif
2020-05-24 17:04     ` Thomas Monjalon
2020-06-01  8:40   ` [dpdk-stable] [PATCH v3] " Sarosh Arif
2020-06-02  7:38     ` [dpdk-stable] [PATCH v4] " Sarosh Arif

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox