{"id":815870,"url":"http://patchwork.ozlabs.org/api/patches/815870/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/patch/20170919220125.32535-5-blp@ovn.org/","project":{"id":47,"url":"http://patchwork.ozlabs.org/api/projects/47/?format=json","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":"<20170919220125.32535-5-blp@ovn.org>","list_archive_url":null,"date":"2017-09-19T22:00:37","name":"[ovs-dev,RFC,04/52] util: Avoid trailing white space in hex dumps.","commit_ref":null,"pull_url":null,"state":"rfc","archived":false,"hash":"ddc370b92b5a225355dcf65167ace49173a24895","submitter":{"id":67603,"url":"http://patchwork.ozlabs.org/api/people/67603/?format=json","name":"Ben Pfaff","email":"blp@ovn.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/openvswitch/patch/20170919220125.32535-5-blp@ovn.org/mbox/","series":[{"id":3975,"url":"http://patchwork.ozlabs.org/api/series/3975/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/list/?series=3975","date":"2017-09-19T22:00:34","name":"clustering implementation","version":1,"mbox":"http://patchwork.ozlabs.org/series/3975/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/815870/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/815870/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@mail.linuxfoundation.org"],"Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xxcNK4FSrz9sBW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 08:04:17 +1000 (AEST)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 59536C06;\n\tTue, 19 Sep 2017 22:01:45 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id E31FCBF3\n\tfor <dev@openvswitch.org>; Tue, 19 Sep 2017 22:01:40 +0000 (UTC)","from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 257E320D\n\tfor <dev@openvswitch.org>; Tue, 19 Sep 2017 22:01:40 +0000 (UTC)","from sigabrt.benpfaff.org (unknown [208.91.2.3])\n\t(Authenticated sender: blp@ovn.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id DE103172094;\n\tWed, 20 Sep 2017 00:01:37 +0200 (CEST)"],"X-Greylist":"domain auto-whitelisted by SQLgrey-1.7.6","X-Originating-IP":"208.91.2.3","From":"Ben Pfaff <blp@ovn.org>","To":"dev@openvswitch.org","Date":"Tue, 19 Sep 2017 15:00:37 -0700","Message-Id":"<20170919220125.32535-5-blp@ovn.org>","X-Mailer":"git-send-email 2.10.2","In-Reply-To":"<20170919220125.32535-1-blp@ovn.org>","References":"<20170919220125.32535-1-blp@ovn.org>","X-Spam-Status":"No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW\n\tautolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Cc":"Ben Pfaff <blp@ovn.org>","Subject":"[ovs-dev] [PATCH RFC 04/52] util: Avoid trailing white space in hex\n\tdumps.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<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\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"},"content":"ovs_hex_dump() sometimes yields a trailing space in its output.  This is\nannoying for the test infrastructure, since we have to specially mark the\ntrailing white space in Autotest with a \"@&t@\" marker at the end of the\nline.  This commit gets rid of the trailing white space and the annoying\n\"@&t@\" markers.\n\nThis also gets rid of an occasional trailing hyphen.\n\nSigned-off-by: Ben Pfaff <blp@ovn.org>\n---\n lib/util.c          |  7 ++++---\n tests/ofp-errors.at | 44 ++++++++++++++++++++++----------------------\n tests/ofp-util.at   | 18 +++++++++---------\n tests/ovs-ofctl.at  | 20 ++++++++++----------\n 4 files changed, 45 insertions(+), 44 deletions(-)","diff":"diff --git a/lib/util.c b/lib/util.c\nindex 36e373120af8..b7e896b4cdf8 100644\n--- a/lib/util.c\n+++ b/lib/util.c\n@@ -658,14 +658,15 @@ ovs_hex_dump(FILE *stream, const void *buf_, size_t size,\n       n = end - start;\n \n       /* Print line. */\n-      fprintf(stream, \"%08\"PRIxMAX\"  \", (uintmax_t) ROUND_DOWN(ofs, per_line));\n+      fprintf(stream, \"%08\"PRIxMAX\" \", (uintmax_t) ROUND_DOWN(ofs, per_line));\n       for (i = 0; i < start; i++)\n         fprintf(stream, \"   \");\n       for (; i < end; i++)\n-        fprintf(stream, \"%02x%c\",\n-                buf[i - start], i == per_line / 2 - 1? '-' : ' ');\n+        fprintf(stream, \"%c%02x\",\n+                i == per_line / 2 ? '-' : ' ', buf[i - start]);\n       if (ascii)\n         {\n+          fprintf(stream, \" \");\n           for (; i < per_line; i++)\n             fprintf(stream, \"   \");\n           fprintf(stream, \"|\");\ndiff --git a/tests/ofp-errors.at b/tests/ofp-errors.at\nindex caf4e4a7d16f..690c4a6fb776 100644\n--- a/tests/ofp-errors.at\n+++ b/tests/ofp-errors.at\n@@ -120,18 +120,18 @@ AT_SETUP([encoding errors extension that became official])\n AT_KEYWORDS([ofp-print ofp-errors])\n AT_CHECK(\n   [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0100000812345678], [0], [dnl\n-00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@\n-00000010  00 01 02 01 01 00 00 08-12 34 56 78 @&t@\n+00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20\n+00000010  00 01 02 01 01 00 00 08-12 34 56 78\n ])\n AT_CHECK(\n   [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0200000812345678], [0], [dnl\n-00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@\n-00000010  00 01 02 01 02 00 00 08-12 34 56 78 @&t@\n+00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20\n+00000010  00 01 02 01 02 00 00 08-12 34 56 78\n ])\n AT_CHECK(\n   [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0300000812345678], [0], [dnl\n-00000000  03 01 00 14 12 34 56 78-00 0b 00 02 03 00 00 08 @&t@\n-00000010  12 34 56 78 @&t@\n+00000000  03 01 00 14 12 34 56 78-00 0b 00 02 03 00 00 08\n+00000010  12 34 56 78\n ])\n AT_CLEANUP\n \n@@ -190,18 +190,18 @@ AT_KEYWORDS([ofp-print ofp-errors])\n # correctly using the standard experimenter format in OF1.2.\n AT_CHECK(\n   [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0100000812345678], [0], [dnl\n-00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@\n-00000010  00 01 02 03 01 00 00 08-12 34 56 78 @&t@\n+00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20\n+00000010  00 01 02 03 01 00 00 08-12 34 56 78\n ])\n AT_CHECK(\n   [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0200000812345678], [0], [dnl\n-00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@\n-00000010  00 01 02 03 02 00 00 08-12 34 56 78 @&t@\n+00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20\n+00000010  00 01 02 03 02 00 00 08-12 34 56 78\n ])\n AT_CHECK(\n   [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0300000812345678], [0], [dnl\n-00000000  03 01 00 18 12 34 56 78-ff ff 00 04 00 00 23 20 @&t@\n-00000010  03 00 00 08 12 34 56 78-\n+00000000  03 01 00 18 12 34 56 78-ff ff 00 04 00 00 23 20\n+00000010  03 00 00 08 12 34 56 78\n ])\n \n # Check that OFPERR_OFPBIC_DUP_INST is:\n@@ -211,24 +211,24 @@ AT_CHECK(\n #    - encoded in the standard form in OF1.4.\n AT_CHECK(\n   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' encode-error-reply OFPBIC_DUP_INST 0100000812345678], [0], [dnl\n-00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@\n-00000010  00 01 02 09 01 00 00 08-12 34 56 78 @&t@\n+00000000  01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20\n+00000010  00 01 02 09 01 00 00 08-12 34 56 78\n ], [ofp_errors|ERR|cannot encode OFPBIC_DUP_INST for OpenFlow 1.0\n ])\n AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0200000812345678], [0],\n-[00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@\n-00000010  00 03 01 00 02 00 00 08-12 34 56 78 @&t@\n+[00000000  02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20\n+00000010  00 03 01 00 02 00 00 08-12 34 56 78\n ])\n AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0300000812345678], [0],\n-[00000000  03 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00 @&t@\n-00000010  03 00 00 08 12 34 56 78-\n+[00000000  03 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00\n+00000010  03 00 00 08 12 34 56 78\n ])\n AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0400000812345678], [0],\n-[00000000  04 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00 @&t@\n-00000010  04 00 00 08 12 34 56 78-\n+[00000000  04 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00\n+00000010  04 00 00 08 12 34 56 78\n ])\n AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0500000812345678], [0],\n-[00000000  05 01 00 14 12 34 56 78-00 03 00 09 05 00 00 08 @&t@\n-00000010  12 34 56 78 @&t@\n+[00000000  05 01 00 14 12 34 56 78-00 03 00 09 05 00 00 08\n+00000010  12 34 56 78\n ])\n AT_CLEANUP\ndiff --git a/tests/ofp-util.at b/tests/ofp-util.at\nindex 700173a34f6f..c242f6402d05 100644\n--- a/tests/ofp-util.at\n+++ b/tests/ofp-util.at\n@@ -3,49 +3,49 @@ AT_BANNER([OpenFlow utilities])\n AT_SETUP([encoding hellos])\n dnl All versions up to a max version supported:\n AT_CHECK([ovs-ofctl encode-hello 0x2], [0], [dnl\n-00000000  01 00 00 08 00 00 00 01-\n+00000000  01 00 00 08 00 00 00 01\n OFPT_HELLO (xid=0x1):\n  version bitmap: 0x01\n ])\n AT_CHECK([ovs-ofctl encode-hello 0x6], [0], [dnl\n-00000000  02 00 00 08 00 00 00 01-\n+00000000  02 00 00 08 00 00 00 01\n OFPT_HELLO (OF1.1) (xid=0x1):\n  version bitmap: 0x01, 0x02\n ])\n AT_CHECK([ovs-ofctl encode-hello 0xe], [0], [dnl\n-00000000  03 00 00 08 00 00 00 01-\n+00000000  03 00 00 08 00 00 00 01\n OFPT_HELLO (OF1.2) (xid=0x1):\n  version bitmap: 0x01, 0x02, 0x03\n ])\n AT_CHECK([ovs-ofctl encode-hello 0x1e], [0], [dnl\n-00000000  04 00 00 08 00 00 00 01-\n+00000000  04 00 00 08 00 00 00 01\n OFPT_HELLO (OF1.3) (xid=0x1):\n  version bitmap: 0x01, 0x02, 0x03, 0x04\n ])\n AT_CHECK([ovs-ofctl encode-hello 0x3e], [0], [dnl\n-00000000  05 00 00 08 00 00 00 01-\n+00000000  05 00 00 08 00 00 00 01\n OFPT_HELLO (OF1.4) (xid=0x1):\n  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05\n ])\n \n dnl Some versions below max version missing.\n AT_CHECK([ovs-ofctl encode-hello 0xc], [0], [dnl\n-00000000  03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 0c @&t@\n+00000000  03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 0c\n OFPT_HELLO (OF1.2) (xid=0x1):\n  version bitmap: 0x02, 0x03\n ])\n AT_CHECK([ovs-ofctl encode-hello 0xa], [0], [dnl\n-00000000  03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 0a @&t@\n+00000000  03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 0a\n OFPT_HELLO (OF1.2) (xid=0x1):\n  version bitmap: 0x01, 0x03\n ])\n AT_CHECK([ovs-ofctl encode-hello 0x8], [0], [dnl\n-00000000  03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 08 @&t@\n+00000000  03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 08\n OFPT_HELLO (OF1.2) (xid=0x1):\n  version bitmap: 0x03\n ])\n AT_CHECK([ovs-ofctl encode-hello 0x4], [0], [dnl\n-00000000  02 00 00 10 00 00 00 01-00 01 00 08 00 00 00 04 @&t@\n+00000000  02 00 00 10 00 00 00 01-00 01 00 08 00 00 00 04\n OFPT_HELLO (OF1.1) (xid=0x1):\n  version bitmap: 0x02\n ])\ndiff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at\nindex 6d2ae1d26bea..28bca8b9b781 100644\n--- a/tests/ovs-ofctl.at\n+++ b/tests/ovs-ofctl.at\n@@ -2443,30 +2443,30 @@ NXOXM_ET_DP_HASH_W(01234567/0fffffff)\n # in OF1.5.\n AT_CHECK([ovs-ofctl -m --strict parse-oxm OpenFlow15 < oxm.txt], [0], [dnl\n NXOXM_ET_DP_HASH(01234567)\n-00000000  00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67 @&t@\n+00000000  00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67\n NXOXM_ET_DP_HASH(01234567)\n-00000000  00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67 @&t@\n+00000000  00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67\n \n NXOXM_ET_DP_HASH_W(01234567/0fffffff)\n-00000000  00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67 @&t@\n-00000010  0f ff ff ff 00 00 00 00-\n+00000000  00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67\n+00000010  0f ff ff ff 00 00 00 00\n NXOXM_ET_DP_HASH_W(01234567/0fffffff)\n-00000000  00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67 @&t@\n-00000010  0f ff ff ff 00 00 00 00-\n+00000000  00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67\n+00000010  0f ff ff ff 00 00 00 00\n ])\n \n # Then verify that both forms are accepted and NXM_NX_DP_HASH is encoded\n # in OF1.2.\n AT_CHECK([ovs-ofctl -m --strict parse-oxm OpenFlow12 < oxm.txt], [0], [dnl\n NXM_NX_DP_HASH(01234567)\n-00000000  00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00 @&t@\n+00000000  00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00\n NXM_NX_DP_HASH(01234567)\n-00000000  00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00 @&t@\n+00000000  00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00\n \n NXM_NX_DP_HASH_W(01234567/0fffffff)\n-00000000  00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff @&t@\n+00000000  00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff\n NXM_NX_DP_HASH_W(01234567/0fffffff)\n-00000000  00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff @&t@\n+00000000  00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff\n ])\n AT_CLEANUP\n \n","prefixes":["ovs-dev","RFC","04/52"]}