Filtering: add support for star-only globbing patterns
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 17 Feb 2017 09:14:40 +0000 (04:14 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 10 Mar 2017 16:28:11 +0000 (11:28 -0500)
commit3151a51df2b93554f3e4559a2e7ec08541e8674d
treebd500c04dde24811a05555ad6b06abddd7d86afc
parente85a0294955aee3dfa48d2a8c18646a16d7b8750
Filtering: add support for star-only globbing patterns

This patch adds the support for "full" star-only globbing patterns to be
used in filter literal strings. A star-only globbing pattern is a
globbing pattern with the star (`*`) being the only special character.
This means `?` and character sets (`[abc-k]`) are not supported here. We
cannot support them without a strategy to differentiate the globbing
pattern because `?` and `[` are not special characters in filter literal
strings right now. The eventual strategy to support them would probably
look like this:

    filename =* "?sys*.[ch]"

The filter bytecode generator in LTTng-tools's session daemon creates
the new FILTER_OP_LOAD_STAR_GLOB_STRING operation when the interpreter
should load a star globbing pattern literal string. Even if both
"plain", or legacy strings and star globbing pattern strings are literal
strings, they do not represent the same thing, that is, the == and !=
operators act differently.

The validation process checks that:

1. There's no binary operator between two
   FILTER_OP_LOAD_STAR_GLOB_STRING operations. It is illegal to compare
   two star globbing patterns, as this is not trivial to implement, and
   completely useless as far as I know.

2. Only the == and != binary operators are allowed between a
   star globbing pattern and a string.

For the special case of star globbing patterns with a star at the end
only, the current behaviour is not changed to preserve a maximum of
backward compatibility. This is also why the UST ABI version is changed
from 7.1 to 7.2, not to 8.0.

== or != operations between REG_STRING and REG_STAR_GLOB_STRING
registers is specialized to FILTER_OP_EQ_STAR_GLOB_STRING and
FILTER_OP_NE_STAR_GLOB_STRING. Which side is the actual globbing pattern
(the one with the REG_STAR_GLOB_STRING type) is checked at execution
time. The strutils_star_glob_match() function is used to perform the
match operation. See the implementation for more details.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-abi.h
liblttng-ust/filter-bytecode.h
liblttng-ust/lttng-filter-interpreter.c
liblttng-ust/lttng-filter-specialize.c
liblttng-ust/lttng-filter-validator.c
liblttng-ust/lttng-filter.h
This page took 0.025086 seconds and 4 git commands to generate.