Ivy
  1. Ivy
  2. IVY-1300

Delivered ivy descriptor inconsistent with resolve report / retrieve and other post-resolve actions

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0-RC2
    • Component/s: None
    • Labels:
      None

      Description

      When there is a conflict with the following characteristics, there is inconsistency of behaviour between most post-resolve actions, and the deliver action. Whereas retrieve / report etc are correct w.r.t the selected revision, Deliver produces an ivy descriptor that contains the evicted revision.

      The characteristics are:

      • Branches are in use
      • No special conflict manager or latest strategies are configured
      • There is a direct dependency on the module, and a transitive dependency on it
      • The transitive dependency has a higher version number than the direct dependency, BUT is on a different branch
      • This is a conflict; the (default) conflict manager selects the indirect/transitive one because its revision is 'latest' as you would expect
      • The ivy report and retrieve results reflect this selection
      • The delivered ivy descriptor contains the evicted version of the dependency

      Notes

      • Force is not in use
      • It is appreciably the case that it is most often an error (logically speaking) to have a conflict amongst different versions on different branches. Nevertheless, one expects ivy to behave consistently.

      In my view, here are the factors causing this:

      • the properties file written during the resolve process does not contain the selected branch information, only the requested branch (and only for the most direct dependency spec, if there are several)
      • in deliver, the iterator of the dependencies does not process those dependency IvyNodes that are not referenced directly by the root IvyNode. So where an indirect IvyNode was selected, it is ignored. This is a logic error.

      The properties file written during the resolve seems to be a frequent source of bugs. I wonder why the xml report is not used? IVY-1159 was also down to insufficient information in the properties file.

      1. patchfix.txt
        9 kB
        Ed Burcher
      2. patch.txt
        12 kB
        Ed Burcher
      3. extratests.txt
        6 kB
        Ed Burcher

        Activity

        Hide
        Ed Burcher added a comment - - edited

        Attachment patch.txt is a patch to trunk rev 1132750 to provide test case

        Show
        Ed Burcher added a comment - - edited Attachment patch.txt is a patch to trunk rev 1132750 to provide test case
        Hide
        Ed Burcher added a comment -

        Attachment patchfix.txt is a suggested fix to apply to trunk rev 1132750

        Show
        Ed Burcher added a comment - Attachment patchfix.txt is a suggested fix to apply to trunk rev 1132750
        Hide
        Ed Burcher added a comment -

        Attachment patchfix.txt is a suggested fix for the issue

        Show
        Ed Burcher added a comment - Attachment patchfix.txt is a suggested fix for the issue
        Hide
        Nicolas Lalevée added a comment -

        Path applied cleanly. Suggested test does break with the current trunk, and get fixed with the suggested patch.

        But some other tests now fails:

        • IvyDeliverTest#testWithDynEvicted: expected:<org1#mod1.2;1.1> but was:<org1#mod1.2;2.2>
        • IvyDeliverTest#testWithDynEvicted2: expected:<org1#mod1.2;1.1> but was:<org1#mod1.2;2.2>

        This needs to be investigated before applying the patch.

        Show
        Nicolas Lalevée added a comment - Path applied cleanly. Suggested test does break with the current trunk, and get fixed with the suggested patch. But some other tests now fails: IvyDeliverTest#testWithDynEvicted: expected:<org1#mod1.2;1.1> but was:<org1#mod1.2;2.2> IvyDeliverTest#testWithDynEvicted2: expected:<org1#mod1.2;1.1> but was:<org1#mod1.2;2.2> This needs to be investigated before applying the patch.
        Hide
        Ed Burcher added a comment -

        I had a look at the breaking tests. Frankly, I think they're testing for broken behaviour. Rather than try to argue this, I've attached a couple of extra tests.

        These are precisely the same as the existing 'testWithDynEvicted' and 'testWithDynEvicted2' but they additionally check that the retrieved artifacts (from the original resolve) are the artifacts you would actually get if you used the delivered descriptor.

        As you'll see, without my fix you get a break because the delivered ivy file doesn't produce the correct artifacts. With it, things are consistent.

        Show
        Ed Burcher added a comment - I had a look at the breaking tests. Frankly, I think they're testing for broken behaviour. Rather than try to argue this, I've attached a couple of extra tests. These are precisely the same as the existing 'testWithDynEvicted' and 'testWithDynEvicted2' but they additionally check that the retrieved artifacts (from the original resolve) are the artifacts you would actually get if you used the delivered descriptor. As you'll see, without my fix you get a break because the delivered ivy file doesn't produce the correct artifacts. With it, things are consistent.
        Hide
        Nicolas Lalevée added a comment -

        This time I look deeper into the code. At first I though it was incorrect for ResolveEngine.getDependencies() to return evicted dependencies. So I tried another fix than yours. I got your provided test cases working but then I was breaking the test IvyDeliverTest.testDifferentRevisionsForSameModule(). This last test is quite weird, I got a little confused. I started to work around that, actually let ResolveEngine.getDependencies() return evicted dependencies.
        Finally I got almost what you have in your patch.
        So I applied your patch. Thanks you Ed.

        Show
        Nicolas Lalevée added a comment - This time I look deeper into the code. At first I though it was incorrect for ResolveEngine.getDependencies() to return evicted dependencies. So I tried another fix than yours. I got your provided test cases working but then I was breaking the test IvyDeliverTest.testDifferentRevisionsForSameModule(). This last test is quite weird, I got a little confused. I started to work around that, actually let ResolveEngine.getDependencies() return evicted dependencies. Finally I got almost what you have in your patch. So I applied your patch. Thanks you Ed.

          People

          • Assignee:
            Nicolas Lalevée
            Reporter:
            Ed Burcher
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development