[{"id":35799,"web_url":"https://patchwork.libcamera.org/comment/35799/","msgid":"<175767028692.2127323.13152178946272901320@neptunite.rasen.tech>","date":"2025-09-12T09:44:46","subject":"Re: [PATCH v17 12/12] config: Check configuration file version","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Milan,\n\nThanks for the patch.\n\nQuoting Milan Zamazal (2025-09-11 18:29:42)\n> We don't know what the future versions of the configuration file will\n> look like.  The current code can process only version 1; let's check\n> that the read configuration is of this version.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n\nLooks good to me.\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/libcamera/global_configuration.cpp | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n> \n> diff --git a/src/libcamera/global_configuration.cpp b/src/libcamera/global_configuration.cpp\n> index 8c2670e03..2eec45363 100644\n> --- a/src/libcamera/global_configuration.cpp\n> +++ b/src/libcamera/global_configuration.cpp\n> @@ -67,6 +67,15 @@ bool GlobalConfiguration::loadFile(const std::filesystem::path &fileName)\n>                 return true;\n>         }\n>  \n> +       const std::optional<int> version = (*configuration)[\"version\"].get<int>();\n> +       if (version != 1) {\n> +               LOG(Configuration, Error)\n> +                       << \"Failed to read configuration file due to unsupported version \"\n> +                       << (version ? std::to_string(version.value()) : \"\\\"unspecified\\\"\")\n> +                       << \", expected version 1\";\n> +               return true;\n> +       }\n> +\n>         yamlConfiguration_ = std::move(configuration);\n>         return true;\n>  }\n> -- \n> 2.51.0\n>","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 9B640C324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Sep 2025 09:44:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B6A2A6936E;\n\tFri, 12 Sep 2025 11:44:54 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 408F8613A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Sep 2025 11:44:53 +0200 (CEST)","from neptunite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:5c83:71e0:e0c7:1670])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 580DAE92;\n\tFri, 12 Sep 2025 11:43:37 +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=\"GbDkWbCL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1757670217;\n\tbh=91cY2BL9z7CDrQinqTL0ziTe8s9DPvc+W5V/a3P6GbI=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=GbDkWbCLxrBSBlQ6JeUFcF40wQI1arZy1xg2PVraNsgLDojEa2yLlpHWI2sMagN9v\n\tlIfhuIzMEYKGpyZSOwT36qtg6PbCvdbU86GI8s9LeIYwPsw20ZmjkybeLrNx6jb8Mk\n\tqtxxFf+q6LHvJXNf2lHyMquf6VzGV4fVBDQL97xc=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250911092945.16517-13-mzamazal@redhat.com>","References":"<20250911092945.16517-1-mzamazal@redhat.com>\n\t<20250911092945.16517-13-mzamazal@redhat.com>","Subject":"Re: [PATCH v17 12/12] config: Check configuration file version","From":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>, Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>, =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?=\n\t<barnabas.pocze@ideasonboard.com>, Laurent Pinchart\n\t<laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Date":"Fri, 12 Sep 2025 18:44:46 +0900","Message-ID":"<175767028692.2127323.13152178946272901320@neptunite.rasen.tech>","User-Agent":"alot/0.0.0","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>"}}]