All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Law <objecting@objecting.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	Josh Law <objecting@objecting.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 0/7] lib/glob: fixes, new features, and test coverage
Date: Sun, 15 Mar 2026 17:10:57 +0000	[thread overview]
Message-ID: <20260315171104.268944-1-objecting@objecting.org> (raw)

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


             reply	other threads:[~2026-03-15 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-15 17:10 Josh Law [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260315171104.268944-1-objecting@objecting.org \
    --to=objecting@objecting.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.