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

PluginManager::addDependencies() improperly handles plugin trees

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The issue has been introduced in https://github.com/jenkinsci/jenkins/commit/036a8e94ed37cf851f0cafb9cb12c21e3496ed7c

      PluginManager::addDependencies() is supposed to recursively check the plugin dependency tree and to construct a list. But calls in if (dependencyURL != null) are misordered

      If pluginA depends on pluginB, which depends on pluginC...

      1) We invoke addDependencies() for pluginB if pluginA is being loaded
      2) We pass through the first iteration of the method and get into if (dependencyURL != null)
      3) We add pluginB to the list and invoke addDependencies for children ([pluginC])
      4) We enter second addDependencies() and exit on the first condition, because dependencySet already contains pluginB => we exit without adding pluginC to the dependency list

      +    protected static void addDependencies(URL hpiResUrl, String fromPath, Set<URL> dependencySet) throws URISyntaxException, MalformedURLException {
       +        if (dependencySet.contains(hpiResUrl)) {
       +            return;
       +        }
       +
       +        Manifest manifest = parsePluginManifest(hpiResUrl);
       +        String dependencySpec = manifest.getMainAttributes().getValue("Plugin-Dependencies");
       +        if (dependencySpec != null) {
       +            String[] dependencyTokens = dependencySpec.split(",");
       +
       +            for (String dependencyToken : dependencyTokens) {
       +                
       +                // dependencyUrl=...
       +
       +                if (dependencyURL != null) {
       +                    dependencySet.add(dependencyURL);
       +                    // And transitive deps...
       +                    addDependencies(dependencyURL, fromPath, dependencySet);
       +                }
       +            }
       +        }
       +    }
      

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/PluginManager.java
          http://jenkins-ci.org/commit/jenkins/ebb84da617a989d9d1bff8660d9903d89ca3ea41
          Log:
          JENKINS-34748 - Fix handling of dependency trees in PluginManager::addDependencies() (#2334)

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/PluginManager.java http://jenkins-ci.org/commit/jenkins/ebb84da617a989d9d1bff8660d9903d89ca3ea41 Log: JENKINS-34748 - Fix handling of dependency trees in PluginManager::addDependencies() (#2334)
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          Fixed in jenkins-2.4

          Show
          oleg_nenashev Oleg Nenashev added a comment - Fixed in jenkins-2.4

            People

            • Assignee:
              oleg_nenashev Oleg Nenashev
              Reporter:
              oleg_nenashev Oleg Nenashev
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: