Error with curl when two lists have the same key integer and one has a leafref to the other

I have two lists, each of which identified by an integer, and every element in the first list has a leafref which points to an element in the second list.
With the cli (confd 6.0) and with netconf, it works just fine. When I try to push a configuration with curl, I get an error on the leafref uniquely when both indices are the same.

My curl command:
curl -X PUT -T myexample.xml -u admin:admin http://127.0.0.1:8008/api/running/myroot

Here’s a simplified yang model:

module application {
  namespace "http://myexample-net/application";
  prefix "application";

  application-attributes {
    container rules {
      list rule {
        key index;
        leaf index {
          type uint16;
        }
        leaf action {
           type leafref {
             path "../../../actions/action/index";
           }
          mandatory true;
          // must "current() = ../../../actions/action/index" {
          //   error-message "action index does not exist.";
          // }
        }
      }
    }
    container actions {
      list action {
        key index;
        leaf index {
          type uint16;
        }
      }
    }
  }
}

With curl, if I push a configuration where the action index is the same as the rule index, confd will reply with an “illegal reference” error. Replacing the leafref by a must condition as commented above will cause my custom error message above to be printed (index not found).

Is this a bug in confd?

Here’s the configuration that generates the error:

<application>
  <application-attributes>
    <actions>
      <action>
        <index>2</index>
      </action>
    </actions>
    <rules>
      <rule>
        <index>2</index>
        <action>2</action>
      </rule>
    </rules>
  </application-attributes>
</application>

Here’s the error message:

<errors xmlns="http://tail-f.com/ns/tailf-rest-error">
  <error>
    <error-tag>malformed-message</error-tag>
    <error-urlpath>/api/running/myroot</error-urlpath>
    <error-message>illegal reference /myroot/application/application-attributes/rules/action</error-message>
  </error>
</errors>

By having the rule index != action index, it will work.

If instead I invert the order of appearance of rules and actions in the xml file, a configuration that previously yielded the above error message will now be accepted and the previous “wrong” rule simply won’t appear in the running configuration (!!!)

<application>
  <application-attributes>
    <rules>
      <rule>
        <index>2</index>
        <action>2</action>
      </rule>
    </rules>
    <actions>
      <action>
        <index>2</index>
      </action>
    </actions>
  </application-attributes>
</application>

I tried this with the latest version (ConfD-6.4) and after fixing the missing container keyword in the simplified model both configurations work.

It possible there was a bug that was fixed sometime between ConfD 6.0 and ConfD-6.4 although nothing jumped out during a quick scan of the CHANGES file.

Thanks. I’ll see if I can install Confd 6.4. I tried with 6.2 and I had the same problem as with 6.0.