Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v3 0/8] lib/glob: bug fixes, new features, and tests
@ 2026-03-15 21:16 Josh Law
  2026-03-15 21:16 ` [PATCH v2 1/5] lib/glob: add case-insensitive glob_match_nocase() Josh Law
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Josh Law @ 2026-03-15 21:16 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Brendan Higgins, David Gow, Rae Moar, linux-kselftest, kunit-dev,
	linux-kernel, Josh Law

Bug fixes, extensions, and test coverage for lib/glob.c:

Patches 1-3 fix corner cases in the existing glob_match():
  - Inverted character class ranges like [z-a] are now normalized
    instead of silently failing to match.
  - A trailing backslash is treated as a literal '\' rather than
    reading past the end of the pattern string.
  - [^...] is accepted as an alias for [!...] to match the
    regex-style negation syntax documented in glob(7).

Patches 4-5 add two new utility functions:
  - glob_match_nocase() for case-insensitive matching, useful for
    subsystems like ATA that need case-folded denylist comparisons.
  - glob_validate() for checking pattern syntax before use, so
    callers can reject malformed patterns early with a clear error.

Patches 6-7 add kunit test coverage:
  - 47 new test cases for glob_match covering escapes, inverted
    ranges, caret negation, edge cases, and unclosed brackets.
  - 11 test cases for glob_match_nocase.
  - 17 test cases for glob_validate.

Patch 8 adds a real in-tree caller for glob_validate() in the kunit
executor, validating user-provided filter_glob patterns and returning
-EINVAL for malformed ones.

Changes since v2:
  - Fixed missing '^' in __glob_match metacharacter comment (patch 4).
  - Dropped unnecessary braces in glob_validate case '[' (patch 5).
  - Added real-world example to glob_validate() commit message (patch 5).

Changes since v1:
  - Added patch 8 (kunit executor caller for glob_validate).
  - Updated glob_match_nocase() commit message to reference the ATA
    denylist as the intended caller (follow-up patch).

Josh Law (8):
  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()
  kunit: validate glob filter patterns before use

 include/linux/glob.h   |   2 +
 lib/glob.c             | 123 ++++++++++++++++++++++++++++++++++++----
 lib/kunit/executor.c   |  13 +++++
 lib/tests/glob_kunit.c | 124 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 252 insertions(+), 10 deletions(-)

-- 
2.34.1


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

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

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

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