get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1524348,
    "url": "http://patchwork.ozlabs.org/api/patches/1524348/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/20210903142802.588425-1-aconole@redhat.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/projects/47/?format=api",
        "name": "Open vSwitch",
        "link_name": "openvswitch",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "git@github.com:openvswitch/ovs.git",
        "webscm_url": "https://github.com/openvswitch/ovs",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20210903142802.588425-1-aconole@redhat.com>",
    "list_archive_url": null,
    "date": "2021-09-03T14:28:02",
    "name": "[ovs-dev] checkpatch: avoid catastrophic backtracking",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "85d0abf76d8f4c63c5891844637a11014252482a",
    "submitter": {
        "id": 67184,
        "url": "http://patchwork.ozlabs.org/api/people/67184/?format=api",
        "name": "Aaron Conole",
        "email": "aconole@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/20210903142802.588425-1-aconole@redhat.com/mbox/",
    "series": [
        {
            "id": 260911,
            "url": "http://patchwork.ozlabs.org/api/series/260911/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=260911",
            "date": "2021-09-03T14:28:02",
            "name": "[ovs-dev] checkpatch: avoid catastrophic backtracking",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/260911/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1524348/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/1524348/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Dsg5ojHs;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=140.211.166.137; helo=smtp4.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)",
            "smtp1.osuosl.org (amavisd-new);\n dkim=pass (1024-bit key) header.d=redhat.com",
            "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=aconole@redhat.com"
        ],
        "Received": [
            "from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4H1KsD0GLWz9sPf\n\tfor <incoming@patchwork.ozlabs.org>; Sat,  4 Sep 2021 00:28:15 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id C75D7426AC;\n\tFri,  3 Sep 2021 14:28:13 +0000 (UTC)",
            "from smtp4.osuosl.org ([127.0.0.1])\n\tby localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id cUVBsIsc7IpC; Fri,  3 Sep 2021 14:28:12 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp4.osuosl.org (Postfix) with ESMTPS id ED5A1426A6;\n\tFri,  3 Sep 2021 14:28:11 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id BF0EEC0010;\n\tFri,  3 Sep 2021 14:28:11 +0000 (UTC)",
            "from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 3D13EC000E\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 14:28:11 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id 2C5DD83EB3\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 14:28:11 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id nlkWO7-vllZO for <dev@openvswitch.org>;\n Fri,  3 Sep 2021 14:28:10 +0000 (UTC)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [216.205.24.124])\n by smtp1.osuosl.org (Postfix) with ESMTPS id 77EE783EDC\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 14:28:09 +0000 (UTC)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-427-5kjSAoXLMA2Zb4bsWG87rw-1; Fri, 03 Sep 2021 10:28:05 -0400",
            "from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com\n [10.5.11.12])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 30B6910054F6;\n Fri,  3 Sep 2021 14:28:04 +0000 (UTC)",
            "from RHTPC1VM0NT.redhat.com (unknown [10.22.32.59])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 0995E60BF1;\n Fri,  3 Sep 2021 14:28:02 +0000 (UTC)"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.8.0",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1630679288;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=Y8CLfnsIHAKrCSJy8VSkd4mBrpIiV7agrzhPZamqvcw=;\n b=Dsg5ojHsQcDSfNuEeHEQS/EQ4g37lj0BgXACMhFXoxAvYqqPJ1ZUEsya7O6bECQKbojRD+\n Klc2pba4nmZc/r+L3cVFhFOw2mOEM8TX/blvDMgUlR5C/1B6Dmhq6bhVCTkra1NoFulGdN\n E8qtL7l5On3kN5vi3uhB3CiTYvfRxHo=",
        "X-MC-Unique": "5kjSAoXLMA2Zb4bsWG87rw-1",
        "From": "Aaron Conole <aconole@redhat.com>",
        "To": "dev@openvswitch.org",
        "Date": "Fri,  3 Sep 2021 10:28:02 -0400",
        "Message-Id": "<20210903142802.588425-1-aconole@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Cc": "Ilya Maximets <i.maximets@ovn.org>",
        "Subject": "[ovs-dev] [PATCH] checkpatch: avoid catastrophic backtracking",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ovs-dev-bounces@openvswitch.org",
        "Sender": "\"dev\" <ovs-dev-bounces@openvswitch.org>"
    },
    "content": "As Frode Nordahl points out in [0], it is possible for the\npython regex module to enter a case of catastrophic backtracking\nwhich causes oscillation between states and hangs the checkpatch\nscript.\n\nOne suggested solution to these cases is to use an anchor[1] in\nthe regex, which should force the backtrack to exit early.\nHowever, when I tested this, it didn't seem to improve anything\n(since the start is already anchored, and trying to anchor the\nend results in the same hang).\n\nInstead, we explicitly check that the line ends with '\\\\' before\ntrying to match on the 'if-inside-a-macro' check.  A new check\nis added to catch the case in checkpatch.\n\nSigned-off-by: Aaron Conole <aconole@redhat.com>\n\n0: https://mail.openvswitch.org/pipermail/ovs-dev/2021-August/386881.html\n1: https://stackoverflow.com/questions/22072406/preventing-any-backtracking-in-regex-past-a-specific-pattern\n---\nNOTE: [0] above is accepted in OVN upstream and may require a slightly\n      modified fix.\n\n tests/checkpatch.at     | 16 ++++++++++++++++\n utilities/checkpatch.py | 10 +++++++---\n 2 files changed, 23 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/tests/checkpatch.at b/tests/checkpatch.at\nindex 0718acd995..f382149163 100755\n--- a/tests/checkpatch.at\n+++ b/tests/checkpatch.at\n@@ -232,6 +232,22 @@ done\n AT_CLEANUP\n \n \n+AT_SETUP([checkpatch - catastrophic backtracking])\n+dnl Special case this rather than using the above construct because sometimes a\n+dnl warning needs to be generated for line lengths (f.e. when the 'while'\n+dnl keyword is used).\n+try_checkpatch \\\n+   \"COMMON_PATCH_HEADER\n+    +     if (!b_ctx_in->chassis_rec || !b_ctx_in->br_int || !b_ctx_in->ovs_idl_txn)\n+    \" \\\n+    \"ERROR: Inappropriate bracing around statement\n+    #8 FILE: A.c:1:\n+         if (!b_ctx_in->chassis_rec || !b_ctx_in->br_int || !b_ctx_in->ovs_idl_txn)\n+\"\n+\n+AT_CLEANUP\n+\n+\n AT_SETUP([checkpatch - parenthesized constructs - for])\n try_checkpatch \\\n    \"COMMON_PATCH_HEADER\ndiff --git a/utilities/checkpatch.py b/utilities/checkpatch.py\nindex 699fb4b027..16f46c78e8 100755\n--- a/utilities/checkpatch.py\n+++ b/utilities/checkpatch.py\n@@ -274,9 +274,13 @@ def if_and_for_end_with_bracket_check(line):\n         if not balanced_parens(line):\n             return True\n \n-        if __regex_ends_with_bracket.search(line) is None and \\\n-           __regex_if_macros.match(line) is None:\n-            return False\n+        if __regex_ends_with_bracket.search(line) is None:\n+            if line.endswith(\"\\\\\") and \\\n+               __regex_if_macros.match(line) is not None:\n+                return True\n+            else:\n+                return False\n+\n     if __regex_conditional_else_bracing.match(line) is not None:\n         return False\n     if __regex_conditional_else_bracing2.match(line) is not None:\n",
    "prefixes": [
        "ovs-dev"
    ]
}