public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] lib/glob: fixes, new features, and test coverage
@ 2026-03-15 17:10 Josh Law
  2026-03-15 17:10 ` [PATCH 1/7] lib/glob: normalize inverted character class ranges Josh Law
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Josh Law @ 2026-03-15 17:10 UTC (permalink / raw)
  To: Andrew Morton, Josh Law; +Cc: linux-kernel

This series addresses several issues found in lib/glob.c and adds new
functionality with comprehensive test coverage.

Bug fixes:
  - Normalize inverted character class ranges like [z-a] so they
    match the same characters as [a-z] instead of silently matching
    nothing (patch 1).
  - Treat a trailing backslash as a literal '\\' character instead of
    consuming the NUL terminator and matching end-of-string (patch 2).

New features:
  - Accept [^...] as an alias for [!...] in character class negation,
    matching the behavior of git, rsync, and bash (patch 3).
  - Add glob_match_nocase() for case-insensitive pattern matching,
    useful for device model strings and filter expressions where case
    should not matter (patch 4).
  - Add glob_validate() to check pattern syntax upfront, detecting
    unclosed character classes and trailing backslashes so callers
    that accept user input can reject malformed patterns with a clear
    error (patch 5).

Test coverage:
  - Add 47 test cases covering backslash escapes, inverted ranges,
    caret negation, wildcards with empty strings, unclosed brackets,
    consecutive wildcards, and special characters (patch 6).
  - Add parameterized tests for glob_match_nocase() and
    glob_validate() (patch 7).

Build-tested with both lib/glob.o and lib/tests/glob_kunit.o.

Josh Law (7):
  lib/glob: normalize inverted character class ranges
  lib/glob: treat trailing backslash as literal character
  lib/glob: accept [^...] as character class negation syntax
  lib/glob: add case-insensitive glob_match_nocase()
  lib/glob: add glob_validate() for pattern syntax checking
  lib/tests: add glob test cases for escapes, edge cases, and new
    features
  lib/tests: add kunit tests for glob_match_nocase() and glob_validate()

 include/linux/glob.h   |   2 +
 lib/glob.c             | 122 +++++++++++++++++++++++++++++++++++++---
 lib/tests/glob_kunit.c | 124 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 239 insertions(+), 9 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-03-15 17:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-15 17:10 [PATCH 0/7] lib/glob: fixes, new features, and test coverage Josh Law
2026-03-15 17:10 ` [PATCH 1/7] lib/glob: normalize inverted character class ranges Josh Law
2026-03-15 17:10 ` [PATCH 2/7] lib/glob: treat trailing backslash as literal character Josh Law
2026-03-15 17:11 ` [PATCH 3/7] lib/glob: accept [^...] as character class negation syntax Josh Law
2026-03-15 17:11 ` [PATCH 4/7] lib/glob: add case-insensitive glob_match_nocase() Josh Law
2026-03-15 17:11 ` [PATCH 5/7] lib/glob: add glob_validate() for pattern syntax checking Josh Law
2026-03-15 17:11 ` [PATCH 6/7] lib/tests: add glob test cases for escapes, edge cases, and new features Josh Law
2026-03-15 17:11 ` [PATCH 7/7] lib/tests: add kunit tests for glob_match_nocase() and glob_validate() Josh Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox