Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-111234

QRegularExpression::wildcardToRegularExpression is incorrect in corner cases

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5
    • None
    • 4b197c3f5 (dev)

    Description

      Dumping a few suspicious things that I've spotted in that function.

      • The documentation https://doc.qt.io/qt-6/qregularexpression.html#wildcardToRegularExpression says :

        The backslash () character is not an escape char in this context. In order to match one of the special characters, place it in square brackets (for example, [?]).


        This is incorrect. glob(7) says

        One can remove the special meaning of '?', '*' and '[' by preceding them by a backslash,

        , and POSIX says https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_01

        special characters can be escaped to remove their special meaning by preceding them with a <backslash> character

      • A leading dot in a filename must not be matched by a * , a ? , a negated category class (e.g. [!x]) , a special category class (e.g. [[:punct:]]). We seem to ignore this issue entirely
      • A slash (path separator) in a character class makes it NOT a character class:

        For example, the pattern "a[b/c]d" does not match such pathnames as abd or a/d. It only matches a pathname of literally a[b/c]d

        , we seem instead to "bail out" and not consider this case accurately

      Attachments

        For Gerrit Dashboard: QTBUG-111234
        # Subject Branch Project Status CR V

        Activity

          People

            thiago Thiago Macieira
            peppe Giuseppe D'Angelo
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes