Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1156680pxu; Mon, 23 Nov 2020 13:08:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzh7VjwklSWWjGKzTQzYYQRL1vi8tZCQ/GztTIAVIhHFnWFgp8FDt16P8Roix8LS7vLxZWx X-Received: by 2002:a17:906:d72:: with SMTP id s18mr1399640ejh.110.1606165737374; Mon, 23 Nov 2020 13:08:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606165737; cv=none; d=google.com; s=arc-20160816; b=WcVYcGZlVC59rYlsbiq3ITf5nbJz7N+Gyeb9m9/aj5VoVoj+sQa1/JTPiLD46EtnpB dg7aOqn6ftUoqZAvoa/CtfaRjhbDqZuQArj82mLfFa2Mv3zgI2ONd1k3vfM0pdwZU9OB wP1MOj2kdzLPYN6v99ND2jerbsbhxmuO4YvisS5YyLx/Hq/8Vz4C+M/mKt1+bzn2lBSD DRW2H+A/Dthfe50hTL6iN9QZLeiJe+E2YYzm7H5sr6ZMVoiJd0q7jJLPjvEB6s/nA9FY 3zu1pdGg1I+lW0Z/wbi5z/q2SEqxDrCYTQ13UgDm0u7ii1TR17ZCcmb9tG+x8Hxfv+XB hmXQ== 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=8FKcce+nLS9g3aEkynw0KsD5zfoPoxhgkvKXLTW3Tf0=; b=NKQSLeQkfFXyzvXJpK9ixzbwQIQHsQ84DUoLlzOKT8JKeW4u+gk8fTQDYVe2jFYetf M/Lu3G0u/PkXR/QsMLfZeHpctLQ0Bpy++sXvbKd4dEa+mlnxbtZfiRFMhqK49xktn54w vYQbYz6LBmxEO8E2ioPou1z3bZev21FviNDHpIJxo4Oshas8+dFkd1lgca3f8EYjZODl CzjrPGUSRZnnn+opvkMHf5G1aeRDm1AOeAxCjes2DSMC4HQvwbBnPG4kSRue3ubPD/cX 4JSO7v5A/nXsvf3y2x9Cz4d9vLUnINDXE3nA/PBMmfpoXmfZudwVUxapJkX9nvOtol6V UtuA== 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 dx19si4096955ejb.535.2020.11.23.13.08.33; Mon, 23 Nov 2020 13:08:57 -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 S1729912AbgKWVGo (ORCPT + 99 others); Mon, 23 Nov 2020 16:06:44 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:2421 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729905AbgKWVGo (ORCPT ); Mon, 23 Nov 2020 16:06:44 -0500 X-IronPort-AV: E=Sophos;i="5.78,364,1599516000"; d="scan'208";a="479042964" 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; 23 Nov 2020 22:06:42 +0100 Date: Mon, 23 Nov 2020 22:06:42 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Sumera Priyadarsini cc: linux-kernel@vger.kernel.org, michal.lkml@markovi.net, nicolas.palix@imag.fr, cocci@systeme.lip6.fr, Gilles.Muller@lip6.fr Subject: Re: [Cocci] [PATCH v2] scripts: coccicheck: Correct usage of make coccicheck In-Reply-To: <20201118082705.ympf6ulol6wua4cl@adolin> Message-ID: References: <20201118082705.ympf6ulol6wua4cl@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, 18 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. > > Signed-off-by: Sumera Priyadarsini > --- > Changes in v2: > - Move test to only display error message > --- > scripts/coccicheck | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/scripts/coccicheck b/scripts/coccicheck > index 209bb0427b43..f3b8bf505c5f 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/staging/wfx/hi_t.o' I think that this file doesn't exist any more. Even though you can't guarantee that any particular file will be around forever, a file in staging is probably not a good choice, since they are usually on their way in or on the way out of the kernel. julia > + 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 >