Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-35422

Valgrind plugin failed to parse (String index out of range) for complex C++ trace.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • valgrind-plugin
    • None

      [Valgrind] Files to copy:
      [Valgrind] BUILD_linux_gfortran_64_DEBUG/climp/examples/nag_UNLICENSED/static/fl_results/e04stfe.r_vgxml
      [Valgrind] Copying BUILD_linux_gfortran_64_DEBUG/climp/examples/nag_UNLICENSED/static/fl_results/e04stfe.r_vgxml to /fserver/engine/jenkins_home/jobs/automatic_linux_64_gfortran_debug_CL/builds/791/valgrind-plugin/valgrind-results/BUILD_linux_gfortran_64_DEBUG/climp/examples/nag_UNLICENSED/static/fl_results/e04stfe.r_vgxml
      [Valgrind] ERROR: failed to parse valgrind-plugin/valgrind-results/BUILD_linux_gfortran_64_DEBUG/climp/examples/nag_UNLICENSED/static/fl_results/e04stfe.r_vgxml: String index out of range: 7
      [Valgrind] Analysing valgrind results
      [Valgrind] Ending the valgrind analysis.
      

          [JENKINS-35422] Valgrind plugin failed to parse (String index out of range) for complex C++ trace.

          Malik Mlitat added a comment - - edited

          i hade also this problem, and i figured out why:
          in src/main/java/org/jenkinsci/plugins/valgrind/model/ValgrindProcess.java

           +	public void addValgrindArgument(String arg)
          +	{
          +		if ( valgrind_arguments == null )
          +			valgrind_arguments = new ArrayList<String>();
          +		
          +		valgrind_arguments.add(arg);
          +		
          +		// actually, we only really care about the tool argument
          +		if ( arg.substring(0, 7).equals("--tool=")) {
          +			tool = arg.substring(7);
          +		}
          +	}
          

          There is no check for length of arg to be >= 7

          in your args:

          <args>
            <vargv>
              <exe>/usr/bin/valgrind</exe>
              <arg>--leak-check=full</arg>
              <arg>--show-reachable=yes</arg>
              <arg>--track-origins=yes</arg>
              <arg>--xml=yes</arg>
              <arg>--child-silent-after-fork=yes</arg>
              <arg>-q</arg>
              <arg>--suppressions=/DATA/jenkins/workspace/automatic_linux_64_gfortran_debug_CL/development/tools/valgrind.supp</arg>
              <arg>--log-file=e04stfe.r_vgtxt</arg>
              <arg>--xml-file=e04stfe.r_vgxml</arg>
            </vargv>
            <argv>
              <exe>./e04stfe.exe</exe>
            </argv>
          </args>
          

          The <arg> - q</arg> will cause the exception, as a hotfix just juse <arg>--quiet </arg>

          Malik Mlitat added a comment - - edited i hade also this problem, and i figured out why: in src/main/java/org/jenkinsci/plugins/valgrind/model/ValgrindProcess.java + public void addValgrindArgument( String arg) + { + if ( valgrind_arguments == null ) + valgrind_arguments = new ArrayList< String >(); + + valgrind_arguments.add(arg); + + // actually, we only really care about the tool argument + if ( arg.substring(0, 7).equals( "--tool=" )) { + tool = arg.substring(7); + } + } There is no check for length of arg to be >= 7 in your args: <args> <vargv> <exe>/usr/bin/valgrind</exe> <arg>--leak-check=full</arg> <arg>--show-reachable=yes</arg> <arg>--track-origins=yes</arg> <arg>--xml=yes</arg> <arg>--child-silent-after-fork=yes</arg> <arg>-q</arg> <arg>--suppressions=/DATA/jenkins/workspace/automatic_linux_64_gfortran_debug_CL/development/tools/valgrind.supp</arg> <arg>--log-file=e04stfe.r_vgtxt</arg> <arg>--xml-file=e04stfe.r_vgxml</arg> </vargv> <argv> <exe>./e04stfe.exe</exe> </argv> </args> The <arg> - q</arg> will cause the exception, as a hotfix just juse <arg>--quiet </arg>

          Mat Cross added a comment -

          Thanks for the advice. Dropping q/-quiet (i.e., arguments of length <= 7) from the valgrind invocation seems to work for me.

          Mat Cross added a comment - Thanks for the advice. Dropping q/ -quiet (i.e., arguments of length <= 7) from the valgrind invocation seems to work for me.

          Could a check on the length of arg be added? Something like that:

          if ( arg.length() >=7 && arg.substring(0, 7).equals("--tool=")) {
          

          Sure you can just change -q to --quiet, but when I see "String index out of range: 7" I don't immediately think about the length of my arguments.
          Thanks!

          philippe babin added a comment - Could a check on the length of arg be added? Something like that: if ( arg.length() >=7 && arg.substring(0, 7).equals( "--tool=" )) { Sure you can just change -q to --quiet, but when I see "String index out of range: 7" I don't immediately think about the length of my arguments. Thanks!

          Ian Norton added a comment - - edited

          I've created a pull request with a probable fix for this: https://github.com/jenkinsci/valgrind-plugin/pull/10

          Ian Norton added a comment - - edited I've created a pull request with a probable fix for this: https://github.com/jenkinsci/valgrind-plugin/pull/10

          Code changed in jenkins
          User: Ian Norton
          Path:
          src/test/resources/org/jenkinsci/plugins/valgrind/parser/simple.xml
          http://jenkins-ci.org/commit/valgrind-plugin/f20948a9594bd1f209ee70aebe48fe49c1230c79
          Log:
          update parser test data wrt JENKINS-35422

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ian Norton Path: src/test/resources/org/jenkinsci/plugins/valgrind/parser/simple.xml http://jenkins-ci.org/commit/valgrind-plugin/f20948a9594bd1f209ee70aebe48fe49c1230c79 Log: update parser test data wrt JENKINS-35422

          Ian Norton added a comment - - edited

          Is this the longest outstanding contributed bugfix in history?

          I fixed this when my son was still in primary school - https://github.com/jenkinsci/valgrind-plugin/pull/10

          Ian Norton added a comment - - edited Is this the longest outstanding contributed bugfix in history? I fixed this when my son was still in primary school -  https://github.com/jenkinsci/valgrind-plugin/pull/10

            existence Johannes Ohlemacher
            matcross Mat Cross
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: