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

bug with positional predicate #2333

Open
choppsv1 opened this issue Jan 7, 2025 · 4 comments
Open

bug with positional predicate #2333

choppsv1 opened this issue Jan 7, 2025 · 4 comments
Labels
is:enhancement Request for adding new feature or enahncing functionality. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...)

Comments

@choppsv1
Copy link
Contributor

choppsv1 commented Jan 7, 2025

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].

@choppsv1
Copy link
Contributor Author

choppsv1 commented Jan 7, 2025

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

@michalvasko
Copy link
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.

@michalvasko michalvasko added the is:question Issue is actually a question. label Jan 7, 2025
@choppsv1
Copy link
Contributor Author

choppsv1 commented Jan 7, 2025 via email

@michalvasko
Copy link
Member

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

@michalvasko michalvasko added is:enhancement Request for adding new feature or enahncing functionality. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...) and removed is:question Issue is actually a question. labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:enhancement Request for adding new feature or enahncing functionality. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...)
Projects
None yet
Development

No branches or pull requests

2 participants