public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nicolas Palix (LIG)" <Nicolas.Palix@imag.fr>
To: Cihangir Akturk <cakturk@gmail.com>, Julia.Lawall@lip6.fr
Cc: Gilles.Muller@lip6.fr, mmarek@suse.com, cocci@systeme.lip6.fr,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] coccicheck: improve pattern for getting relative path
Date: Sat, 23 Sep 2017 18:49:29 +0200	[thread overview]
Message-ID: <84d90a7d-899f-e6af-8f3c-cde69f5d1396@imag.fr> (raw)
In-Reply-To: <1502386825-363-1-git-send-email-cakturk@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1750 bytes --]

Le 10/08/17 à 19:40, Cihangir Akturk a écrit :
> When invoked with V=1, coccicheck script prints the information about
> which semantic patch (*.cocci file) used for this operation.  Actually,
> it prints out the relative path of the related semantic patch. The
> script uses sed to remove the source tree part from cocci file path like
> so:
> 
> FILE=`echo $COCCI | sed "s|$srctree/||"`
> 
> This pattern works well most of the time. But in cases where $COCCI
> doesn't start with "./" characters, it doesn't remove the right part.
> 
> Consider the following scenario:
> 
> $ make coccicheck COCCI=scripts/coccinelle/api/drm-get-put.cocci \
>                          MODE=patch M=drivers/staging V=1
> 
> where
> 
> COCCI=scripts/coccinelle/api/drm-get-put.cocci and srctree=.
> 
> In this case, out pattern matches the first "s/", and we end up
> assigning "scriptcoccinelle/api/drm-get-put.cocci" to $FILE.
> 
> Fix this by adding a caret ^ at the beginning of regex pattern, so that
> it matches only start of the path.
> 
> Signed-off-by: Cihangir Akturk <cakturk@gmail.com>

Acked-by: nicolas.palix@univ-grenoble-alpes.fr
> --- >   scripts/coccicheck | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index ec487b8..8de4245 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -193,7 +193,7 @@ coccinelle () {
>   
>       if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then
>   
> -	FILE=`echo $COCCI | sed "s|$srctree/||"`
> +	FILE=`echo $COCCI | sed "s|^$srctree/||"`
>   
>   	echo "Processing `basename $COCCI`"
>   	echo "with option(s) \"$OPT\""
> 


-- 
Nicolas Palix
http://lig-membres.imag.fr/palix/


[-- Attachment #2: Signature cryptographique S/MIME --]
[-- Type: application/pkcs7-signature, Size: 2959 bytes --]

      parent reply	other threads:[~2017-09-23 16:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10 17:40 [PATCH] coccicheck: improve pattern for getting relative path Cihangir Akturk
2017-08-10 19:08 ` Julia Lawall
2017-09-22 19:28   ` Cihangir Akturk
2017-09-23 16:49 ` Nicolas Palix (LIG) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84d90a7d-899f-e6af-8f3c-cde69f5d1396@imag.fr \
    --to=nicolas.palix@imag.fr \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=cakturk@gmail.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=nicolas.palix@univ-grenoble-alpes.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox