All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] coccicheck: improve pattern for getting relative path
@ 2017-08-10 17:40 ` Cihangir Akturk
  0 siblings, 0 replies; 8+ messages in thread
From: Cihangir Akturk @ 2017-08-10 17:40 UTC (permalink / raw)
  To: Julia.Lawall
  Cc: Gilles.Muller, nicolas.palix, mmarek, cocci, linux-kernel,
	Cihangir Akturk

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>
---
 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\""
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Cocci] [PATCH] coccicheck: improve pattern for getting relative path
@ 2017-08-10 17:40 ` Cihangir Akturk
  0 siblings, 0 replies; 8+ messages in thread
From: Cihangir Akturk @ 2017-08-10 17:40 UTC (permalink / raw)
  To: cocci

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>
---
 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\""
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] coccicheck: improve pattern for getting relative path
  2017-08-10 17:40 ` [Cocci] " Cihangir Akturk
@ 2017-08-10 19:08   ` Julia Lawall
  -1 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2017-08-10 19:08 UTC (permalink / raw)
  To: Cihangir Akturk
  Cc: Julia.Lawall, Gilles.Muller, nicolas.palix, mmarek, cocci, linux-kernel



On Thu, 10 Aug 2017, Cihangir Akturk wrote:

> 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.

Nicolas, is this ok?

julia

>
> Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
> ---
>  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\""
> --
> 2.7.4
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Cocci] [PATCH] coccicheck: improve pattern for getting relative path
@ 2017-08-10 19:08   ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2017-08-10 19:08 UTC (permalink / raw)
  To: cocci



On Thu, 10 Aug 2017, Cihangir Akturk wrote:

> 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.

Nicolas, is this ok?

julia

>
> Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
> ---
>  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\""
> --
> 2.7.4
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] coccicheck: improve pattern for getting relative path
  2017-08-10 19:08   ` [Cocci] " Julia Lawall
@ 2017-09-22 19:28     ` Cihangir Akturk
  -1 siblings, 0 replies; 8+ messages in thread
From: Cihangir Akturk @ 2017-09-22 19:28 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Gilles.Muller, nicolas.palix, mmarek, cocci, linux-kernel

On Thu, Aug 10, 2017 at 09:08:31PM +0200, Julia Lawall wrote:
> 
> 
> On Thu, 10 Aug 2017, Cihangir Akturk wrote:
> 
> > 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.
> 
> Nicolas, is this ok?

Any comments on this patch? No one has commented yet. But I still get
the same results on current linux-next.

> 
> julia
> 
> >
> > Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
> > ---
> >  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\""
> > --
> > 2.7.4
> >
> >

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Cocci] [PATCH] coccicheck: improve pattern for getting relative path
@ 2017-09-22 19:28     ` Cihangir Akturk
  0 siblings, 0 replies; 8+ messages in thread
From: Cihangir Akturk @ 2017-09-22 19:28 UTC (permalink / raw)
  To: cocci

On Thu, Aug 10, 2017 at 09:08:31PM +0200, Julia Lawall wrote:
> 
> 
> On Thu, 10 Aug 2017, Cihangir Akturk wrote:
> 
> > 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.
> 
> Nicolas, is this ok?

Any comments on this patch? No one has commented yet. But I still get
the same results on current linux-next.

> 
> julia
> 
> >
> > Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
> > ---
> >  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\""
> > --
> > 2.7.4
> >
> >

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] coccicheck: improve pattern for getting relative path
  2017-08-10 17:40 ` [Cocci] " Cihangir Akturk
@ 2017-09-23 16:49   ` Nicolas Palix (LIG)
  -1 siblings, 0 replies; 8+ messages in thread
From: Nicolas Palix (LIG) @ 2017-09-23 16:49 UTC (permalink / raw)
  To: Cihangir Akturk, Julia.Lawall; +Cc: Gilles.Muller, mmarek, cocci, linux-kernel

[-- 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 --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Cocci] [PATCH] coccicheck: improve pattern for getting relative path
@ 2017-09-23 16:49   ` Nicolas Palix (LIG)
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Palix (LIG) @ 2017-09-23 16:49 UTC (permalink / raw)
  To: cocci

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 at 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/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2959 bytes
Desc: Signature cryptographique S/MIME
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20170923/0c55ba04/attachment.p7s>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-09-23 16:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-10 17:40 [PATCH] coccicheck: improve pattern for getting relative path Cihangir Akturk
2017-08-10 17:40 ` [Cocci] " Cihangir Akturk
2017-08-10 19:08 ` Julia Lawall
2017-08-10 19:08   ` [Cocci] " Julia Lawall
2017-09-22 19:28   ` Cihangir Akturk
2017-09-22 19:28     ` [Cocci] " Cihangir Akturk
2017-09-23 16:49 ` Nicolas Palix (LIG)
2017-09-23 16:49   ` [Cocci] " Nicolas Palix (LIG)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.