From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4ED15A0521; Thu, 23 Jul 2020 14:13:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8CB2F1C012; Thu, 23 Jul 2020 14:13:56 +0200 (CEST) Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by dpdk.org (Postfix) with ESMTP id 6A12E1BFFA for ; Thu, 23 Jul 2020 14:13:54 +0200 (CEST) Received: by mail-io1-f68.google.com with SMTP id k23so5905842iom.10 for ; Thu, 23 Jul 2020 05:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UI4RMtOtzOwRQEzn3LnB1M9cZvYa0WUs7ckjw6du6XM=; b=CoUhZPjVSrmdTtFNWmOy22liA6bjSCS7LfGUHM9r5UT6HXAbkr4aWWSEW+pV4zvdPQ EHYo5Y/0QX5lJPyLHgZltHKuc3mVOEsHpqnNPGA3gWSgx3/k9wEuPBTx6VFEpVHxsFlR taakyt57Oa2x97VY/cg65SDC6lK7DjLsyG6pGh+X9BrBprxC1tTZLfLyIBSWyMyWEQjN Du1PfJkuZM9xtbQPHqq8YXe+B88o95O9ABsLXS1ZwG/8JpvVbWpO+r4TnzIpvk0jkJ/q X8OO3KH9xQzEeAqRGsAZR5SCLjgaaRWLj5DB4ngQKICb1E2d0eyyrLjk/PP3goU845K5 fGMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UI4RMtOtzOwRQEzn3LnB1M9cZvYa0WUs7ckjw6du6XM=; b=BKtEd0q411Fol5DTflOhiYb4js8wdKz1558LjtEoHryYlBDwVjPNiACuiFOK8S7WoE 6vXjNjtU8/iHyyq5/5h93en6xNtEggoVmw3W2LbbtyVi9WgrRP2Tsp8YNUjsZprQ+Ko/ 5lv1zbX7nL9v325v0p77nIJm2g0N0RUrBU8tlgVUQ1Bk+lTunBrY+BIv3Bf0wtnW/+5f r8Np3xRi9czZP1NBRVT/KlwZu75oGGX4BeArTSSAGVEOhvdsht/1fIPJmVRb1HWiS8zf v1gPIJNF8hdp9C7Z0TWqRWqIwEv9g5ScFIvfQ6oLWM67kOXV09itjcCJQhOLLZ/9wddR Yipw== X-Gm-Message-State: AOAM532QoWCZdygCrEcMmbfxOlAMfXTXSIunztOSq0jvbNoK3Iql3sk+ 0VfkMtz18LSE75nk/P51nciN8pm4+Zl6yiggY9BEd1Ahkl8= X-Google-Smtp-Source: ABdhPJzxGFoGzQBITUGftf3r4ipXv1caIliI3xjYWq9NPttH9bLYW9V2y7cNuby8lh6cbxlXFx4It1E3fdJzYWpPNgE= X-Received: by 2002:a6b:3ac6:: with SMTP id h189mr4558951ioa.78.1595506433577; Thu, 23 Jul 2020 05:13:53 -0700 (PDT) MIME-Version: 1.0 References: <20200601084028.20872-1-sarosh.arif@emumba.com> <20200602073813.1484-1-sarosh.arif@emumba.com> In-Reply-To: <20200602073813.1484-1-sarosh.arif@emumba.com> From: Sarosh Arif Date: Thu, 23 Jul 2020 17:13:17 +0500 Message-ID: To: dev@dpdk.org, Thomas Monjalon Cc: Muhammad Bilal , stable@dpdk.org, "Mcnamara, John" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v4] usertools/dpdk-setup.sh: fix dpdk-setup's behaviour on non-alphanumeric inputs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Since this script has no maintainer who is responsible for providing ACK or NAK on the patches related to this script? On Tue, Jun 2, 2020 at 12:39 PM Sarosh Arif wrote: > 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 > Signed-off-by: Muhammad Bilal > --- > 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 > >