{"id":23626,"url":"https://patchwork.libcamera.org/api/patches/23626/?format=json","web_url":"https://patchwork.libcamera.org/patch/23626/","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":"<20250612135943.522819-3-stefan.klug@ideasonboard.com>","date":"2025-06-12T13:56:45","name":"[v2,2/2] libcamera: base: Fix log level parsing when multiple categories are listed","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"573cd1dc080d32cca9e01b157747d8fa3ab37681","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/23626/mbox/","series":[{"id":5240,"url":"https://patchwork.libcamera.org/api/series/5240/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5240","date":"2025-06-12T13:56:43","name":"Fix log level parsing when multiple categories are listed","version":2,"mbox":"https://patchwork.libcamera.org/series/5240/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23626/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23626/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":["parsemail@patchwork.libcamera.org","kbingham@ideasonboard.com"],"Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6B86ABDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Jun 2025 14:13:08 +0000 (UTC)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net\n\t[86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B5C6A15BF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Jun 2025 16:12:51 +0200 (CEST)","from perceval.ideasonboard.com\n\tby perceval.ideasonboard.com with LMTP id EI1mAVrdSmgXMi0A4E0KoQ\n\t(envelope-from <libcamera-devel-bounces@lists.libcamera.org>)\n\tfor <kbingham@ideasonboard.com>; Thu, 12 Jun 2025 15:59:54 +0200","from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\tby perceval.ideasonboard.com (Postfix) with ESMTPS\n\tid D0523169;\tThu, 12 Jun 2025 15:59:53 +0200 (CEST)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 46E5968DC4;\n\tThu, 12 Jun 2025 16:00:00 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 59FEC68DBD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Jun 2025 15:59:56 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:3176:2bf8:8f04:4c4])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 965087E4;\n\tThu, 12 Jun 2025 15:59:47 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1750687971;\n\tbh=ggINKzTg3FDnoDSN/3GUf8CvotH316eNtWQv2r5Xp6c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id:\n\tList-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\tResent-From:Resent-To:From;\n\tb=hVXWgn6PYGLre7AlPD+myutL3jYZj9sEImLiiVCcCybqAY6XQioJqsrsfpYCD1cUb\n\t5pamSBFJQOXnZfdUGkFwIro/b7Eq8kUsTfH0MwDHUfIDjyRB8NH5hEjy3urNcOvrV2\n\t8b3Z4TXmlXXWrgGbX1mmmorgczDZLl+nElFJv3O8=","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1749736787;\n\tbh=4HmJZGXC2e+pWBGyuZ0aJO0K3h6qnix/CcEQXp7Q3E4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=GROky4fDjKriSewZCMruBI+gRs2wRMS83OKoi6J3FBlskqMfxRAGhlRO3EAtxsDh/\n\ttZgrP5ls0r2h+7KixUK6RhKKW57T1fp5/43uCXy6AhJaovAVGqzaYwtTfv0Nf4Zjan\n\ttMHIJCZrspRlGDoKDMQ4Ya4aLGABgyMwx/mSh3SU="],"Authentication-Results":["perceval.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.a=rsa-sha256 header.s=mail header.b=GROky4fD; dkim-atps=neutral","lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"GROky4fD\";\tdkim-atps=neutral"],"From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>, =?utf-8?q?Barnab=C3=A1s_P?=\n\t=?utf-8?b?xZFjemU=?= <barnabas.pocze@ideasonboard.com>","Subject":"[PATCH v2 2/2] libcamera: base: Fix log level parsing when multiple\n\tcategories are listed","Date":"Thu, 12 Jun 2025 15:56:45 +0200","Message-ID":"<20250612135943.522819-3-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.48.1","In-Reply-To":"<20250612135943.522819-1-stefan.klug@ideasonboard.com>","References":"<20250612135943.522819-1-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"quoted-printable","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>","X-TUID":"9hU+iZnFcW/b","Resent-From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Resent-To":"parsemail@patchwork.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>\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/libcamera/base/log.cpp | 5 +++--\n test/log/meson.build       | 2 +-\n 2 files changed, 4 insertions(+), 3 deletions(-)","diff":"diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\nindex 8bf3e1daa9c6..6a8e2a3eb844 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) {\ndiff --git a/test/log/meson.build b/test/log/meson.build\nindex d91f62b9ea5b..f413c3898b2d 100644\n--- a/test/log/meson.build\n+++ b/test/log/meson.build\n@@ -1,7 +1,7 @@\n # SPDX-License-Identifier: CC0-1.0\n \n log_test = [\n-    {'name': 'log_api', 'sources': ['log_api.cpp'], 'should_fail':true},\n+    {'name': 'log_api', 'sources': ['log_api.cpp']},\n     {'name': 'log_process', 'sources': ['log_process.cpp']},\n ]\n \n","prefixes":["v2","2/2"]}