Patch Detail
Show a patch.
GET /api/1.1/patches/22611/?format=api
{ "id": 22611, "url": "https://patchwork.libcamera.org/api/1.1/patches/22611/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22611/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20250122101242.96995-1-stefan.klug@ideasonboard.com>", "date": "2025-01-22T10:12:19", "name": "[v2] libcamera: log: Match whole category in LIBCAMERA_LOG_LEVELS", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "d2eb3cd4339be291b5aaff15ac0d888e0af3e236", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22611/mbox/", "series": [ { "id": 4963, "url": "https://patchwork.libcamera.org/api/1.1/series/4963/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4963", "date": "2025-01-22T10:12:19", "name": "[v2] libcamera: log: Match whole category in LIBCAMERA_LOG_LEVELS", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4963/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22611/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22611/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 66652C3200\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jan 2025 10:12:52 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 40A3768558;\n\tWed, 22 Jan 2025 11:12:51 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 91E536187C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jan 2025 11:12:49 +0100 (CET)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:98fa:5e38:1a0b:e8d9])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9FE51C16;\n\tWed, 22 Jan 2025 11:11:46 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"urarmmi2\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1737540706;\n\tbh=Nq6t9EvNGFlaukp6OUWEwtwSSKP2hlNyDsEuaPh5GvI=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=urarmmi22lAvhgzM75HT9zmOM7xsi571jopIoNhvVQoFA3LaE27s3PF51V1D57NAi\n\tKjGF3LzsYOx3p9XjXcbhZfFGEgAE+Z2SHslWmQZ3+Jd9wuhCeanPQ8PiS8I3qIdhIV\n\tcNWrItYzh2H212jeUWUihT+KqCM1QZ/RVbyNetuM=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>", "Subject": "[PATCH v2] libcamera: log: Match whole category in\n\tLIBCAMERA_LOG_LEVELS", "Date": "Wed, 22 Jan 2025 11:12:19 +0100", "Message-ID": "<20250122101242.96995-1-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "A LIBCAMERA_LOG_LEVELS value of \"RkISP1:0\" also applies to RkISP1Ccm and\nRkISP1Awb. This behavior is unexpected as it automatically enables all\nalgorithm log categories when the intent is only to increase the log\nlevel of the upper category. Fix that replacing the manual matching code\nwith fnmatch. This has the side effect that more wildcards (\"?\" and\n\"[...]\") are supported which is acceptable but won't be advertised.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v2:\n- Replaced matching code with fnmatch instead of a manual fix\n---\n src/libcamera/base/log.cpp | 22 ++++------------------\n 1 file changed, 4 insertions(+), 18 deletions(-)", "diff": "diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\nindex 3a656b8f099f..086103b328e6 100644\n--- a/src/libcamera/base/log.cpp\n+++ b/src/libcamera/base/log.cpp\n@@ -8,6 +8,7 @@\n #include <libcamera/base/log.h>\n \n #include <array>\n+#include <fnmatch.h>\n #include <fstream>\n #include <iostream>\n #include <list>\n@@ -717,24 +718,9 @@ void Logger::registerCategory(LogCategory *category)\n \tcategories_.push_back(category);\n \n \tconst std::string &name = category->name();\n-\tfor (const std::pair<std::string, LogSeverity> &level : levels_) {\n-\t\tbool match = true;\n-\n-\t\tfor (unsigned int i = 0; i < level.first.size(); ++i) {\n-\t\t\tif (level.first[i] == '*')\n-\t\t\t\tbreak;\n-\n-\t\t\tif (i >= name.size() ||\n-\t\t\t name[i] != level.first[i]) {\n-\t\t\t\tmatch = false;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t}\n-\n-\t\tif (match) {\n-\t\t\tcategory->setSeverity(level.second);\n-\t\t\tbreak;\n-\t\t}\n+\tfor (const auto &[pattern, severity] : levels_) {\n+\t\tif (fnmatch(pattern.c_str(), name.c_str(), FNM_NOESCAPE) == 0)\n+\t\t\tcategory->setSeverity(severity);\n \t}\n }\n \n", "prefixes": [ "v2" ] }