{"id":23473,"url":"https://patchwork.libcamera.org/api/patches/23473/?format=json","web_url":"https://patchwork.libcamera.org/patch/23473/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250606083808.1226386-1-stefan.klug@ideasonboard.com>","date":"2025-06-06T08:37:09","name":"libcamera: base: Fix log level parsing when multiple categories are listed","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"37419d30f393555bf5c92abae8955c6cbe46aa31","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23473/mbox/","series":[{"id":5208,"url":"https://patchwork.libcamera.org/api/series/5208/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5208","date":"2025-06-06T08:37:09","name":"libcamera: base: Fix log level parsing when multiple categories are listed","version":1,"mbox":"https://patchwork.libcamera.org/series/5208/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23473/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23473/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 0D922C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Jun 2025 08:38:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9F3D968DBD;\n\tFri,  6 Jun 2025 10:38:15 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 22D6C68DB1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Jun 2025 10:38:14 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:4842:8d57:2a74:e585])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 690C41340; \n\tFri,  6 Jun 2025 10:38:09 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wK1n68cS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1749199089;\n\tbh=ZIGvl83R4KYX1uVb0ukLfP19j8M8JKuQux6WF89ILJI=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=wK1n68cS1WPzAJy97e/n8ohXBAsNcDIK6UUwKPws4qUCEhabrjFsCTyqR/bl208RD\n\tCqbyFPgz/Po0oCFmqeNGbB77HIOUZLdWoS0sKep6WiJLgcQAyqeavZntWLrRW41vtL\n\tUCE4gq2j2MYXNz9ofwBiH3imEcZR9Ur4y9hYb0oc=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH] libcamera: base: Fix log level parsing when multiple\n\tcategories are listed","Date":"Fri,  6 Jun 2025 10:37:09 +0200","Message-ID":"<20250606083808.1226386-1-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.48.1","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":"For a list of log levels like LIBCAMERA_LOG_LEVELS=\"CatA:0,CatB:1\" only\nthe severity of the last entry is correctly parsed.\n\nDue to the change of level to a string_view in 24c2caa1c1b3 (\"libcamera:\nbase: log: Use `std::string_view` to avoid some copies\") the level is no\nlonger necessarily null terminated as it is a view on the original data.\n\nReplace the check for a terminating null by a check for the end position\nto fix the issue.\n\nFixes: 24c2caa1c1b3 (\"libcamera: base: log: Use `std::string_view` to avoid some copies\")\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/libcamera/base/log.cpp | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\nindex 8bf3e1daa9c6..e024b58d7180 100644\n--- a/src/libcamera/base/log.cpp\n+++ b/src/libcamera/base/log.cpp\n@@ -690,8 +690,9 @@ LogSeverity Logger::parseLogLevel(std::string_view level)\n \tunsigned int severity = LogInvalid;\n \n \tif (std::isdigit(level[0])) {\n-\t\tauto [end, ec] = std::from_chars(level.data(), level.data() + level.size(), severity);\n-\t\tif (ec != std::errc() || *end != '\\0' || severity > LogFatal)\n+\t\tconst char* levelEnd = level.data() + level.size();\n+\t\tauto [end, ec] = std::from_chars(level.data(), levelEnd, severity);\n+\t\tif (ec != std::errc() || end != levelEnd || severity > LogFatal)\n \t\t\tseverity = LogInvalid;\n \t} else {\n \t\tfor (unsigned int i = 0; i < std::size(names); ++i) {\n","prefixes":[]}