linux-test-project / lcov

LCOV
GNU General Public License v2.0
866 stars 234 forks source link

geninfo settings don't work in config files in v2.1-beta1 or v2.1-beta2 #282

Closed nomis closed 2 months ago

nomis commented 3 months ago

If geninfo --gcov-tool ... is used it sets the gcov tool to the specified value (which is a list with one entry).

If geninfo --config-file ... or one of the lcovrc files is used to set geninfo_gcov_tool it claims to append the value to the "list of gcov tools" but it appears to do nothing because geninfo still has an empty array in @gcov_tool:

$ echo "geninfo_gcov_tool = gcov-14" > config
$ geninfo -v -v --config-file config
read_config: config
  set: geninfo_gcov_tool = gcov-14
  append gcov-14 to list geninfo_gcov_tool
gcov is '/usr/bin/gcov'
Found gcov version: 13.2.0
...
nomis commented 3 months ago

None of the geninfo settings work in config files, and it stopped working after 2.0:

ea9d0e7dc03808352c655d57fa9f6e5e526ce8df is the first bad commit
commit ea9d0e7dc03808352c655d57fa9f6e5e526ce8df
Author: Henry Cox <henry.cox@mediatek.com>
Date:   Thu Feb 22 08:07:39 2024 -0500

    Check for invalid or unknown options passed via "--rc key=value"
    User expected to have some effect - or would not have passed the option.
    Without this check, user may see some unexpected results that look a lot
    like tool bugs (...we ignored some option).
nomis commented 3 months ago

The problem is here where there are two different copies of all of the options so that the ones in geninfo_rc_opts are never used:

-if (!lcovutil::parseOptions(\%geninfo_rc_opts, \%geninfo_opts)) {
+if (!lcovutil::parseOptions(\%lcovutil::geninfo_rc_opts, \%geninfo_opts)) {
henry2cox commented 2 months ago

Closing now. I believe that this is fixed in the commit mentioned above.

If there is still a problem, please either reopen this issue or file a new one. Please include a testcase which illustrates the bug.

Thanks Henry