Show a patch.

GET /api/1.1/patches/22150/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 22150,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/22150/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22150/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20241202133404.41431-5-jacopo.mondi@ideasonboard.com>",
    "date": "2024-12-02T13:34:03",
    "name": "[v2,4/4,DNI] libcamera: pipeline_handler: Break the Yaml Emitter",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "1378eca379c312c312658e22c55cef3705260151",
    "submitter": {
        "id": 143,
        "url": "https://patchwork.libcamera.org/api/1.1/people/143/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo.mondi@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/22150/mbox/",
    "series": [
        {
            "id": 4837,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4837/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4837",
            "date": "2024-12-02T13:33:59",
            "name": "libcamera: Add support for dumping capture script in YAML",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4837/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22150/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22150/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 37962C3295\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  2 Dec 2024 13:34:20 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DECB066080;\n\tMon,  2 Dec 2024 14:34:16 +0100 (CET)",
            "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 58B056605F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  2 Dec 2024 14:34:12 +0100 (CET)",
            "from ideasonboard.com (mob-5-90-236-68.net.vodafone.it\n\t[5.90.236.68])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 88ED5514;\n\tMon,  2 Dec 2024 14:33:45 +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=\"uZH4RpWY\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733146425;\n\tbh=ps1AvkkE4aqDTfJCOam9fPZFGvmUB027lVxleBkIzNs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=uZH4RpWYaQ4/ryNdpeQcpFM+CHSU9/napxKHn36IGo3+oafyhMmmaKaOcEKmUZH2q\n\tB692WrOgGSjxgjm9BOcWICblRlkwI7De/kiYUcyrUPIDx0w9i2kXUxlkuv6UOszzqv\n\tCr47H63jsy8uZknXgQr07xmd9wub/V8CJKOTcT+k=",
        "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Subject": "[PATCH v2 4/4] [DNI] libcamera: pipeline_handler: Break the Yaml\n\tEmitter",
        "Date": "Mon,  2 Dec 2024 14:34:03 +0100",
        "Message-ID": "<20241202133404.41431-5-jacopo.mondi@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.47.0",
        "In-Reply-To": "<20241202133404.41431-1-jacopo.mondi@ideasonboard.com>",
        "References": "<20241202133404.41431-1-jacopo.mondi@ideasonboard.com>",
        "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": "Break the pipeline handler with an invalid API usage sequence\nin pipeline_handler.cpp\n\nASSERT() for the presence of a valid parent_ reference in the YamlOutput\nclass hierarcy to trigger a visible error to users.\n\nFATAL default yaml_emitter.cpp:578 assertion \"parent_\" failed in dict()\nBacktrace: libcamera::YamlList::dict()+0xb4 (../src/libcamera/yaml_emitter.cpp:580)\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/libcamera/pipeline_handler.cpp |  1 +\n src/libcamera/yaml_emitter.cpp     | 42 +++++-------------------------\n 2 files changed, 7 insertions(+), 36 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex e1ff6e6a5ce9..963a98e15894 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -818,6 +818,7 @@ void PipelineHandler::dumpConfiguration(const std::set<const Stream *> &streams,\n \t/* \\todo Dump Sensor configuration */\n \n \tYamlList streamsList = configurationDict.list(\"streams\");\n+\tYamlList thatsanono = configurationDict.list(\"shouldntbehere\");\n \n \tfor (const auto &stream : streams) {\n \t\tconst StreamConfiguration &streamConfig = stream->configuration();\ndiff --git a/src/libcamera/yaml_emitter.cpp b/src/libcamera/yaml_emitter.cpp\nindex c0629e249c57..ed0367717e11 100644\n--- a/src/libcamera/yaml_emitter.cpp\n+++ b/src/libcamera/yaml_emitter.cpp\n@@ -561,12 +561,7 @@ YamlList::~YamlList()\n  */\n YamlList YamlList::list()\n {\n-\tif (!parent_) {\n-\t\tLOG(YamlEmitter, Error)\n-\t\t\t<< \"Invalid usage of the YamlEmitter API. \"\n-\t\t\t<< \" The YAML output might not be correct.\";\n-\t\treturn {};\n-\t}\n+\tASSERT(parent_);\n \n \tint ret = emitSequenceStart();\n \tif (ret)\n@@ -580,12 +575,7 @@ YamlList YamlList::list()\n  */\n YamlDict YamlList::dict()\n {\n-\tif (!parent_) {\n-\t\tLOG(YamlEmitter, Error)\n-\t\t\t<< \"Invalid usage of the YamlEmitter API. \"\n-\t\t\t<< \" The YAML output might not be correct.\";\n-\t\treturn {};\n-\t}\n+\tASSERT(parent_);\n \n \tint ret = emitMappingStart();\n \tif (ret)\n@@ -600,12 +590,7 @@ YamlDict YamlList::dict()\n  */\n void YamlList::scalar(std::string_view scalar)\n {\n-\tif (!parent_) {\n-\t\tLOG(YamlEmitter, Error)\n-\t\t\t<< \"Invalid usage of the YamlEmitter API. \"\n-\t\t\t<< \" The YAML output might not be correct.\";\n-\t\treturn;\n-\t}\n+\tASSERT(parent_);\n \n \temitScalar(scalar);\n }\n@@ -652,12 +637,7 @@ YamlDict::~YamlDict()\n  */\n YamlList YamlDict::list(std::string_view key)\n {\n-\tif (!parent_) {\n-\t\tLOG(YamlEmitter, Error)\n-\t\t\t<< \"Invalid usage of the YamlEmitter API. \"\n-\t\t\t<< \" The YAML output might not be correct.\";\n-\t\treturn {};\n-\t}\n+\tASSERT(parent_);\n \n \tint ret = emitScalar(key);\n \tif (ret)\n@@ -677,12 +657,7 @@ YamlList YamlDict::list(std::string_view key)\n  */\n YamlDict YamlDict::dict(std::string_view key)\n {\n-\tif (!parent_) {\n-\t\tLOG(YamlEmitter, Error)\n-\t\t\t<< \"Invalid usage of the YamlEmitter API. \"\n-\t\t\t<< \" The YAML output might not be correct.\";\n-\t\treturn {};\n-\t}\n+\tASSERT(parent_);\n \n \tint ret = emitScalar(key);\n \tif (ret)\n@@ -702,12 +677,7 @@ YamlDict YamlDict::dict(std::string_view key)\n  */\n void YamlDict::scalar(std::string_view key, std::string_view scalar)\n {\n-\tif (!parent_) {\n-\t\tLOG(YamlEmitter, Error)\n-\t\t\t<< \"Invalid usage of the YamlEmitter API. \"\n-\t\t\t<< \" The YAML output might not be correct.\";\n-\t\treturn;\n-\t}\n+\tASSERT(parent_);\n \n \tint ret = emitScalar(key);\n \tif (ret)\n",
    "prefixes": [
        "v2",
        "4/4",
        "DNI"
    ]
}