Skip to content

13.0

Latest

Choose a tag to compare

@facelessuser facelessuser released this 01 Dec 15:23

13.0

  • BREAK: On Windows, treat junctions, which include volumes mounted on a folder, the same as symlinks. A ** no
    longer traverses them unless FOLLOW, or *** with GLOBSTARLONG, is used, and WcMatch no longer crawls them
    unless SYMLINKS is used.
  • FIX: Fix a pattern with several ** (GLOBSTAR) and text between them, e.g. **/src/**/test/**/*.py, taking
    seconds to reject a long path that does not match, as the time grew quickly with every **. The text between two
    ** is now only matched once, as it already was for a single *, so the time grows linearly with the length of
    the path. This includes stars, number ranges, and extended glob groups between the **, and it applies to
    REALPATH as well. Some cases are not improved, as the text can match a name that a ** cannot: a group with an
    alternative that starts with a dot, e.g. @(src|.cache), a dot after only groups that can match nothing, e.g.
    ?(a).git, a wildcard like .* that can match . and .. with DOTMATCH, and, with REALPATH, a path that
    exists and crosses a symlink. Enabling NODOTDIR along with DOTMATCH avoids all of these except the symlink
    case. The GLOBSTAR flag is now listed in the security considerations. Issue found by (@msoltanov) and
    (@GeniusKangaroo).
  • FIX: fnmatch allows inputs of pathlib objects, so fix typing to reflect that.
  • FIX: Improve typing for filter functions.
  • FIX: Improve glob performance with GLOBSTAR. A directory is no longer searched again for every way a
    pattern can reach it, which was very slow for patterns with more than one **, e.g. **/*/**/*.py. The results
    are unchanged, including how often each is returned with NOUNIQUE, but they may be returned in a different order.
  • FIX: glob no longer keeps a set of returned files, to filter out duplicates, when a single pattern cannot
    return any, so iglob doesn't use more memory with each result.
  • FIX: Fix a single pattern returning a file more than once with SCANDOTDIR, e.g. **/*/**/*.txt.
  • FIX: Improve globfilter performance with REALPATH. A directory is now checked for being a symlink once per
    call instead of once for every file name under it, so a change made to it during a call may not be noticed.
  • FIX: Fix a pattern with several * failing to match when a number range (NUMRANGE) with no upper bound
    follows one of them, e.g. *<5->*0 did not match 100. This was a regression introduced in 11.2. Such a range now
    tries the shortest number first, so with CAPTURE, the text may be divided differently between a group that holds
    the range and what follows it.
  • FIX: Fix an EXTGLOB group that can match nothing, e.g. *(a), ?(a), or @(a|), matching an empty path
    component, which a * does not. For instance, src/*(a) matched src/ and src/*(a)/x matched src//x, so
    globmatch with REALPATH matched a directory like src for */*(a) where glob did not.
  • FIX: Match an empty path as Bash and Python's fnmatch do. A pattern that is a single path component that can
    match nothing now matches it, e.g. *, !(a), and @(*), which fnmatch and globmatch rejected, and a pattern
    that follows a **, or that has more than one path component, does not, e.g. **/*(a), which matched it. With
    MATCHBASE, a ** is implied before the pattern, so only '' and ** match it.
  • FIX: Reject relative REALPATH matches when root_dir is missing or is not a directory, including Windows
    paths whose . or .. components would otherwise hide the invalid root.
  • FIX: Fix two nested EXTGLOB/EXTMATCH !(...) groups, e.g. !(!(.hidden)) or @(!(!(.*))), matching the
    leading dot of a file name when DOTGLOB/DOTMATCH is disabled. Neither Bash nor CAPTURE matched such names.
  • FIX: Fix an EXTGLOB/EXTMATCH !(...) group inside another group not matching an empty path, e.g. @(!(a))
    with CAPTURE, or @(!(a)|b) and +(!(a)) with or without it.
  • FIX: Fix a ValueError for some patterns with nested EXTGLOB/EXTMATCH !(...) groups, e.g. !(!(!()|))
    with CAPTURE, or !(!(!()|)|!(!()|)).
  • FIX: Fix CAPTURE changing what some patterns with nested EXTGLOB/EXTMATCH !(...) groups match, e.g.
    +(!(!(!(b*))))* did not match b. Everything inside a !(...) group is now parsed the same way with and without
    CAPTURE. The text may be divided differently between the capturing groups.
  • FIX: Fix an EXTGLOB/EXTMATCH !(...) group in a ?(...) or *(...) group which is a whole alternative of
    another group, e.g. @(?(!(*.py))|x) did not match a.pyc.
  • FIX: Fix an EXTGLOB/EXTMATCH @(...) or +(...) group that can match nothing, inside another group,
    letting a literal dot after it match the leading dot of a file name without CAPTURE, e.g. @(x|@(?(a)).b)
    matched .b. A few unusual patterns that Bash matches this way no longer match, e.g. *(@(?(a)).). no longer
    matches ....