[{"id":32512,"web_url":"https://patchwork.libcamera.org/comment/32512/","msgid":"<173331207965.3135963.12133412410786978835@ping.linuxembedded.co.uk>","date":"2024-12-04T11:34:39","subject":"Re: [PATCH] libcamera: yaml_parser: Output more details when parsing\n\tfails","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2024-12-04 11:10:13)\n> On malformed yaml files, the yaml parser only errors out without giving\n> details on the error that happened. Fix that by providing a more detailed\n> error message.\n> \n> Output old:\n> \n> ERROR YamlParser yaml_parser.cpp:886 Failed to parse YAML content from /root/imx283.yaml\n> \n> Output new:\n> \n> ERROR YamlParser yaml_parser.cpp:627 /root/imx283.yaml:72:8 could not find expected ':' while scanning a simple key\n\nWell, I can't say no to that!\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ERROR YamlParser yaml_parser.cpp:886 Failed to parse YAML content from /root/imx283.yaml\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  src/libcamera/yaml_parser.cpp | 11 ++++++++++-\n>  1 file changed, 10 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\n> index db256ec5b04d..f9302c4ee3fa 100644\n> --- a/src/libcamera/yaml_parser.cpp\n> +++ b/src/libcamera/yaml_parser.cpp\n> @@ -509,8 +509,17 @@ YamlParserContext::EventPtr YamlParserContext::nextEvent()\n>         EventPtr event(new yaml_event_t);\n>  \n>         /* yaml_parser_parse returns 1 when it succeeds */\n> -       if (!yaml_parser_parse(&parser_, event.get()))\n> +       if (!yaml_parser_parse(&parser_, event.get())) {\n> +               File *file = static_cast<File *>(parser_.read_handler_data);\n> +\n> +               LOG(YamlParser, Error) << file->fileName() << \":\"\n> +                                      << parser_.problem_mark.line << \":\"\n> +                                      << parser_.problem_mark.column << \" \"\n> +                                      << parser_.problem << \" \"\n> +                                      << parser_.context;\n> +\n>                 return nullptr;\n> +       }\n>  \n>         return event;\n>  }\n> -- \n> 2.43.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 3FF82BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Dec 2024 11:34:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 46C33660B7;\n\tWed,  4 Dec 2024 12:34:44 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ADB78618B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Dec 2024 12:34:42 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B17D94D4;\n\tWed,  4 Dec 2024 12:34:14 +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=\"WWHQCrZZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733312054;\n\tbh=oNwiB/B7Rci/ZGtDLM5lG3Nj60Sa/wKaR+/VfVivpCc=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=WWHQCrZZxtpVg638HR5FSxwas5FR/yySDFIO5YWz9rWTwbhvAdOiIdPEFCyO4o57d\n\toLmimJz1grymHF/ckhWK09WPutBvbjbEB1mLH6LrluS98BKGFBVHgjUIiPnPZj32xa\n\tQnGDIVpcI5pZLRtOXeW6d2JSubwNZO1OxvigF9EM=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20241204111017.343760-1-stefan.klug@ideasonboard.com>","References":"<20241204111017.343760-1-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH] libcamera: yaml_parser: Output more details when parsing\n\tfails","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 04 Dec 2024 11:34:39 +0000","Message-ID":"<173331207965.3135963.12133412410786978835@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}},{"id":32553,"web_url":"https://patchwork.libcamera.org/comment/32553/","msgid":"<20241205201243.GG21014@pendragon.ideasonboard.com>","date":"2024-12-05T20:12:43","subject":"Re: [PATCH] libcamera: yaml_parser: Output more details when parsing\n\tfails","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Stefan,\n\nThank you for the patch.\n\nOn Wed, Dec 04, 2024 at 12:10:13PM +0100, Stefan Klug wrote:\n> On malformed yaml files, the yaml parser only errors out without giving\n> details on the error that happened. Fix that by providing a more detailed\n> error message.\n> \n> Output old:\n> \n> ERROR YamlParser yaml_parser.cpp:886 Failed to parse YAML content from /root/imx283.yaml\n> \n> Output new:\n> \n> ERROR YamlParser yaml_parser.cpp:627 /root/imx283.yaml:72:8 could not find expected ':' while scanning a simple key\n> ERROR YamlParser yaml_parser.cpp:886 Failed to parse YAML content from /root/imx283.yaml\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  src/libcamera/yaml_parser.cpp | 11 ++++++++++-\n>  1 file changed, 10 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\n> index db256ec5b04d..f9302c4ee3fa 100644\n> --- a/src/libcamera/yaml_parser.cpp\n> +++ b/src/libcamera/yaml_parser.cpp\n> @@ -509,8 +509,17 @@ YamlParserContext::EventPtr YamlParserContext::nextEvent()\n\nI wonder what else you have in your tree if the message prints line 627,\nas indicated in the example in the commit message :-)\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \tEventPtr event(new yaml_event_t);\n>  \n>  \t/* yaml_parser_parse returns 1 when it succeeds */\n> -\tif (!yaml_parser_parse(&parser_, event.get()))\n> +\tif (!yaml_parser_parse(&parser_, event.get())) {\n> +\t\tFile *file = static_cast<File *>(parser_.read_handler_data);\n> +\n> +\t\tLOG(YamlParser, Error) << file->fileName() << \":\"\n> +\t\t\t\t       << parser_.problem_mark.line << \":\"\n> +\t\t\t\t       << parser_.problem_mark.column << \" \"\n> +\t\t\t\t       << parser_.problem << \" \"\n> +\t\t\t\t       << parser_.context;\n> +\n>  \t\treturn nullptr;\n> +\t}\n>  \n>  \treturn event;\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 E8DA5BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Dec 2024 20:12:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F204566116;\n\tThu,  5 Dec 2024 21:12:56 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E95196608C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Dec 2024 21:12:55 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C6ECB7E2;\n\tThu,  5 Dec 2024 21:12:26 +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=\"nW9eyIXd\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733429547;\n\tbh=tLlWjscwRglu9kDWhVcgSMNDsFfofTk0gke0XAJishs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=nW9eyIXd05fNnWyOJwFrOVAHKETNVf4NF5DOF66z9RYeX8pQqnYlC5OBjUFHa3jvS\n\trHK5JTzZdxrXEExVx6dntLW6pNCuZNO8xWEunCItlr+kLiTfeLa1sVIK89sK6H9u4/\n\ty64Ucg6D4aS8zcD7lYkZHrcqdsv3Sy/jKPA8tCvY=","Date":"Thu, 5 Dec 2024 22:12:43 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH] libcamera: yaml_parser: Output more details when parsing\n\tfails","Message-ID":"<20241205201243.GG21014@pendragon.ideasonboard.com>","References":"<20241204111017.343760-1-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241204111017.343760-1-stefan.klug@ideasonboard.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>"}},{"id":32565,"web_url":"https://patchwork.libcamera.org/comment/32565/","msgid":"<jfngoo7ljw6avu7eqyo7eb7yozaz6mxge6c57mwsq6bbvt3qzt@4zhqez63fyrc>","date":"2024-12-06T07:04:44","subject":"Re: [PATCH] libcamera: yaml_parser: Output more details when parsing\n\tfails","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Laurent,\n\nThank you for the review. \n\nOn Thu, Dec 05, 2024 at 10:12:43PM +0200, Laurent Pinchart wrote:\n> Hi Stefan,\n> \n> Thank you for the patch.\n> \n> On Wed, Dec 04, 2024 at 12:10:13PM +0100, Stefan Klug wrote:\n> > On malformed yaml files, the yaml parser only errors out without giving\n> > details on the error that happened. Fix that by providing a more detailed\n> > error message.\n> > \n> > Output old:\n> > \n> > ERROR YamlParser yaml_parser.cpp:886 Failed to parse YAML content from /root/imx283.yaml\n> > \n> > Output new:\n> > \n> > ERROR YamlParser yaml_parser.cpp:627 /root/imx283.yaml:72:8 could not find expected ':' while scanning a simple key\n> > ERROR YamlParser yaml_parser.cpp:886 Failed to parse YAML content from /root/imx283.yaml\n> > \n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > ---\n> >  src/libcamera/yaml_parser.cpp | 11 ++++++++++-\n> >  1 file changed, 10 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\n> > index db256ec5b04d..f9302c4ee3fa 100644\n> > --- a/src/libcamera/yaml_parser.cpp\n> > +++ b/src/libcamera/yaml_parser.cpp\n> > @@ -509,8 +509,17 @@ YamlParserContext::EventPtr YamlParserContext::nextEvent()\n> \n> I wonder what else you have in your tree if the message prints line 627,\n> as indicated in the example in the commit message :-)\n\nInteresting indeed. I checked the logs. The patch was written just\nbefore you merged the \"Use std::from_chars()\" cleanup that removed quite\nsome code. I guess that explains the difference.\n\nRegards,\nStefan\n\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> >  \tEventPtr event(new yaml_event_t);\n> >  \n> >  \t/* yaml_parser_parse returns 1 when it succeeds */\n> > -\tif (!yaml_parser_parse(&parser_, event.get()))\n> > +\tif (!yaml_parser_parse(&parser_, event.get())) {\n> > +\t\tFile *file = static_cast<File *>(parser_.read_handler_data);\n> > +\n> > +\t\tLOG(YamlParser, Error) << file->fileName() << \":\"\n> > +\t\t\t\t       << parser_.problem_mark.line << \":\"\n> > +\t\t\t\t       << parser_.problem_mark.column << \" \"\n> > +\t\t\t\t       << parser_.problem << \" \"\n> > +\t\t\t\t       << parser_.context;\n> > +\n> >  \t\treturn nullptr;\n> > +\t}\n> >  \n> >  \treturn event;\n> >  }\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","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 3A7F4BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Dec 2024 07:04:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4A32166127;\n\tFri,  6 Dec 2024 08:04:49 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 55E90608B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Dec 2024 08:04:47 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:3543:aebe:e043:ef86])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E5140641;\n\tFri,  6 Dec 2024 08:04:17 +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=\"YnJmv4eJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733468658;\n\tbh=QtEZMe8LsE1KLKfoyi1DWxXdUyCIrNYamorfABJxpHU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YnJmv4eJ6wUULOjyYksk7VC5b832dl9BUl/P3bvfLRiv6L1dCbAkskQMVW7rRsGUz\n\t+Fk0ncBWWwXU5sOZE2Y8i/ho381drMRi9MI9WBWZJDvkcOODEMcBXPIVs5IsrI6NEc\n\tO4oaF8SFGZL+jrfCXASAuYGvpx3FIrh5iAis25Hk=","Date":"Fri, 6 Dec 2024 08:04:44 +0100","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH] libcamera: yaml_parser: Output more details when parsing\n\tfails","Message-ID":"<jfngoo7ljw6avu7eqyo7eb7yozaz6mxge6c57mwsq6bbvt3qzt@4zhqez63fyrc>","References":"<20241204111017.343760-1-stefan.klug@ideasonboard.com>\n\t<20241205201243.GG21014@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241205201243.GG21014@pendragon.ideasonboard.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>"}}]