Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/116133/?format=api
http://patches.dpdk.org/api/patches/116133/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220909093523.471727-8-bruce.richardson@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20220909093523.471727-8-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20220909093523.471727-8-bruce.richardson@intel.com", "date": "2022-09-09T09:35:17", "name": "[v3,07/13] telemetry: add escaping of strings in dicts", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "135641c06267cfc24e3a3753229c70b7367c3c82", "submitter": { "id": 20, "url": "http://patches.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@intel.com" }, "delegate": { "id": 24651, "url": "http://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220909093523.471727-8-bruce.richardson@intel.com/mbox/", "series": [ { "id": 24617, "url": "http://patches.dpdk.org/api/series/24617/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=24617", "date": "2022-09-09T09:35:13", "name": "telemetry JSON escaping and other enhancements", "version": 3, "mbox": "http://patches.dpdk.org/series/24617/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/116133/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/116133/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B839FA0540;\n\tFri, 9 Sep 2022 11:36:22 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 16F0F42B79;\n\tFri, 9 Sep 2022 11:35:53 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n by mails.dpdk.org (Postfix) with ESMTP id 5924742829\n for <dev@dpdk.org>; Fri, 9 Sep 2022 11:35:50 +0200 (CEST)", "from orsmga004.jf.intel.com ([10.7.209.38])\n by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 09 Sep 2022 02:35:48 -0700", "from silpixa00401385.ir.intel.com ([10.237.214.161])\n by orsmga004.jf.intel.com with ESMTP; 09 Sep 2022 02:35:46 -0700" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1662716150; x=1694252150;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=j54IeXZePIv63X4WGZqjquKQa6jTxa9vk57lowo70H0=;\n b=eaG2QyJhqCk8aAk/Pjif+8dv6PNPzO6PfvVjKCOvadCW5qRqbdJl74Yh\n /24YQiEHyTK2UzOIqoz91ZMhcVmJew7w98mNMfFmTg6vJQ3s8ErC6CmZI\n G4IDjnfRB6WC+JNniPPIcTNX8sZ4mNrKpVKwHDHQkaHA0TjF88wO3f+L5\n spg/+JBpcIZfz6Ocfi1XPSAQJU9rYZc58SwxxRBSrYD6s5A6lk3Kcw+vM\n NHjZWj5OSH7IAfr8ABl68tOcW6qpU/MWcFxOgEFA2FCk1FdReRMr49gc5\n 8x3Qry2WEmTWFn0QjvHpi9TF/7n+AQZy8UeH+3xBSlvwskmzhr9BkDGGJ g==;", "X-IronPort-AV": [ "E=McAfee;i=\"6500,9779,10464\"; a=\"297437131\"", "E=Sophos;i=\"5.93,302,1654585200\"; d=\"scan'208\";a=\"297437131\"", "E=Sophos;i=\"5.93,302,1654585200\"; d=\"scan'208\";a=\"740996388\"" ], "X-ExtLoop1": "1", "From": "Bruce Richardson <bruce.richardson@intel.com>", "To": "dev@dpdk.org", "Cc": "Bruce Richardson <bruce.richardson@intel.com>,\n Ciara Power <ciara.power@intel.com>,\n =?utf-8?q?Morten_Br=C3=B8rup?= <mb@smartsharesystems.com>", "Subject": "[PATCH v3 07/13] telemetry: add escaping of strings in dicts", "Date": "Fri, 9 Sep 2022 10:35:17 +0100", "Message-Id": "<20220909093523.471727-8-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220909093523.471727-1-bruce.richardson@intel.com>", "References": "<20220623164245.561371-1-bruce.richardson@intel.com>\n <20220909093523.471727-1-bruce.richardson@intel.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "When strings are added to an dict variable, we need to properly escape\nthe invalid json characters in the strings.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\nAcked-by: Ciara Power <ciara.power@intel.com>\nAcked-by: Morten Brørup <mb@smartsharesystems.com>\n---\n lib/telemetry/telemetry_json.h | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)", "diff": "diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h\nindex c4442a0bf0..e3fae7c30d 100644\n--- a/lib/telemetry/telemetry_json.h\n+++ b/lib/telemetry/telemetry_json.h\n@@ -54,7 +54,7 @@ static const char control_chars[0x20] = {\n * @internal\n * This function acts the same as __json_snprintf(buf, len, \"%s%s%s\", prefix, str, suffix)\n * except that it does proper escaping of \"str\" as necessary. Prefix and suffix should be compile-\n- * time constants not needing escaping.\n+ * time constants, or values not needing escaping.\n * Drops any invalid characters we don't support\n */\n static inline int\n@@ -219,12 +219,16 @@ static inline int\n rte_tel_json_add_obj_str(char *buf, const int len, const int used,\n \t\tconst char *name, const char *val)\n {\n+\tchar tmp_name[RTE_TEL_MAX_STRING_LEN + 5];\n \tint ret, end = used - 1;\n+\n+\t/* names are limited to certain characters so need no escaping */\n+\tsnprintf(tmp_name, sizeof(tmp_name), \"{\\\"%s\\\":\\\"\", name);\n \tif (used <= 2) /* assume empty, since minimum is '{}' */\n-\t\treturn __json_snprintf(buf, len, \"{\\\"%s\\\":\\\"%s\\\"}\", name, val);\n+\t\treturn __json_format_str(buf, len, tmp_name, val, \"\\\"}\");\n \n-\tret = __json_snprintf(buf + end, len - end, \",\\\"%s\\\":\\\"%s\\\"}\",\n-\t\t\tname, val);\n+\ttmp_name[0] = ','; /* replace '{' with ',' at start */\n+\tret = __json_format_str(buf + end, len - end, tmp_name, val, \"\\\"}\");\n \treturn ret == 0 ? used : end + ret;\n }\n \n", "prefixes": [ "v3", "07/13" ] }{ "id": 116133, "url": "