On Thu, 2016-01-14 at 17:31 -0800, Mike Stump wrote:
> On Jan 14, 2016, at 4:54 PM, Zachary T Welch <zwe...@codesourcery.com> wrote:
> > This patch fixes a small problem when running 'make check' from a path
> > that includes "++".  When such paths get used as a regular expression,
> > that sequence would cause a runtime error.  That is prevented here by
> > escaping that character.
> 
> You don’t ask Ok?, and you don’t say committed, so, I’m wondering if you want 
> a review of it…
> 
> Anyway, seems reasonable.  I do wonder if there is a more complete set of 
> meta characters to do with with beyond just a + however.

FWIW, I do something similar in multiline.exp's _build_multiline_regex,
which attempts to have a complete list of metacharacters (though I
believe some of these are not valid for POSIX filenames); currently it
has:

        # We need to escape "^" and other regexp metacharacters.
        set line [string map {"^" "\\^"
                              "(" "\\("
                              ")" "\\)"
                              "[" "\\["
                              "]" "\\]"
                              "{" "\\{"
                              "}" "\\}"
                              "." "\\."
                              "\\" "\\\\"
                              "?" "\\?"
                              "+" "\\+"
                              "*" "\\*"
                              "|" "\\|"} $line]

Maybe this could be turned into a generic helper function?


Dave

Reply via email to