Linux CIFS filesystem development
 help / color / mirror / Atom feed
* Improving source code parsing for “fs/smb/client/dir.c”?
@ 2025-10-13 11:50 Markus Elfring
  2025-10-13 12:04 ` [cocci] " Julia Lawall
  0 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2025-10-13 11:50 UTC (permalink / raw)
  To: cocci; +Cc: linux-cifs

Hello,

I would like to point another questionable test result out
(according to the software combination “Coccinelle 1.3.0”):

Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch --no-includes --parse-c fs/smb/client/dir.c
…
parse error 
 = File "fs/smb/client/dir.c", line 964, column 0, charpos = 25270
  around = '',
  whole content = 
badcount: 283
…
bad: static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
…
fs/smb/client/dir.c:211: passed:#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY 
fs/smb/client/dir.c:280: passed:#endif 
…
nb good = 679,  nb passed = 7 =========> 0.72% passed
nb good = 679,  nb bad = 283 =========> 70.79% good or passed


Under which circumstances will data processing become better supported for such files?
https://elixir.bootlin.com/linux/v6.17.1/source/fs/smb/client/dir.c#L178-L455

Regards,
Markus

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

* Re: [cocci] Improving source code parsing for “fs/smb/client/dir.c”?
  2025-10-13 11:50 Improving source code parsing for “fs/smb/client/dir.c”? Markus Elfring
@ 2025-10-13 12:04 ` Julia Lawall
  2025-10-13 12:16   ` Markus Elfring
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Julia Lawall @ 2025-10-13 12:04 UTC (permalink / raw)
  To: Markus Elfring; +Cc: cocci, linux-cifs

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



On Mon, 13 Oct 2025, Markus Elfring wrote:

> Hello,
>
> I would like to point another questionable test result out
> (according to the software combination “Coccinelle 1.3.0”):
>
> Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch --no-includes --parse-c fs/smb/client/dir.c
> …
> parse error
>  = File "fs/smb/client/dir.c", line 964, column 0, charpos = 25270
>   around = '',
>   whole content =
> badcount: 283
> …
> bad: static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
> …
> fs/smb/client/dir.c:211: passed:#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
> fs/smb/client/dir.c:280: passed:#endif
> …
> nb good = 679,  nb passed = 7 =========> 0.72% passed
> nb good = 679,  nb bad = 283 =========> 70.79% good or passed
>
>
> Under which circumstances will data processing become better supported for such files?
> https://elixir.bootlin.com/linux/v6.17.1/source/fs/smb/client/dir.c#L178-L455

If you want the problem to be solved, please make some effort to narrow it
down to a smaller number of lines.  Like 5.

julia

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

* Re: [cocci] Improving source code parsing for “fs/smb/client/dir.c”?
  2025-10-13 12:04 ` [cocci] " Julia Lawall
@ 2025-10-13 12:16   ` Markus Elfring
  2025-10-13 13:05   ` Markus Elfring
  2025-10-13 14:35   ` Markus Elfring
  2 siblings, 0 replies; 8+ messages in thread
From: Markus Elfring @ 2025-10-13 12:16 UTC (permalink / raw)
  To: Julia Lawall, cocci; +Cc: linux-cifs

>> …
>> bad: static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
>> …
>> fs/smb/client/dir.c:211: passed:#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
>> fs/smb/client/dir.c:280: passed: 
>> …
>> nb good = 679,  nb passed = 7 =========> 0.72% passed
>> nb good = 679,  nb bad = 283 =========> 70.79% good or passed
>>
>>
>> Under which circumstances will data processing become better supported for such files?
>> https://elixir.bootlin.com/linux/v6.17.1/source/fs/smb/client/dir.c#L178-L455
> 
> If you want the problem to be solved, please make some effort to narrow it
> down to a smaller number of lines.  Like 5.

I guess that you can recognise remaining development challenges for the Coccinelle software.

Will the chances grow to support preprocessor directives like #ifdef and #endif better anyhow?

Regards,
Markus

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

* Re: [cocci] Improving source code parsing for “fs/smb/client/dir.c”?
  2025-10-13 12:04 ` [cocci] " Julia Lawall
  2025-10-13 12:16   ` Markus Elfring
@ 2025-10-13 13:05   ` Markus Elfring
  2025-10-13 14:35   ` Markus Elfring
  2 siblings, 0 replies; 8+ messages in thread
From: Markus Elfring @ 2025-10-13 13:05 UTC (permalink / raw)
  To: Julia Lawall, cocci; +Cc: linux-cifs

> If you want the problem to be solved, please make some effort to narrow it
> down to a smaller number of lines. …

Can other data parsing technology help more here?

Why are the following source file parts marked as “bad” so far?

1. Complete implementation of the function “cifs_do_create”

2. Comment line between two function implementations

3. Blank lines

4. Closing curly bracket from the function “check_name”


Regards,
Markus

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

* Re: [cocci] Improving source code parsing for “fs/smb/client/dir.c”?
  2025-10-13 12:04 ` [cocci] " Julia Lawall
  2025-10-13 12:16   ` Markus Elfring
  2025-10-13 13:05   ` Markus Elfring
