libosmocore.git branch master updated. 0.9.6-387-g4a31ffa2

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-commitlog@lists.osmocom.org/.

gitosis at osmocom.org gitosis at osmocom.org
Tue Sep 19 01:35:46 UTC 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "An utility library for Open Source Mobile Communications".

The branch, master has been updated
       via  4a31ffa2f0097d96201f80305a0495c57552f0ad (commit)
      from  a52d839343aea9b81c2463f52c3c3358778698f3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cgit.osmocom.org/libosmocore/commit/?id=4a31ffa2f0097d96201f80305a0495c57552f0ad

commit 4a31ffa2f0097d96201f80305a0495c57552f0ad
Author: Neels Hofmeyr <neels at hofmeyr.de>
Date:   Thu Sep 7 03:08:06 2017 +0200

    VTY: implicit node exit by de-indenting, not parent lookup
    
    Note: This will break users' config files if they do not use consistent
    indenting. (see below for a definition of "consistent".)
    
    When reading VTY commands from a file, use indenting as means to implicitly
    exit child nodes. Do not look for commands in the parent node implicitly.
    
    The VTY so far implies 'exit' commands if a VTY line cannot be parsed on the
    current node, but succeeds on the parent node. That is the mechanism by which
    our VTY config files do not need 'exit' at the end of each child node.
    
    We've hit problems with this in the following scenarios, which will show
    improved user experience after this patch:
    
    *) When both a parent and its child node have commands with identical names:
    
      cs7 instace 0
       point-code 1.2.3
       sccp-address osmo-msc
        point-code 0.0.1
    
    If I put the parent's command below the child, it is still interpreted in the
    context of the child node:
    
      cs7 instace 0
       sccp-address osmo-msc
        point-code 0.0.1
       point-code 1.2.3
    
    Though the indenting lets me assume I am setting the cs7 instance's global PC
    to 1.2.3, I'm actually overwriting osmo-msc's PC with 1.2.3 and discarding the
    0.0.1.
    
    *) When a software change moves a VTY command from a child to a parent. Say
    'timezone' moved from 'bts' to 'network' level:
    
      network
       timezone 1 2
    
    Say a user still has an old config file with 'timezone' on the child level:
    
      network
       bts 0
        timezone 1 2
        trx 0
    
    The user would expect an error message that 'timezone' is invalid on the 'bts'
    level. Instead, the VTY finds the parent node's 'timezone', steps out of 'bts'
    to the 'network' level, and instead says that the 'trx' command does not exist.
    
    Format:
    
    Consistent means that two adjacent indenting lines have the exact
    same indenting characters for the common length:
    
    Weird mix if you ask me, but correct and consistent:
    
      ROOT
      <space>PARENT
      <space><tab><space>CHILD
      <space><tab><space><tab><tab>GRANDCHILD
      <space><tab><space><tab><tab>GRANDCHILD2
      <space>SIBLING
    
    Inconsistent:
    
      ROOT
      <space>PARENT
      <tab><space>CHILD
      <space><space><tab>GRANDCHILD
      <space><tab><tab>GRANDCHILD2
      <tab>SIBLING
    
    Also, when going back to a parent level, the exact same indenting must be used
    as before in that node:
    
    Incorrect:
    
      ROOT
      <tab>PARENT
      <tab><tab><tab>CHILD
      <tab><tab>SIBLING
    
    As not really intended side effect, it is also permitted to indent the entire
    file starting from the root level. We could guard against it but there's no
    harm:
    
    Correct and consistent:
    
      <tab>ROOT
      <tab><tab>PARENT
      <tab><tab><tab><tab>CHILD
      <tab><tab>SIBLING
    
    Implementation:
    
    Track parent nodes state: whenever a command enters a child node, push a parent
    node onto an llist to remember the exact indentation characters used for that
    level.
    
    As soon as the first line on a child node is parsed, remember this new
    indentation (which must have a longer strlen() than its parent level) to apply
    to all remaining child siblings and grandchildren.
    
    If the amount of spaces that indent a following VTY command are less than this
    expected indentation, call vty_go_parent() until it matches up.
    
    At any level, if the common length of indentation characters mismatch, abort
    parsing in error.
    
    Transitions to child node are spread across VTY implementations and are hard to
    change. But transitions to the parent node are all handled by vty_go_parent().
    By popping a parent from the list of parents in vty_go_parent(), we can also
    detect that a command has changed the node without changing the parent, hence
    it must have stepped into a child node, and we can push a parent frame.
    
    The behavior on the interactive telnet VTY remains unchanged.
    
    Change-Id: I24cbb3f6de111f2d31110c3c484c066f1153aac9

-----------------------------------------------------------------------

Summary of changes:
 include/osmocom/vty/command.h      |   2 +
 include/osmocom/vty/vty.h          |  23 ++++
 src/vty/command.c                  | 216 ++++++++++++++++++++++++++++++++-----
 src/vty/vty.c                      |   8 ++
 tests/Makefile.am                  |  13 ++-
 tests/testsuite.at                 |   1 +
 tests/vty/fail_not_de-indented.cfg |   3 +
 tests/vty/fail_tabs_and_spaces.cfg |   4 +
 tests/vty/fail_too_much_indent.cfg |   3 +
 tests/vty/ok.cfg                   |   3 +
 tests/vty/ok_ignore_blank.cfg      |   7 ++
 tests/vty/ok_ignore_comment.cfg    |   7 ++
 tests/vty/ok_indented_root.cfg     |   3 +
 tests/vty/ok_more_spaces.cfg       |   4 +
 tests/vty/ok_tabs.cfg              |   4 +
 tests/vty/ok_tabs_and_spaces.cfg   |   4 +
 tests/vty/vty_test.c               |  20 ++++
 tests/vty/vty_test.ok              |  20 ++++
 18 files changed, 320 insertions(+), 25 deletions(-)
 create mode 100644 tests/vty/fail_not_de-indented.cfg
 create mode 100644 tests/vty/fail_tabs_and_spaces.cfg
 create mode 100644 tests/vty/fail_too_much_indent.cfg
 create mode 100644 tests/vty/ok.cfg
 create mode 100644 tests/vty/ok_ignore_blank.cfg
 create mode 100644 tests/vty/ok_ignore_comment.cfg
 create mode 100644 tests/vty/ok_indented_root.cfg
 create mode 100644 tests/vty/ok_more_spaces.cfg
 create mode 100644 tests/vty/ok_tabs.cfg
 create mode 100644 tests/vty/ok_tabs_and_spaces.cfg


hooks/post-receive
-- 
An utility library for Open Source Mobile Communications



More information about the osmocom-commitlog mailing list