Skip to content

bug with positional predicate #2333

Open
@choppsv1

Description

@choppsv1

I'm finding that if I do a:

		err = lyd_new_path2(NULL, ly_native_ctx, xpath, NULL, 0, 0,
				    LYD_NEW_PATH_UPDATE, NULL, trunk);

where xpath is a path that ends in a keyless list entry with a positional predicate (e.g., /foos/foo[2]) I get a new node back. This must be a bug b/c i'm starting from an empty tree and asking for the second node in a keyless list. It's returning a single list node with no siblings IOW /foos/foo[1].

Activity

choppsv1

choppsv1 commented on Jan 7, 2025

@choppsv1
ContributorAuthor

FWIW same issue exists when foo is a leaf-list.

michalvasko

michalvasko commented on Jan 7, 2025

@michalvasko
Member

What exactly would you expect to happen in your use-case? The only unexpected (undocumented) behavior is that any invalid indices are always normalized to the closest valid index, in this case 2 -> 1. In other words, any index higher than the current number of instances causes a new instance to be created.

choppsv1

choppsv1 commented on Jan 7, 2025

@choppsv1
ContributorAuthor
michalvasko

michalvasko commented on Jan 8, 2025

@michalvasko
Member

The very first time someone complains about this but I have no issue with whichever functioning so an error should now be printed.

added
is:enhancementRequest for adding new feature or enahncing functionality.
status:completedFrom the developer perspective, the issue was solved (bug fixed, question answered,...)
and removed
is:questionIssue is actually a question.
on Jan 8, 2025
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:enhancementRequest for adding new feature or enahncing functionality.status:completedFrom the developer perspective, the issue was solved (bug fixed, question answered,...)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @choppsv1@michalvasko

        Issue actions

          bug with positional predicate · Issue #2333 · CESNET/libyang