@ 2025-10-13 14:35   ` Markus Elfring
  2025-10-13 14:49     ` Julia Lawall
  2 siblings, 1 reply; 8+ messages in thread
From: Markus Elfring @ 2025-10-13 14:35 UTC (permalink / raw)
  To: Julia Lawall, cocci; +Cc: linux-cifs

> If you want the problem to be solved, please make some effort to narrow it
> down to a smaller number of lines. …

How do you think about to improve data processing for another source file example
like the following?


static int my_test_condition(void)
{
#ifdef MY_CONFIG_LEGACY_OPTION
 if (0)
    {
        my_log("working?");
    }
 else
    {
        /* Test comment */
    }
my_info:
 if (0)
    my_log("reminder!");
 else
    {
#else
    {
#endif
     my_log("special part");
    }
 return 0;
}


Questionable test result (according to the software combination “Coccinelle 1.3.0”):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch --parse-c test-ifdef-legacy3.c
…
PB: not found closing brace in fuzzy parsing
ERROR-RECOV: found sync '}' at line 23
…
parse error 
 = File "test-ifdef-legacy3.c", line 24, column 0, charpos = 282
  around = '',
  whole content = 
badcount: 22
bad: static int my_test_condition(void)
…
bad:  return 0;
BAD:!!!!! }
…
nb good = 0,  nb passed = 3 =========> 12.00% passed
nb good = 0,  nb bad = 22 =========> 12.00% good or passed


Will similar test cases trigger more desirable improvements?

Regards,
Markus

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

* Re: [cocci] Improving source code parsing for “fs/smb/client/dir.c”?
  2025-10-13 14:35   ` Markus Elfring
@ 2025-10-13 14:49     ` Julia Lawall
  2025-10-13 15:00       ` Markus Elfring
  2025-10-13 15:47       ` Markus Elfring
  0 siblings, 2 replies; 8+ messages in thread
From: Julia Lawall @ 2025-10-13 14:49 UTC (permalink / raw)
  To: Markus Elfring; +Cc: cocci, linux-cifs

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



On Mon, 13 Oct 2025, Markus Elfring wrote:

> > If you want the problem to be solved, please make some effort to narrow it
> > down to a smaller number of lines. …
>
> How do you think about to improve data processing for another source file example
> like the following?
>
>
> static int my_test_condition(void)
> {
> #ifdef MY_CONFIG_LEGACY_OPTION
>  if (0)
>     {
>         my_log("working?");
>     }
>  else
>     {
>         /* Test comment */
>     }
> my_info:
>  if (0)
>     my_log("reminder!");
>  else
>     {
> #else
>     {
> #endif
>      my_log("special part");
>     }
>  return 0;
> }

Thank you for the more understanable example.  I think it should ignore
the code under the #else since parsing is not successful when that is
taken into account.  I will try to look into it at some point.

julia

>
>
> Questionable test result (according to the software combination “Coccinelle 1.3.0”):
> Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch --parse-c test-ifdef-legacy3.c
> …
> PB: not found closing brace in fuzzy parsing
> ERROR-RECOV: found sync '}' at line 23
> …
> parse error
>  = File "test-ifdef-legacy3.c", line 24, column 0, charpos = 282
>   around = '',
>   whole content =
> badcount: 22
> bad: static int my_test_condition(void)
> …
> bad:  return 0;
> BAD:!!!!! }
> …
> nb good = 0,  nb passed = 3 =========> 12.00% passed
> nb good = 0,  nb bad = 22 =========> 12.00% good or passed
>
>
> Will similar test cases trigger more desirable improvements?
>
> Regards,
> Markus
>

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

