Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6492141pxu; Thu, 24 Dec 2020 03:59:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7sA1CW+Uh216yfgmmVtibR7EUqL/tjY/m7Uh+hJHqB7qtPxkBgxwH6l6eaBZtUwSzNJTU X-Received: by 2002:aa7:db14:: with SMTP id t20mr28205901eds.158.1608811155226; Thu, 24 Dec 2020 03:59:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608811155; cv=none; d=google.com; s=arc-20160816; b=Hy0DPcEp0MLbnUMywQBcUSKZOMdJsu/DYwbOs2Y/kAvpZLf4wf1kJ4J39/UbpUqUf9 sTpqM3q3XeOmJw8I07LUoZEHH1r8lOIMeAJAzNMmnTgW0NzmjWd3rErdrdIiHCHJR4M4 mu9h01ewkB+T7UypC37V4LqRLDfngO52CXWPWhj9xdQyBZqmT2GoDbbCHz3ze7lhyK9s /QAIu+N78INoZM4Yaj3PRtk8NjhD/jjvB5gqt6S7rW/m8bJehNSziq6vCztzhNUjT4cj 6V07CK9FFzU7G5OjIU9zbAgVm1Ty6VhhyA8p5+/VcyJsPr38eksnhAE2MKoMkQkkc88p bBvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=DUMpAskif9XjkUxSJPGEgUrnDwNSNPRPDhvx5OMbppc=; b=mm11vOphIyCApSGpPAe+ixB9JgCeVVvjYlbkAvxOp1fs8tEJDfdIVFyEQrFKdujzSe Wehvzddd/AtJHnz3yRbj2Z7QNbUCBLhcUj/ebfC0PnS2GwkkBQAhmmm+0O6Jn+h1cJTr CpwoWJglBB2nIgYA5rIzrDYCC+coaVLo8iXE+hjGCQJBTm9b9ZA1zO1eXyu9Ma9x1EXR ttysRWTqDDqe7M0vnM26xqHPlhkkYaC5rgiB0L9X4qYVyKuTjCH5HykntD/JmdE/JJPc BF8Doc4TA2ogc96mvzu1YwPonHKgfgvB4++A1QDOQW2oLguas5Qudy/q/GGlzWX0Tk7o 5v5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qp17si14007704ejb.516.2020.12.24.03.58.50; Thu, 24 Dec 2020 03:59:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727240AbgLXL5W (ORCPT + 99 others); Thu, 24 Dec 2020 06:57:22 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:29717 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbgLXL5V (ORCPT ); Thu, 24 Dec 2020 06:57:21 -0500 X-IronPort-AV: E=Sophos;i="5.78,444,1599516000"; d="scan'208";a="484423914" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Dec 2020 12:56:38 +0100 Date: Thu, 24 Dec 2020 12:56:38 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Sumera Priyadarsini cc: Gilles.Muller@lip6.fr, michal.lkml@markovi.net, nicolas.palix@imag.fr, linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr Subject: Re: [Cocci] [PATCH v3] scripts: coccicheck: Correct usage of make coccicheck In-Reply-To: <20201124203212.tlvj7dvpmeql6spc@adolin> Message-ID: References: <20201124203212.tlvj7dvpmeql6spc@adolin> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Nov 2020, Sumera Priyadarsini wrote: > The command "make coccicheck C=1 CHECK=scripts/coccicheck" results in the > error: > ./scripts/coccicheck: line 65: -1: shift count out of range > > This happens because every time the C variable is specified, > the shell arguments need to be "shifted" in order to take only > the last argument, which is the C file to test. These shell arguments > mostly comprise flags that have been set in the Makefile. However, > when coccicheck is specified in the make command as a rule, the > number of shell arguments is zero, thus passing the invalid value -1 > to the shift command, resulting in an error. > > Modify coccicheck to print correct usage of make coccicheck so as to > avoid the error. Applied, thanks. julia > > Signed-off-by: Sumera Priyadarsini > --- > Changes in v2: > - Move test to only display error message > > Changes in v3: > - Update example with latest file > --- > scripts/coccicheck | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/scripts/coccicheck b/scripts/coccicheck > index 209bb0427b43..d1aaa1dc0a69 100755 > --- a/scripts/coccicheck > +++ b/scripts/coccicheck > @@ -61,6 +61,18 @@ COCCIINCLUDE=${COCCIINCLUDE// -include/ --include} > if [ "$C" = "1" -o "$C" = "2" ]; then > ONLINE=1 > > + if [[ $# -le 0 ]]; then > + echo '' > + echo 'Specifying both the variable "C" and rule "coccicheck" in the make > +command results in a shift count error.' > + echo '' > + echo 'Try specifying "scripts/coccicheck" as a value for the CHECK variable instead.' > + echo '' > + echo 'Example: make C=2 CHECK=scripts/coccicheck drivers/net/ethernet/ethoc.o' > + echo '' > + exit 1 > + fi > + > # Take only the last argument, which is the C file to test > shift $(( $# - 1 )) > OPTIONS="$COCCIINCLUDE $1" > -- > 2.25.1 > > _______________________________________________ > Cocci mailing list > Cocci@systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci >