mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] scripts: coccicheck: filter *.cocci files by MODE
@ 2025-06-06  6:09 Songwei Chai
  2025-06-06  7:26 ` Nicolas Palix
  2025-11-07  8:05 ` [cocci] " Julia Lawall
  0 siblings, 2 replies; 5+ messages in thread
From: Songwei Chai @ 2025-06-06  6:09 UTC (permalink / raw)
  To: Julia Lawall, Nicolas Palix, cocci
  Cc: linux-kernel, quic_songchai, quic_tingweiz, quic_jinlmao

Enhance the coccicheck script to filter *.cocci files based on the
specified MODE (e.g., report, patch). This ensures that only compatible
semantic patch files are executed, preventing errors such as:

    "virtual rule report not supported"

This error occurs when a .cocci file does not define a 'virtual <MODE>'
rule, yet is executed in that mode.

For example:

    make coccicheck M=drivers/hwtracing/coresight/ MODE=report

In this case, running "secs_to_jiffies.cocci" would trigger the error
because it lacks support for 'report' mode. With this change, such files
are skipped automatically, improving robustness and developer
experience.

Signed-off-by: Songwei Chai <quic_songchai@quicinc.com>
---
 scripts/coccicheck | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/coccicheck b/scripts/coccicheck
index 0e6bc5a10320..89d591af5f3e 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -270,7 +270,11 @@ fi
 
 if [ "$COCCI" = "" ] ; then
     for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
-	coccinelle $f
+        if grep -q "virtual[[:space:]]\+$MODE" "$f"; then
+                coccinelle $f
+        else
+                echo "warning: Skipping $f as it does not match mode '$MODE'"
+        fi
     done
 else
     coccinelle $COCCI


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

* Re: [PATCH v2] scripts: coccicheck: filter *.cocci files by MODE
  2025-06-06  6:09 [PATCH v2] scripts: coccicheck: filter *.cocci files by MODE Songwei Chai
@ 2025-06-06  7:26 ` Nicolas Palix
  2025-10-27  2:39   ` Songwei Chai
  2025-11-07  8:05 ` [cocci] " Julia Lawall
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Palix @ 2025-06-06  7:26 UTC (permalink / raw)
  To: Songwei Chai, Julia Lawall, cocci
  Cc: linux-kernel, quic_tingweiz, quic_jinlmao

Le 06/06/2025 à 08:09, Songwei Chai a écrit :
> Enhance the coccicheck script to filter *.cocci files based on the
> specified MODE (e.g., report, patch). This ensures that only compatible
> semantic patch files are executed, preventing errors such as:
> 
>      "virtual rule report not supported"
> 
> This error occurs when a .cocci file does not define a 'virtual <MODE>'
> rule, yet is executed in that mode.
> 
> For example:
> 
>      make coccicheck M=drivers/hwtracing/coresight/ MODE=report
> 
> In this case, running "secs_to_jiffies.cocci" would trigger the error
> because it lacks support for 'report' mode. With this change, such files
> are skipped automatically, improving robustness and developer
> experience.
> 
> Signed-off-by: Songwei Chai <quic_songchai@quicinc.com>
Acked-by: Nicolas Palix <nicolas.palix@imag.fr>
> ---
>   scripts/coccicheck | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 0e6bc5a10320..89d591af5f3e 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -270,7 +270,11 @@ fi
>   
>   if [ "$COCCI" = "" ] ; then
>       for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
> -	coccinelle $f
> +        if grep -q "virtual[[:space:]]\+$MODE" "$f"; then
> +                coccinelle $f
> +        else
> +                echo "warning: Skipping $f as it does not match mode '$MODE'"
> +        fi
>       done
>   else
>       coccinelle $COCCI
> 


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

* Re: [PATCH v2] scripts: coccicheck: filter *.cocci files by MODE
  2025-06-06  7:26 ` Nicolas Palix
@ 2025-10-27  2:39   ` Songwei Chai
  2025-11-05  1:53     ` Songwei Chai
  0 siblings, 1 reply; 5+ messages in thread
From: Songwei Chai @ 2025-10-27  2:39 UTC (permalink / raw)
  To: Nicolas Palix, Julia Lawall, cocci
  Cc: linux-kernel, Tingwei Zhang, jinlong.mao

Hi Nicolas/Julia,

Noticed this patch has stalled after being ACKed.

Could you please help review it and assist in pushing it forward for 
merging?

Thanks.

On 6/6/2025 3:26 PM, Nicolas Palix wrote:
> Le 06/06/2025 à 08:09, Songwei Chai a écrit :
>> Enhance the coccicheck script to filter *.cocci files based on the
>> specified MODE (e.g., report, patch). This ensures that only compatible
>> semantic patch files are executed, preventing errors such as:
>>
>>      "virtual rule report not supported"
>>
>> This error occurs when a .cocci file does not define a 'virtual <MODE>'
>> rule, yet is executed in that mode.
>>
>> For example:
>>
>>      make coccicheck M=drivers/hwtracing/coresight/ MODE=report
>>
>> In this case, running "secs_to_jiffies.cocci" would trigger the error
>> because it lacks support for 'report' mode. With this change, such files
>> are skipped automatically, improving robustness and developer
>> experience.
>>
>> Signed-off-by: Songwei Chai <quic_songchai@quicinc.com>
> Acked-by: Nicolas Palix <nicolas.palix@imag.fr>
>> ---
>>   scripts/coccicheck | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/coccicheck b/scripts/coccicheck
>> index 0e6bc5a10320..89d591af5f3e 100755
>> --- a/scripts/coccicheck
>> +++ b/scripts/coccicheck
>> @@ -270,7 +270,11 @@ fi
>>     if [ "$COCCI" = "" ] ; then
>>       for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' 
>> -type f | sort`; do
>> -    coccinelle $f
>> +        if grep -q "virtual[[:space:]]\+$MODE" "$f"; then
>> +                coccinelle $f
>> +        else
>> +                echo "warning: Skipping $f as it does not match mode 
>> '$MODE'"
>> +        fi
>>       done
>>   else
>>       coccinelle $COCCI
>>
>

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

* Re: [PATCH v2] scripts: coccicheck: filter *.cocci files by MODE
  2025-10-27  2:39   ` Songwei Chai
