Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

GlobToRegexFunctionType documentation updates required #245

Closed
joval opened this issue Mar 18, 2015 · 1 comment
Closed

GlobToRegexFunctionType documentation updates required #245

joval opened this issue Mar 18, 2015 · 1 comment
Milestone

Comments

@joval
Copy link

joval commented Mar 18, 2015

@iankko
Copy link

iankko commented Mar 18, 2015

Thank you for filing this ticket, David.

Further issue details (to document what is currently wrong). The current (OVAL 5.11) glob_to_regex() function documentation provides couple of examples for different values of noescape attribute. Quoting relevant parts from current documentation:
    http://oval.mitre.org/language/version5.11/ovaldefinition/documentation/oval-definitions-schema.html#GlobToRegexFunctionType

For example given the input glob pattern would be '\*' then the resulting Perl 5's regular
expression would be '^\\.*$' in the default (glob_noescape=false) case (here '\' would be
interpreted as an escape character), and would produce '^\.*$' in glob_noescape=true case
(since here '\' would be interpreted as an literal). Similarly the output for '\?' glob
pattern would be '^\\.$' (default,  glob_noescape=false case), and '^\.$' for
glob_noescape=true case.

As correctly pointed out by David via the link above, the resulting form of examples is incorrect now.

The correct version should be:

# Results for C '\*' glob:
----------------------------------------
  glob_noescape  | Perl regular expression
----------------------------------------
      FALSE           |      ^\*$
       TRUE           |     ^\\.*$
----------------------------------------

# Results for C '\?' glob:
----------------------------------------
  glob_noescape | Perl regular expression
----------------------------------------
     FALSE           |      ^\?$
      TRUE           |      ^\\.$
---------------------------------------- 

And to provide yet one example for handling of '[' and ']' characters it's listed below:

# Results for C '\[hello\]' glob:
----------------------------------------
  glob_noescape | Perl regular expression
----------------------------------------
     FALSE           | ^\[hello\]$
      TRUE            | ^\\[hello\\]$ 

I will create & attach corresponding OVAL Language git repository changes & add a diff here.

Thank you && Regards, Jan.
Jan iankko Lieskovsky

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants