Skip to content

regression: self-referencing instance-identifier in a union #2626

Open

Description

@jktjkt

We have a test in libyang-cpp for this, and upstream commit 422f6af introduced a regression: parsing a self-referencing identityref causes an infinite loop. Then this got changed into an assertion failure in commit f78e8b1:

CESNET/libyang/src/validation.c:692: LY_ERR lyd_validate_unres(struct lyd_node **, enum lyd_type, struct ly_set *, struct ly_set *, struct ly_set *, struct ly_set *, uint32_t, struct lyd_node **):
Assertion `(node_when->count && node_types->count) || (node_types->count > 1)' failed.

We're parsing the following JSON:

{"example-schema:pwnedUnion": "/example-schema:pwnedUnion"}

...via a model like this:

    leaf pwnedUnion {
        type union {
            type decimal64 {
                fraction-digits 1;
            }
            type leafref {
                path '../person/name';
            }
            type union {
                type instance-identifier;
                type identityref {
                    base food;
                }
                type union {
                    type binary {
                        length 1;
                    }
                    type decimal64 {
                        fraction-digits 3;
                    }
                }
            }
        }
    }

Activity

  1. changed the title [-]regression: self-referencing identityref in a union[/-] [+]regression: self-referencing instance-identifier in a union[/+] on Nov 9, 2026
  2. added a commit that references this issue on Nov 10, 2026
    9324c26
  3. michalvasko commented on Nov 10, 2026

    @michalvasko
    Member

    Thanks, added into the tests. But I have no idea whether such a value is a valid instance-identifier or not so just a warning is printed.

  4. added
    is:bug
    status:completed
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    is:bugstatus:completed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions