Show a patch.

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

{
    "id": 1388,
    "url": "https://patchwork.libcamera.org/api/patches/1388/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1388/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20190610210023.4185-1-niklas.soderlund@ragnatech.se>",
    "date": "2019-06-10T21:00:23",
    "name": "[libcamera-devel,v2] libcamera: ipa_manager: Fix handling of unset LIBCAMERA_IPA_MODULE_PATH",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "4e0694e4a0c05d0abd76611acc36a55afe586c2d",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1388/mbox/",
    "series": [
        {
            "id": 345,
            "url": "https://patchwork.libcamera.org/api/series/345/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=345",
            "date": "2019-06-10T21:00:23",
            "name": "[libcamera-devel,v2] libcamera: ipa_manager: Fix handling of unset LIBCAMERA_IPA_MODULE_PATH",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/345/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1388/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1388/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BA12B61918\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Jun 2019 23:00:30 +0200 (CEST)",
            "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid c47df497-8bc2-11e9-8d05-005056917f90;\n\tMon, 10 Jun 2019 23:00:29 +0200 (CEST)"
        ],
        "X-Halon-ID": "c47df497-8bc2-11e9-8d05-005056917f90",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 10 Jun 2019 23:00:23 +0200",
        "Message-Id": "<20190610210023.4185-1-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.21.0",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2] libcamera: ipa_manager: Fix handling\n\tof unset LIBCAMERA_IPA_MODULE_PATH",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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>",
        "X-List-Received-Date": "Mon, 10 Jun 2019 21:00:31 -0000"
    },
    "content": "If the environment variable LIBCAMERA_IPA_MODULE_PATH is not set\nutils::secure_getenv() will return a nullptr. Assigning a nullptr to a\nstd::string is not valid and results in a crash,\n\n    terminate called after throwing an instance of 'std::logic_error'\n      what():  basic_string::_M_construct null not valid\n\nFix this by operating directly on the returned char array instead of\nturning it into a std::string.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/ipa_manager.cpp | 23 +++++++++++++----------\n 1 file changed, 13 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\nindex f689aa69b7284092..b9b772d1d5e7795f 100644\n--- a/src/libcamera/ipa_manager.cpp\n+++ b/src/libcamera/ipa_manager.cpp\n@@ -34,19 +34,22 @@ IPAManager::IPAManager()\n {\n \taddDir(IPA_MODULE_DIR);\n \n-\tstd::string modulePaths = utils::secure_getenv(\"LIBCAMERA_IPA_MODULE_PATH\");\n-\tif (modulePaths.empty())\n+\tconst char *modulePaths = utils::secure_getenv(\"LIBCAMERA_IPA_MODULE_PATH\");\n+\tif (!modulePaths)\n \t\treturn;\n \n-\tfor (size_t pos = 0, delim = 0; delim != std::string::npos;\n-\t     pos = delim + 1) {\n-\t\tdelim = modulePaths.find(':', pos);\n-\t\tsize_t count = delim == std::string::npos ? delim : delim - pos;\n-\t\tstd::string path = modulePaths.substr(pos, count);\n-\t\tif (path.empty())\n-\t\t\tcontinue;\n+\twhile (1) {\n+\t\tconst char *delim = strchrnul(modulePaths, ':');\n+\t\tsize_t count = delim - modulePaths;\n \n-\t\taddDir(path.c_str());\n+\t\tstd::string path(modulePaths, count);\n+\t\tif (!path.empty())\n+\t\t\taddDir(path.c_str());\n+\n+\t\tif (*delim == '\\0')\n+\t\t\tbreak;\n+\n+\t\tmodulePaths += count + 1;\n \t}\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}