Show a patch.

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

{
    "id": 19717,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19717/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19717/",
    "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": "<20240314105736.109201-1-stefan.klug@ideasonboard.com>",
    "date": "2024-03-14T10:57:36",
    "name": "checkstyle: Work around bug in difflib",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "dd9c7053c265a0af2bc2d82e9bd0016e96f0fa4e",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19717/mbox/",
    "series": [
        {
            "id": 4224,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4224/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4224",
            "date": "2024-03-14T10:57:36",
            "name": "checkstyle: Work around bug in difflib",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4224/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19717/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19717/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 41A39BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 14 Mar 2024 10:57:53 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3218E62C99;\n\tThu, 14 Mar 2024 11:57:52 +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 1DB7762C95\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 14 Mar 2024 11:57:50 +0100 (CET)",
            "from jasper.fritz.box (unknown\n\t[IPv6:2a00:6020:448c:6c00:c467:7cd1:67a9:bc4c])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BC4D36BE;\n\tThu, 14 Mar 2024 11:57: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=\"o2v7Oq8y\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710413846;\n\tbh=IgueFOjiLOtES9cdFLoEPfpm1f/crVXbPNTt6gawpU4=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=o2v7Oq8ylbS3VoOSzb3qk9lc9smC4zu9C9JT2q2oQeKOaNsDfIdVwyLYc12oFIPEI\n\twPs5wIJeXL3UoYUbHMADh50HKn0s63ZYpUjbYezIF1+vQXdo7vae282+yRT/g8Hmee\n\t4DAlgMJK7rUuRHk8JRu9L8m+Yo6YrLmvC65BWfW4=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH] checkstyle: Work around bug in difflib",
        "Date": "Thu, 14 Mar 2024 11:57:36 +0100",
        "Message-Id": "<20240314105736.109201-1-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.40.1",
        "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>",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "If a file misses the newline at the end it gets detected by checkstyle,\nbut the resulting patch is incorrect and does not apply. It took me a\nwhile to understand that it wasn't me using checkstyle incorrectly, but\nthat the patch was faulty. The bug itself is in difflib and dates back to\n2008.\n\nTo reproduce:\n- Remove trailing newline from a file\n- git add the file\n- run ./utils/checkstyle.py -s | patch -p0\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n utils/checkstyle.py | 6 ++++++\n 1 file changed, 6 insertions(+)",
    "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex db5a550d..20a5a592 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -168,6 +168,12 @@ def parse_diff(diff):\n             hunk = DiffHunk(line)\n \n         elif hunk is not None:\n+            # Work around https://github.com/python/cpython/issues/46395\n+            # See https://www.gnu.org/software/diffutils/manual/html_node/Incomplete-Lines.html\n+            if line[-1] != '\\n':\n+                hunk.append(line + '\\n')\n+                line = \"\\\\ No newline at end of file\\n\"\n+\n             hunk.append(line)\n \n     if hunk:\n",
    "prefixes": []
}