[{"id":35932,"web_url":"https://patchwork.libcamera.org/comment/35932/","msgid":"<20250921010749.GH10985@pendragon.ideasonboard.com>","date":"2025-09-21T01:07:49","subject":"Re: [PATCH v18 12/12] config: Check configuration file version","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Milan,\n\nThank you for the patch.\n\nOn Fri, Sep 12, 2025 at 04:29:14PM +0200, Milan Zamazal wrote:\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> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\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>  \t\treturn true;\n>  \t}\n>  \n> +\tconst std::optional<int> version = (*configuration)[\"version\"].get<int>();\n> +\tif (version != 1) {\n> +\t\tLOG(Configuration, Error)\n> +\t\t\t<< \"Failed to read configuration file due to unsupported version \"\n\ns/read/load/\n\nI'll fix this when applying.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t\t\t<< (version ? std::to_string(version.value()) : \"\\\"unspecified\\\"\")\n> +\t\t\t<< \", expected version 1\";\n> +\t\treturn true;\n> +\t}\n> +\n>  \tyamlConfiguration_ = std::move(configuration);\n>  \treturn true;\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 207B2BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 21 Sep 2025 01:08:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E309B6B59C;\n\tSun, 21 Sep 2025 03:08:22 +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 B851B62C35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 21 Sep 2025 03:08:19 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id F039D7CE;\n\tSun, 21 Sep 2025 03:06:57 +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=\"n3IaBv3+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1758416818;\n\tbh=QDmYHQS5ZupPU4HwIcWu6BzOLxmsdPf5pSYWUG7bx2o=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=n3IaBv3+G1EYyib6nJxTJ0mdRgsVlYaTpA1GGH/0G9zXyjm5zpSefo4Ox1A45kop1\n\tvUHiDkUHLRHrHIo0TGwe3Z3KH2e0vYwAHp51ICgRRR6qWhDlUFRXVP7sXK1zKSZOx5\n\tcgaMvaquuXtPdzBd45pQALtC/6CTLYZvXjdtf+kw=","Date":"Sun, 21 Sep 2025 04:07:49 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org, Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>, =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?=\n\t<barnabas.pocze@ideasonboard.com>, Paul Elder\n\t<paul.elder@ideasonboard.com>","Subject":"Re: [PATCH v18 12/12] config: Check configuration file version","Message-ID":"<20250921010749.GH10985@pendragon.ideasonboard.com>","References":"<20250912142915.53949-1-mzamazal@redhat.com>\n\t<20250912142915.53949-14-mzamazal@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20250912142915.53949-14-mzamazal@redhat.com>","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>"}}]