From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A623521D3E4 for ; Sun, 15 Mar 2026 17:11:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773594673; cv=pass; b=NJa2TueGa+FM5T9wVRuYH8euNqQu7/NOxm/Vva48LcOezRpBKjcplcX6G4YIxlf+DFRDvZM5C8tOBHLjjd13mveBh7iwI/Ta2Rc11ZRtN3hM5p4htHbVy8zfxGnncwROUzAALaBu2nmg+VQiIkJ3X21x6PT7Rps6pw+5m0lh4Vg= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773594673; c=relaxed/simple; bh=twMRFGB9Dd4x85yUErTbV78RWwI7vp6AQr2NjhoBAEo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=HI8xzUuLsuWsei83Jrbw/gLSs9EMcosPUXEFs7T5RW5efs/HPi0OkgNQfjX8VSoVQqhOpVIdoUtK0xzhdO3XiOarOzQQCRk4UHgVNJP4E5ddpT0rsgvf/4GeuyWVyD4eyLz5FmbgVfDoQx/hB7vIu6V2hHN4Ap1dThFEMNFVe1k= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=nEFW+cNY; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="nEFW+cNY" ARC-Seal: i=1; a=rsa-sha256; t=1773594668; cv=none; d=zohomail.eu; s=zohoarc; b=jWkwFWngUBxK587MYzy5RL0g4lW2GWZd5VMl0xnrW+JWEA0Gy+fbXEGAvVmMpUwTxfwJFZocR5ilhzAOwZdWmbe35nZ6JLnSCIRa59zELlB2xm4gxwkUzL/YdS91eVuws4Pzw/6PBPHYhK2e/2SPReJeLV4wA74OGXM+vz36sD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773594668; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=iJe2+yG6JyhtL9lUFPXdLG/LuIQ7SjMfa1bRJZZfZno=; b=MpF5rlMN8MjwNNEUw0tkyPyN3s6JJC3Py+6amDHCEn7+Yoanig6pozwQq5IPAc1YvjHfN8PJeR+ImDahGMLFoeEYEcsCiVEBF5YBw9mh289nSk4xkAXWIgPf6QBVu+XmuMoP7YxTtMqFZC7aGBRdWe+fo5g9E2+kwalZf8o/Qvs= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773594668; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=iJe2+yG6JyhtL9lUFPXdLG/LuIQ7SjMfa1bRJZZfZno=; b=nEFW+cNYuooHqBYo5UKko24TrUAWpyDvGaZGEBAeof9m8cZvhVEDdpUG6JIq3fJf DObOAWn+Q59F8BEoX3hqqkyOIeuCRWzvOxsaYQ/htg0BwSH02ioT0rqNW0LuM06EUrU G53VivV5o+XmKx4mF/0gMYtK9xdlVgAYSonDP40k= Received: by mx.zoho.eu with SMTPS id 1773594666448348.20848608342305; Sun, 15 Mar 2026 18:11:06 +0100 (CET) From: Josh Law To: Andrew Morton , Josh Law 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 Message-Id: <20260315171104.268944-1-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External 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