Improving source code parsing for “fs/smb/client/dir.c”?
Subsystems (2)
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
Quoted 22 lines · Markus Elfring
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-cfs/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:#ifdefCONFIG_CIFS_ALLOW_INSECURE_LEGACYfs/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
Quoted 2 lines
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
Quoted 10 lines
Quoted 10 lines
…
bad: static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, …fs/smb/client/dir.c:211: passed:#ifdefCONFIG_CIFS_ALLOW_INSECURE_LEGACYfs/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
Quoted 5 lines
Quoted 2 lines
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-L455If 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
Quoted 2 lines
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
Quoted 2 lines
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
Quoted 28 lines · Markus Elfring
Quoted 2 lines
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)
{
#ifdefMY_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"); }
Quoted 2 lines
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
Quoted 27 lines
Questionable test result (according to the software combination “Coccinelle 1.3.0”):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe>/usr/bin/spatch--parse-ctest-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 intmy_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 passedWill similar test cases trigger more desirable improvements?
Regards,
Markus
Quoted 24 lines
Quoted 21 lines
static int
my_test_condition(void)
{
#ifdefMY_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"); }Quoted 2 lines
return 0;
}
Quoted 3 lines
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
Quoted 3 lines
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