Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

printer json BUGFIX nested union value print #2096

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

Ilyesbenhamouda
Copy link

Fix an infinite loop in json_print_value() when
resolved type of a union member is also union.

Fixes: 183b911 ("printer json BUGFIX union realtype value print")

@michalvasko
Copy link
Member

Please switch the target branch to devel, we do not accept PRs into master. Also, do you have a non-working use-case illustrating the need for this fix? I think you are right but a new test would still be appreciated.

Fix an infinite loop in json_print_value() when
resolved type of a union member is also union.

Fixes: 183b911 ("printer json BUGFIX union realtype value print")

Signed-off-by: Ilyes Ben Hamouda <[email protected]>
@Ilyesbenhamouda Ilyesbenhamouda changed the base branch from master to devel September 8, 2023 09:06
@Ilyesbenhamouda
Copy link
Author

Ilyesbenhamouda commented Sep 8, 2023

Done for the target branch :)

Here is an example illustrating the need of this fix:

  • Schema example:
list A {
      key "name";
      description
        "A";

      leaf name {
        type union {
          type uint8;
          type string;
        }
        description
          "List name.";
      }
etc..
}

list B {
      key "name";
      description
        "B";

      leaf name {
        type union {
          type uint16;
          type string;
        }
        description
          "List name.";
      }
etc..
}

leaf C {
  type union {
    type leafref {
      path
        "A/name";
      require-instance false;
    }
    type leafref {
      path
        "B/name";
      require-instance false;
    }
  }
  description
    "C";
}
  • Configuration example:
    <C>toto</C>

@michalvasko
Copy link
Member

Thanks, test added.

@michalvasko michalvasko merged commit 0ee30a8 into CESNET:devel Sep 8, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants