Received: by 2002:ab3:5012:0:b0:1d7:b7fe:f8b7 with SMTP id y18csp3087181ltb; Tue, 9 Aug 2022 12:19:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR4R9AXxtfTiKcFJ0OTFCIQpOIRzpTJcRJzNLmP6F87IOOC0nWXWyZEYE87YeAJH8M5dF6iS X-Received: by 2002:a17:907:969f:b0:730:b649:ff90 with SMTP id hd31-20020a170907969f00b00730b649ff90mr17894563ejc.337.1660072750515; Tue, 09 Aug 2022 12:19:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660072750; cv=none; d=google.com; s=arc-20160816; b=g0ypoCP0o2x1G8jWWUfY+wOHP0bV11DVruhDwXlMxR5opLHt/7I9bIivNhtuKU/WQm E/w5JOwkQUKQEEBJ6p4YGwDsbur72+ltEPFoZWgajqBXm6BDjtSc7gxG9ptPCRYyjB1l Dsu04hMJfr/oZ256eG2TgqYorWf6njj1zbBXmVBUiM/d0p6OGclsE7hiDCbnrLZRuhWp 0a9LNRx5Oqua5oGqSbEc+8mKCMFPsihntWCgxZwl0cnmpUXeemuIaYhMjq6DXU7dXGep T4CQRNXwSilp09aYnpiO9USjGZmDTjXLvPFz3w4NqSLjI37a2LhbSLXGfu5gmwl6yGjI pQfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FtlAPUZQyKLZDVSKCyjQIPVu6UTWDJtUTYRb8G4jInE=; b=z2V98br77qM5fTClCkT4G8hB7ur3wkiM8P24L7xYqezusNRnpEMqRbKwbiLLbvOKTy UpHbietEqlh2JS74G8QrV6CfvoHSZKWtBuYh/Zs+1BvimrhjcwLefODKQ+JN+IVzOvjb rumRFWZ6uokLAVMMR2tHBd9zsjpjxd0tBSrepXDKwKCEE96UxRncQKfd049T4Km89PDE 8TTeqWuL21vbNivwOCWedAgDWlirAiCvshloa0RvbrfwSCw1+zQs8vaHVRX/7O7yrveg wQuSrajpfP7WK7VLmfvDK8z5IdIhFDudJdpvtYBkt7pkoJspSjUa6/3zdpb+ii+JGjBC zpLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b="P/mxWtIU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a05640227d100b0043d18471439si11022639ede.154.2022.08.09.12.18.44; Tue, 09 Aug 2022 12:19:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b="P/mxWtIU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344209AbiHISoS (ORCPT + 99 others); Tue, 9 Aug 2022 14:44:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344442AbiHISnu (ORCPT ); Tue, 9 Aug 2022 14:43:50 -0400 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D10542CDDE for ; Tue, 9 Aug 2022 11:18:56 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 3A29E240027 for ; Tue, 9 Aug 2022 20:18:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1660069133; bh=NGCo6G97/D+DFJHZEJlgWxPMh8d5YJ9QKfmC0rdGXPg=; h=Date:From:To:Cc:Subject:From; b=P/mxWtIU+OhwQ0G3Uxiusi2rd9Vegpev4L6kn5k0jNSHX+CTLlDbfJdyydrracDuO qBnDiDVSl6RxS9ARPNktSNfOR0BWvRDacnPGj4Y79+ADCB1zg8chRQ5CxjZtbBIqHs UaOau8SAS0EPEY0qMGuhaNl2krDGRS5oS0x1zTGtae70imGR51kU7xU5wanB9q/26V f/nkyghmxfyOcmS128S7yA/UKAK2IQspLtEi/5TXWLXlFFEsM4t1bcGJsNdtZXE1+2 pBQB0k0Tty7yXZt+CTJue2oqXl2HfrVcmX3j6fpiAKlM9kpFVhWNGRmcE8VZw3LzJa 7L4WDsRPTyVow== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4M2LtL13Xqz6tn7; Tue, 9 Aug 2022 20:18:49 +0200 (CEST) Date: Tue, 9 Aug 2022 18:18:45 +0000 From: Daniel =?utf-8?Q?M=C3=BCller?= To: Daniel Xu Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kpsingh@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: Fix vmtest.sh getopts optstring Message-ID: <20220809181845.bkmrgogdgd3divfj@muellerd-fedora-PC2BDTX9> References: <0f93b56198328b6b4da7b4cf4662d05c3edb5fd2.1660064925.git.dxu@dxuuu.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0f93b56198328b6b4da7b4cf4662d05c3edb5fd2.1660064925.git.dxu@dxuuu.xyz> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 09, 2022 at 11:11:10AM -0600, Daniel Xu wrote: > Before, you could see the following errors: > > ``` > $ ./vmtest.sh -j > ./vmtest.sh: option requires an argument -- j > ./vmtest.sh: line 357: OPTARG: unbound variable > > $ ./vmtest.sh -z > ./vmtest.sh: illegal option -- z > ./vmtest.sh: line 357: OPTARG: unbound variable > ``` > > Fix by adding ':' as first character of optstring. Reason is that > getopts requires ':' as the first character for OPTARG to be set in the > `?` and `:` error cases. > > Signed-off-by: Daniel Xu > --- > tools/testing/selftests/bpf/vmtest.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh > index 976ef7585b33..a29aa05ebb3e 100755 > --- a/tools/testing/selftests/bpf/vmtest.sh > +++ b/tools/testing/selftests/bpf/vmtest.sh > @@ -333,7 +333,7 @@ main() > local exit_command="poweroff -f" > local debug_shell="no" > > - while getopts 'hskid:j:' opt; do > + while getopts ':hskid:j:' opt; do > case ${opt} in > i) > update_image="yes" > -- > 2.37.1 > I tested with this change and it worked fine for me. One thing to consider pointing out more clearly in the description is that ':' as the first character of the optstring switches getopts to silent mode. The desire to run in this mode seems to have been there all along, as the script takes care of reporting errors. Acked-by: Daniel M?ller