get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2196434,
    "url": "http://patchwork.ozlabs.org/api/patches/2196434/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260213222147.954022-1-dmalcolm@redhat.com/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api",
        "name": "GNU Compiler Collection",
        "link_name": "gcc",
        "list_id": "gcc-patches.gcc.gnu.org",
        "list_email": "gcc-patches@gcc.gnu.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260213222147.954022-1-dmalcolm@redhat.com>",
    "list_archive_url": null,
    "date": "2026-02-13T22:21:47",
    "name": "[pushed:,r16-7507] sarif-replay: fix escaping of JSON Pointer",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a3cdf790e09b010b8cbd952493dba94d70ddc4d7",
    "submitter": {
        "id": 24465,
        "url": "http://patchwork.ozlabs.org/api/people/24465/?format=api",
        "name": "David Malcolm",
        "email": "dmalcolm@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260213222147.954022-1-dmalcolm@redhat.com/mbox/",
    "series": [
        {
            "id": 492142,
            "url": "http://patchwork.ozlabs.org/api/series/492142/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=492142",
            "date": "2026-02-13T22:21:47",
            "name": "[pushed:,r16-7507] sarif-replay: fix escaping of JSON Pointer",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/492142/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2196434/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2196434/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=WPV7OjKx;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)",
            "sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=WPV7OjKx",
            "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com",
            "sourceware.org; spf=pass smtp.mailfrom=redhat.com",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124"
        ],
        "Received": [
            "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fCRVm25vcz1xvS\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 14 Feb 2026 09:22:24 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 4B9A14B9DB66\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 13 Feb 2026 22:22:22 +0000 (GMT)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id 3C39F4BA23C7\n for <gcc-patches@gcc.gnu.org>; Fri, 13 Feb 2026 22:21:53 +0000 (GMT)",
            "from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-678-EyQht6vEM9CtJ5_RNRfnoQ-1; Fri,\n 13 Feb 2026 17:21:51 -0500",
            "from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 78663195605B\n for <gcc-patches@gcc.gnu.org>; Fri, 13 Feb 2026 22:21:50 +0000 (UTC)",
            "from t14s.localdomain.com (unknown [10.22.80.18])\n by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id BCB1330001B9; Fri, 13 Feb 2026 22:21:49 +0000 (UTC)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 4B9A14B9DB66",
            "OpenDKIM Filter v2.11.0 sourceware.org 3C39F4BA23C7"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 3C39F4BA23C7",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 3C39F4BA23C7",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771021313; cv=none;\n b=sFF6H4GBuW05AQ0Kujvwgkuejpo68OpvpcQfbswujB8viDJQFY5z+WBPkB8T5jcC0qjE+2kuXIgE1tHRJcFdhRXmS6GUbaqKEjkxUGiEGRqi1kpvL+eedEEbvRZmVYl13Y+u7oImGXs/nyLlhI7AznMhS2cw3Def5gbpW3b0QyI=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1771021313; c=relaxed/simple;\n bh=CjgEoBmUPIRDLTKmLk9CweNvaPMf8ntVDUGP0gKOjCQ=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=ul397Uk4mVwvJWPZVPgb2Cl3itAGzPje+K0BQfu7yBIgZ+CKz1GqGJkYCxnNVpyZ9D0SE5NCp7D81Mli5SOSJ4cuo7Im9hZluG1VU06Ca9A/tiS8enJxsoSw1gd41/hwpPOPaY3+0g7yDGUWQPYcQvueiBn2TgNVFaBl6qBU9hc=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1771021312;\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=V/ZEI4lHXMGG8xCWyUEns8PyspuHNZACW+YpUmAfCsk=;\n b=WPV7OjKxffgnisMVqJ5+BBvmgLd0nf+3lT1A9E52t4BQGhnyoHfGeZ1FnBhKvFCz0W7uZU\n axl41tHsEMbcab4YFq3Vq6uUf0PbY1JhjkqKbz3SzBmWmViebF2c1CjIwSZtfacoMf7krQ\n Nru63fnC1+VnKya8qMIbZcxKH32QvdQ=",
        "X-MC-Unique": "EyQht6vEM9CtJ5_RNRfnoQ-1",
        "X-Mimecast-MFC-AGG-ID": "EyQht6vEM9CtJ5_RNRfnoQ_1771021310",
        "From": "David Malcolm <dmalcolm@redhat.com>",
        "To": "gcc-patches@gcc.gnu.org",
        "Cc": "David Malcolm <dmalcolm@redhat.com>",
        "Subject": "[pushed: r16-7507] sarif-replay: fix escaping of JSON Pointer",
        "Date": "Fri, 13 Feb 2026 17:21:47 -0500",
        "Message-ID": "<20260213222147.954022-1-dmalcolm@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.4",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "4jtU0EHhe-AOj5Suece6O_VM2niZT5yr6Ii3y1Fc3pc_1771021310",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "X-BeenThere": "gcc-patches@gcc.gnu.org",
        "X-Mailman-Version": "2.1.30",
        "Precedence": "list",
        "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>",
        "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>",
        "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>",
        "List-Post": "<mailto:gcc-patches@gcc.gnu.org>",
        "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>",
        "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.\nPushed to trunk as r16-7507-g7c73f9a347e8c5.\n\ngcc/ChangeLog:\n\t* json-parsing.cc (selftest::assert_json_pointer_eq): New.\n\t(ASSERT_JSON_POINTER_EQ): New.\n\t(selftest::test_parse_object): Add tests of JSON pointer.\n\t(selftest::test_pointer_escaping): New test.\n\t(selftest::json_parser_cc_tests): Call it.\n\t* json.cc (json::pointer::token::print): New.\n\t(json::value::print_pointer): New.\n\t* json.h (json::pointer::token::print): New decl.\n\t(json::value::print_pointer): New decl.\n\t* libsarifreplay.cc: Include pretty-print.h.\n\t(make_logical_location_from_jv): Use\n\tjson::pointer::token::print for short_name.\n\nSigned-off-by: David Malcolm <dmalcolm@redhat.com>\n---\n gcc/json-parsing.cc   | 47 ++++++++++++++++++++++++++++++++++\n gcc/json.cc           | 59 +++++++++++++++++++++++++++++++++++++++++++\n gcc/json.h            |  3 +++\n gcc/libsarifreplay.cc |  8 +++---\n 4 files changed, 113 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/gcc/json-parsing.cc b/gcc/json-parsing.cc\nindex b0a5d841f3558..b3711e50f11f5 100644\n--- a/gcc/json-parsing.cc\n+++ b/gcc/json-parsing.cc\n@@ -1495,6 +1495,25 @@ assert_err_eq (const location &loc,\n \t\t (END_UNICHAR_IDX), (END_LINE), (END_COLUMN),\t\\\n \t\t (EXPECTED_MSG))\n \n+/* Implementation detail of ASSERT_JSON_POINTER_EQ.  */\n+\n+static void\n+assert_json_pointer_eq (const location &loc,\n+\t\t\tconst json::value *jv,\n+\t\t\tconst char *expected_str)\n+{\n+  pretty_printer pp;\n+  ASSERT_TRUE_AT (loc, jv);\n+  jv->print_pointer (&pp);\n+  ASSERT_STREQ_AT (loc, pp_formatted_text (&pp), expected_str);\n+}\n+\n+/* Assert that JV is a non-NULL json::value *, and that\n+   jv->print_pointer prints EXPECTED_STR.  */\n+\n+#define ASSERT_JSON_POINTER_EQ(JV, EXPECTED_STR) \\\n+  assert_json_pointer_eq ((SELFTEST_LOCATION), (JV), (EXPECTED_STR))\n+\n /* Verify that the JSON lexer works as expected.  */\n \n static void\n@@ -2130,6 +2149,7 @@ test_parse_object ()\n \t\t   0, line_1, 0,\n \t\t   32, line_1, 32);\n   const json::object *jo = static_cast <const json::object *> (jv);\n+  ASSERT_JSON_POINTER_EQ (jv, \"\");\n \n   json::value *foo_value = jo->get (\"foo\");\n   ASSERT_NE (foo_value, nullptr);\n@@ -2140,6 +2160,7 @@ test_parse_object ()\n   ASSERT_RANGE_EQ (*range,\n \t\t   8, line_1, 8,\n \t\t   12, line_1, 12);\n+  ASSERT_JSON_POINTER_EQ (foo_value, \"/foo\");\n \n   json::value *baz_value = jo->get (\"baz\");\n   ASSERT_NE (baz_value, nullptr);\n@@ -2149,6 +2170,7 @@ test_parse_object ()\n   ASSERT_RANGE_EQ (*range,\n \t\t   22, line_1, 22,\n \t\t   31, line_1, 31);\n+  ASSERT_JSON_POINTER_EQ (baz_value, \"/baz\");\n \n   json::array *baz_array = as_a <json::array *> (baz_value);\n   ASSERT_EQ (baz_array->length (), 2);\n@@ -2160,6 +2182,7 @@ test_parse_object ()\n   ASSERT_RANGE_EQ (*range,\n \t\t   23, line_1, 23,\n \t\t   24, line_1, 24);\n+  ASSERT_JSON_POINTER_EQ (element0, \"/baz/0\");\n \n   json::value *element1 = baz_array->get (1);\n   ASSERT_EQ (element1->get_kind (), JSON_NULL);\n@@ -2168,6 +2191,7 @@ test_parse_object ()\n   ASSERT_RANGE_EQ (*range,\n \t\t   27, line_1, 27,\n \t\t   30, line_1, 30);\n+  ASSERT_JSON_POINTER_EQ (element1, \"/baz/1\");\n }\n \n /* Verify that the JSON literals \"true\", \"false\" and \"null\" are parsed\n@@ -2297,6 +2321,28 @@ test_parsing_comments ()\n   }\n }\n \n+/* Verify that JSON Pointers are correctly escaped.  */\n+\n+static void\n+test_pointer_escaping ()\n+{\n+  std::unique_ptr<error> err;\n+  /* Example adapted from RFC 6901 section 5.  */\n+  parser_testcase tc\n+    (\"     {\\n\"\n+     \"      \\\"a/b\\\": 1,\\n\"\n+     \"      \\\"m~n\\\": 8\\n\"\n+     \"   }\\n\");\n+  ASSERT_EQ (tc.get_error (), nullptr);\n+  const json::value *jv = tc.get_value ();\n+  ASSERT_NE (jv, nullptr);\n+  ASSERT_EQ (jv->get_kind (), JSON_OBJECT);\n+\n+  auto jo = static_cast <const json::object *> (jv);\n+  ASSERT_JSON_POINTER_EQ (jo->get (\"a/b\"), \"/a~1b\");\n+  ASSERT_JSON_POINTER_EQ (jo->get (\"m~n\"), \"/m~0n\");\n+}\n+\n /* Verify that we can parse an empty JSON string.  */\n \n static void\n@@ -2378,6 +2424,7 @@ json_parser_cc_tests ()\n   test_parse_jsonrpc ();\n   test_parse_empty_object ();\n   test_parsing_comments ();\n+  test_pointer_escaping ();\n   test_error_empty_string ();\n   test_error_bad_token ();\n   test_error_object_with_missing_comma ();\ndiff --git a/gcc/json.cc b/gcc/json.cc\nindex 3f1b0d9e02116..3f87e2910093c 100644\n--- a/gcc/json.cc\n+++ b/gcc/json.cc\n@@ -120,6 +120,42 @@ pointer::token::operator= (pointer::token &&other)\n   return *this;\n }\n \n+/* Print this to PP as an RFC 6901 section 3 reference-token.  */\n+\n+void\n+pointer::token::print (pretty_printer *pp) const\n+{\n+  switch (m_kind)\n+    {\n+    case kind::root_value:\n+      break;\n+\n+    case kind::object_member:\n+      {\n+\tfor (const char *ch = m_data.u_member; *ch; ++ch)\n+\t  {\n+\t    switch (*ch)\n+\t      {\n+\t      case '~':\n+\t\tpp_string (pp, \"~0\");\n+\t\tbreak;\n+\t      case '/':\n+\t\tpp_string (pp, \"~1\");\n+\t\tbreak;\n+\t      default:\n+\t\tpp_character (pp, *ch);\n+\t\tbreak;\n+\t      }\n+\t  }\n+      }\n+      break;\n+\n+    case kind::array_index:\n+      pp_scalar (pp, HOST_SIZE_T_PRINT_UNSIGNED, m_data.u_index);\n+      break;\n+    }\n+}\n+\n /* class json::value.  */\n \n /* Dump this json::value tree to OUTF.\n@@ -234,6 +270,29 @@ value::compare (const value &val_a, const value &val_b)\n     }\n }\n \n+/* Print this value's JSON Pointer to PP.  */\n+\n+void\n+value::print_pointer (pretty_printer *pp) const\n+{\n+  /* Get path from this value to root.  */\n+  auto_vec<const pointer::token *> ancestry;\n+  for (auto *iter = this; iter; iter = iter->m_pointer_token.m_parent)\n+    ancestry.safe_push (&iter->m_pointer_token);\n+\n+  /* Walk backward, going from root to this value.  */\n+  ancestry.reverse ();\n+  bool first = true;\n+  for (auto iter : ancestry)\n+    {\n+      if (first)\n+\tfirst = false;\n+      else\n+\tpp_character (pp, '/');\n+      iter->print (pp);\n+    }\n+}\n+\n /* class json::object, a subclass of json::value, representing\n    an ordered collection of key/value pairs.  */\n \ndiff --git a/gcc/json.h b/gcc/json.h\nindex fabe2fe0886a6..2ea1d13d17918 100644\n--- a/gcc/json.h\n+++ b/gcc/json.h\n@@ -107,6 +107,8 @@ struct token\n   token &\n   operator= (token &&other);\n \n+  void print (pretty_printer *pp) const;\n+\n   json::value *m_parent;\n   union u\n   {\n@@ -174,6 +176,7 @@ class value\n   static int compare (const json::value &val_a, const json::value &val_b);\n \n   const pointer::token &get_pointer_token () const { return m_pointer_token; }\n+  void print_pointer (pretty_printer *pp) const;\n \n   pointer::token m_pointer_token;\n };\ndiff --git a/gcc/libsarifreplay.cc b/gcc/libsarifreplay.cc\nindex 20a0aec3c7fcb..966e181fa0c58 100644\n--- a/gcc/libsarifreplay.cc\n+++ b/gcc/libsarifreplay.cc\n@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see\n #include \"sarif-spec-urls.def\"\n #include \"libsarifreplay.h\"\n #include \"label-text.h\"\n+#include \"pretty-print.h\"\n \n namespace {\n \n@@ -145,7 +146,9 @@ make_logical_location_from_jv (libgdiagnostics::manager &mgr,\n     parent = make_logical_location_from_jv (mgr,\n \t\t\t\t\t    *jv.m_pointer_token.m_parent);\n \n-  std::string short_name;\n+  pretty_printer pp;\n+  pointer_token.print (&pp);\n+  std::string short_name = pp_formatted_text (&pp);\n   std::string fully_qualified_name;\n   switch (pointer_token.m_kind)\n     {\n@@ -153,19 +156,16 @@ make_logical_location_from_jv (libgdiagnostics::manager &mgr,\n       gcc_unreachable ();\n \n     case json::pointer::token::kind::root_value:\n-      short_name = \"\";\n       fully_qualified_name = \"\";\n       break;\n \n     case json::pointer::token::kind::object_member:\n-      short_name = pointer_token.m_data.u_member;\n       gcc_assert (parent.m_inner);\n       fully_qualified_name\n \t= std::string (parent.get_fully_qualified_name ()) + \"/\" + short_name;\n       break;\n \n     case json::pointer::token::kind::array_index:\n-      short_name = std::to_string (pointer_token.m_data.u_index);\n       gcc_assert (parent.m_inner);\n       fully_qualified_name\n \t= std::string (parent.get_fully_qualified_name ()) + \"/\" + short_name;\n",
    "prefixes": [
        "pushed:",
        "r16-7507"
    ]
}