* Re: [cocci] Improving source code parsing for “fs/smb/client/dir.c”?
  2025-10-13 14:49     ` Julia Lawall
@ 2025-10-13 15:00       ` Markus Elfring
  2025-10-13 15:47       ` Markus Elfring
  1 sibling, 0 replies; 8+ messages in thread
From: Markus Elfring @ 2025-10-13 15:00 UTC (permalink / raw)
  To: Julia Lawall, cocci; +Cc: linux-cifs

>> static int my_test_condition(void)
>> {
>> #ifdef MY_CONFIG_LEGACY_OPTION
>>  if (0)
>>     {
>>         my_log("working?");
>>     }
>>  else
>>     {
>>         /* Test comment */
>>     }
>> my_info:
>>  if (0)
>>     my_log("reminder!");
>>  else
>>     {
>> #else
>>     {
>> #endif
>>      my_log("special part");
>>     }
>>  return 0;
>> }
> 
> Thank you for the more understanable example.  I think it should ignore
> the code under the #else since parsing is not successful when that is
> taken into account. …

Both source code parts provide an opening curly bracket according to the desired
conditional compilation.
It might be possible to move this bracket behind the preprocessor directive “#endif”
so that an “#else” branch could be omitted.

Regards,
Markus

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

* Re: [cocci] Improving source code parsing for “fs/smb/client/dir.c”?
  2025-10-13 14:49     ` Julia Lawall
  2025-10-13 15:00       ` Markus Elfring
@ 2025-10-13 15:47       ` Markus Elfring
  1 sibling, 0 replies; 8+ messages in thread
From: Markus Elfring @ 2025-10-13 15:47 UTC (permalink / raw)
  To: Julia Lawall, cocci; +Cc: linux-cifs

> Thank you for the more understanable example.  I think it should ignore
> the code under the #else since parsing is not successful when that is
> taken into account. …

Improvable software behaviour can be demonstrated also with the following
source file example.


static int my_test_condition(void)
{
#ifdef MY_CONFIG_LEGACY_OPTION
    {
        /* Test comment */
    }
my_info:
 if (0)
    my_log("reminder!");
 else
    {
#else
    {
#endif
     my_log("test end");
    }
 return 0;
}


Questionable test result (according to the software combination “Coccinelle 1.3.0”):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch --parse-c test-ifdef-legacy5.c
…
PB: not found closing brace in fuzzy parsing
ERROR-RECOV: found sync '}' at line 18
…
parse error 
 = File "test-ifdef-legacy5.c", line 19, column 0, charpos = 224
  around = '',
  whole content = 
badcount: 17
bad: static int my_test_condition(void)
…
bad:  return 0;
BAD:!!!!! }
…
nb good = 0,  nb passed = 3 =========> 15.00% passed
nb good = 0,  nb bad = 17 =========> 15.00% good or passed


How will the software evolution be continued?

Regards,
Markus

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

end of thread, other threads:[~2025-10-13 15:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-13 11:50 Improving source code parsing for “fs/smb/client/dir.c”? Markus Elfring
2025-10-13 12:04 ` [cocci] " Julia Lawall
2025-10-13 12:16   ` Markus Elfring
2025-10-13 13:05   ` Markus Elfring
2025-10-13 14:35   ` Markus Elfring
2025-10-13 14:49     ` Julia Lawall
2025-10-13 15:00       ` Markus Elfring
2025-10-13 15:47       ` Markus Elfring

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