Skip to content

12.0

Latest

Choose a tag to compare

@facelessuser facelessuser released this 03 Nov 14:23

12.0

  • BREAK: Various fixes to !(...) patterns to more closely align to Bash. 100% Bash behavior is impossible with
    regular expression, but behavior in many ways was improved, but there may be some surprising behavior changes.

    • FIX: Fix an EXTGLOB/EXTMATCH inverse group, !(...), inside another group ignoring the rest of its
      alternative and the text that follows the group, e.g. @(!(a)b) and @(x|!(a))b matched ab. They now follow
      the same rule as inverse groups that are not in a group. Inside +(...) and *(...) groups, the rest is the
      remainder of the alternative and the text after the loop. The rest of the alternative was ignored since 7.0.1,
      and the text after the group since 2.2.1.
    • FIX: Fix an EXTGLOB/EXTMATCH inverse group, !(...), inside another inverse group not ending where the
      text consumed by the outer group ends, e.g. !(!(a)|b) matched aa and !(a!(b)) matched aba. This also
      caused translate() with CAPTURE to match differently than without it for these patterns. This was a
      regression in 7.0.1.
    • FIX: An EXTGLOB/EXTMATCH inverse group, !(...), whose patterns can only match text up to some length,
      e.g. !(foo), !(a|bc), or !(?(a)b), now matches any other text, whatever follows it, as it does in Bash.
      For instance, !(foo)*.txt now matches foo.txt and foobar.txt, !(a)* matches a, and +(!(foo)) matches
      foo. Inverse groups with patterns that can match text of any length, e.g. !(*.js), still need to know what
      follows them and behave as before. Inverse groups inside other inverse groups follow the same rules, e.g.
      !(!(a)|b)* matches a and ab, !(!(a)*) matches nothing, and !(a!(b)*) no longer matches ab.
    • FIX: An EXTGLOB/EXTMATCH inverse group, !(...), whose patterns cannot match nothing can now match
      nothing whenever the rest of the pattern matches, as it does in Bash, even when its patterns can match text of
      any length. For instance, !(*.js)* and !(a*)* now match any name (following dot rules), where
      !(*.js)* rejected a.js and a.json.
  • BREAK: Match Bash logic such that @(*|.a).b can match .b in an extended pattern if the pattern contains an
    explicit leading . in one of the alternatives exists. In this scenario, * is allowed to match nothing before
    .b, but * won't physically match the ..

  • NEW: Generate tighter regular expressions with the same behavior.

  • FIX: A leading * can no longer match nothing so that a literal dot can match the leading dot of a file name,
    e.g. *.env no longer matches .env unless DOTGLOB/DOTMATCH is enabled. This agrees with Bash, Python's
    glob, and fnmatch, which already behaved this way. Use .*env to explicitly match hidden names.

  • FIX: Fix glob and iglob missing a file name without a directory part, e.g. a.txt, when dir_fd is file
    descriptor 0, which a directory can get when it is opened while standard input is closed.

  • FIX: Fix WcMatch returning a file after kill is called from a directory validation hook or its error
    handler.

  • FIX: Preserve bare drive roots such as D: in WcMatch on Windows, so searches use that drive's current
    directory instead of its root directory.

  • FIX: Fix a ? or bracket expression after a leading * matching the leading dot of a file name, e.g. *?a
    matching .a.

  • FIX: Fix a wildcard in an EXTGLOB/EXTMATCH group, such as ?(old-)@(*), matching the leading dot of a file
    name when the text before it, e.g. an optional group or the start of another group slot, matched nothing. Wildcards
    in later iterations of a repeated group, e.g. +(.?|*) and .a., are no longer wrongly restricted.

  • FIX: Fix an EXTGLOB/EXTMATCH @(...) or +(...) group that can match nothing, e.g. @(?(a)),
    +(*(a)) or @(a|?(b)), letting a literal dot after it match the leading dot of a file name, e.g.
    @(?(a)).hidden matching .hidden. Such a group must match something, so it can no longer be skipped to reach
    the dot, as in Bash, unless DOTGLOB/DOTMATCH is enabled or an alternative starts with a dot.

  • FIX: Fix a ? or bracket expression at the start of a repeated EXTGLOB group matching a path separator in
    globmatch and related functions, e.g. +(?) matching a/b. This was a regression in 11.0.1.

  • FIX: Fix an EXTGLOB/EXTMATCH group that is simplified to a different group type, e.g. @(+(b)) or
    @(!(b)), losing its meaning when it is then reduced into its parent group. Repeats and negations were dropped,
    e.g. @(a|@(!(b))) matched b and not c, and !(@(+(a))) matched aa. This was a regression in 11.0.

  • FIX: Preserve byte file names when globbing with dir_fd, including names requiring surrogate escaping.

  • FIX: Use the same case-insensitive matching for literal and wildcard path components in glob and iglob,
    including Unicode case equivalences.

  • FIX: Preserve a terminal directory separator after GLOBSTAR patterns in globmatch, globfilter, and
    translated patterns. Patterns such as **/ and dir/**/ no longer match regular files.

  • FIX: Require the literal prefix of recursive glob and iglob patterns such as file/** to name a directory.

  • FIX: Count duplicate exclusion expansions toward the shared pattern limit in compiled matchers and translation.

  • FIX: Treat an empty root_dir ('' or b'') as the current directory in glob and iglob, including when
    the directory is selected with dir_fd.

  • FIX: Fix glob and iglob returning synthetic . and .. matches with SCANDOTDIR when a directory
    cannot be opened for scanning.

  • FIX: Require bracex 3.2.1 which contains a number of brace related bug fixes.