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

          oleg_nenashev Oleg Nenashev created issue -
          oleg_nenashev Oleg Nenashev made changes -
          Field Original Value New Value
          Assignee Oleg Nenashev [ oleg_nenashev ]
          oleg_nenashev Oleg Nenashev made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          oleg_nenashev Oleg Nenashev made changes -
          Labels installation regression installation lts-candidate regression
          olivergondza Oliver Gondža made changes -
          Labels installation lts-candidate regression 1.651.3-rejected installation lts-candidate regression
          olivergondza Oliver Gondža made changes -
          Labels 1.651.3-rejected installation lts-candidate regression 1.651.3-rejected installation regression
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 170930 ] JNJira + In-Review [ 198986 ]

            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: