From 430636328c2fbd9fffc0eac5114462c200b7f2cb Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 19 Sep 2017 23:54:01 +0200 Subject: fix vty regression: empty parent node The recent exit-by-indent patch breaks a VTY case where a node is entered but directly followed by a sibling or ancestor without listing any child nodes. Regression introduced by I24cbb3f6de111f2d31110c3c484c066f1153aac9. An example is a common usage in osmo-bts, where 'phy N' / 'instance N' is a parent node that is commonly left empty: phy 0 instance 0 bts 0 band 1800 Before this patch, this case produces the error: There is no such command. Error occurred during reading the below line: bts 0 Fix indentation parsing logic in command.c to accomodate this case. Add a unit test for empty parent node. Change-Id: Ia0880a17ae55accb092ae8585cc3a1bec9986891 --- tests/vty/vty_test.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/vty/vty_test.c') diff --git a/tests/vty/vty_test.c b/tests/vty/vty_test.c index eba9995c..d9af6aee 100644 --- a/tests/vty/vty_test.c +++ b/tests/vty/vty_test.c @@ -342,6 +342,7 @@ int main(int argc, char **argv) test_exit_by_indent("fail_too_much_indent.cfg", -EINVAL); test_exit_by_indent("fail_tabs_and_spaces.cfg", -EINVAL); test_exit_by_indent("ok_indented_root.cfg", 0); + test_exit_by_indent("ok_empty_parent.cfg", 0); /* Leak check */ OSMO_ASSERT(talloc_total_blocks(stats_ctx) == 1); -- cgit v1.2.3