@ 2025-11-05  1:53     ` Songwei Chai
  0 siblings, 0 replies; 5+ messages in thread
From: Songwei Chai @ 2025-11-05  1:53 UTC (permalink / raw)
  To: Nicolas Palix, Julia Lawall, cocci
  Cc: linux-kernel, Tingwei Zhang, jinlong.mao

Gentle Reminder.

On 10/27/2025 10:39 AM, Songwei Chai wrote:
> Hi Nicolas/Julia,
>
> Noticed this patch has stalled after being ACKed.
>
> Could you please help review it and assist in pushing it forward for 
> merging?
>
> Thanks.
>
> On 6/6/2025 3:26 PM, Nicolas Palix wrote:
>> Le 06/06/2025 à 08:09, Songwei Chai a écrit :
>>> Enhance the coccicheck script to filter *.cocci files based on the
>>> specified MODE (e.g., report, patch). This ensures that only compatible
>>> semantic patch files are executed, preventing errors such as:
>>>
>>>      "virtual rule report not supported"
>>>
>>> This error occurs when a .cocci file does not define a 'virtual <MODE>'
>>> rule, yet is executed in that mode.
>>>
>>> For example:
>>>
>>>      make coccicheck M=drivers/hwtracing/coresight/ MODE=report
>>>
>>> In this case, running "secs_to_jiffies.cocci" would trigger the error
>>> because it lacks support for 'report' mode. With this change, such 
>>> files
>>> are skipped automatically, improving robustness and developer
>>> experience.
>>>
>>> Signed-off-by: Songwei Chai <quic_songchai@quicinc.com>
>> Acked-by: Nicolas Palix <nicolas.palix@imag.fr>
>>> ---
>>>   scripts/coccicheck | 6 +++++-
>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/coccicheck b/scripts/coccicheck
>>> index 0e6bc5a10320..89d591af5f3e 100755
>>> --- a/scripts/coccicheck
>>> +++ b/scripts/coccicheck
>>> @@ -270,7 +270,11 @@ fi
>>>     if [ "$COCCI" = "" ] ; then
>>>       for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' 
>>> -type f | sort`; do
>>> -    coccinelle $f
>>> +        if grep -q "virtual[[:space:]]\+$MODE" "$f"; then
>>> +                coccinelle $f
>>> +        else
>>> +                echo "warning: Skipping $f as it does not match 
>>> mode '$MODE'"
>>> +        fi
>>>       done
>>>   else
>>>       coccinelle $COCCI
>>>
>>

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

* Re: [cocci] [PATCH v2] scripts: coccicheck: filter *.cocci files by MODE
  2025-06-06  6:09 [PATCH v2] scripts: coccicheck: filter *.cocci files by MODE Songwei Chai
  2025-06-06  7:26 ` Nicolas Palix
@ 2025-11-07  8:05 ` Julia Lawall
  1 sibling, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2025-11-07  8:05 UTC (permalink / raw)
  To: Songwei Chai
  Cc: Nicolas Palix, cocci, linux-kernel, quic_tingweiz, quic_jinlmao



On Fri, 6 Jun 2025, Songwei Chai wrote:

> Enhance the coccicheck script to filter *.cocci files based on the
> specified MODE (e.g., report, patch). This ensures that only compatible
> semantic patch files are executed, preventing errors such as:
>
>     "virtual rule report not supported"
>
> This error occurs when a .cocci file does not define a 'virtual <MODE>'
> rule, yet is executed in that mode.
>
> For example:
>
>     make coccicheck M=drivers/hwtracing/coresight/ MODE=report
>
> In this case, running "secs_to_jiffies.cocci" would trigger the error
> because it lacks support for 'report' mode. With this change, such files
> are skipped automatically, improving robustness and developer
> experience.

Pushed to my tree (for-6.19 branch)

>
> Signed-off-by: Songwei Chai <quic_songchai@quicinc.com>
> ---
>  scripts/coccicheck | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 0e6bc5a10320..89d591af5f3e 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -270,7 +270,11 @@ fi
>
>  if [ "$COCCI" = "" ] ; then
>      for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
> -	coccinelle $f
> +        if grep -q "virtual[[:space:]]\+$MODE" "$f"; then
> +                coccinelle $f
> +        else
> +                echo "warning: Skipping $f as it does not match mode '$MODE'"
> +        fi
>      done
>  else
>      coccinelle $COCCI
>
>

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

end of thread, other threads:[~2025-11-07  8:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-06  6:09 [PATCH v2] scripts: coccicheck: filter *.cocci files by MODE Songwei Chai
2025-06-06  7:26 ` Nicolas Palix
2025-10-27  2:39   ` Songwei Chai
2025-11-05  1:53     ` Songwei Chai
2025-11-07  8:05 ` [cocci] " Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®