From patchwork Wed Aug 8 00:34:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 954752 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41lXTc1DgGz9rvt for ; Wed, 8 Aug 2018 10:34:59 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id AE312D8D; Wed, 8 Aug 2018 00:34:56 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 4B844D8C for ; Wed, 8 Aug 2018 00:34:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E96E9764 for ; Wed, 8 Aug 2018 00:34:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 000184022909; Wed, 8 Aug 2018 00:34:53 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-120-31.rdu2.redhat.com [10.10.120.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F014213ED6A; Wed, 8 Aug 2018 00:34:53 +0000 (UTC) From: Aaron Conole To: dev@openvswitch.org Date: Tue, 7 Aug 2018 20:34:51 -0400 Message-Id: <20180808003452.21396-1-aconole@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 08 Aug 2018 00:34:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 08 Aug 2018 00:34:54 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'aconole@redhat.com' RCPT:'' X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Jakub Sitnicki Subject: [ovs-dev] [PATCH v2 1/2] table: append newline when printing tables X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org With commit cb139fa8b3a1 ("table: New function table_format() for formatting a table as a string.") a new mechanism for formatting tables was introduced, and the table_print method was refactored to use this. During that refactor, calls to 'puts' were replaced with 'ds_put_cstr', and table print was changed to use 'fputs(..., stdout)'. Unfortunately, fputs() does not append a newline to the string provided, and changes the output strings of, for example, ovsdb-client dump to print all on one line. This means post-processing scripts that are chained after ovsdb-client would either block indefinitely (if they don't detect EOF), or process the entire bundle at once (rather than seeing each table on a separate line). Fixes: cb139fa8b3a1 ("table: New function table_format() for formatting a table as a string.") Cc: Ben Pfaff Cc: Jakub Sitnicki Reported-by: Terry Wilson Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1608508 Signed-off-by: Aaron Conole Suggested-by: Ben Pfaff Acked-by: Terry Wilson Tested-by: Terry Wilson Reported-by: Terry Wilson Signed-off-by: Aaron Conole Signed-off-by: Ben Pfaff Acked-by: Terry Wilson Tested-by: Terry Wilson --- lib/table.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/table.c b/lib/table.c index cd811caf5..19bf89262 100644 --- a/lib/table.c +++ b/lib/table.c @@ -547,6 +547,7 @@ table_print_json__(const struct table *table, const struct table_style *style, json_object_put(json, "data", data); json_to_ds(json, style->json_flags, s); + ds_put_char(s, '\n'); json_destroy(json); } From patchwork Wed Aug 8 00:34:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 954753 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41lXTz6lPmz9rvt for ; Wed, 8 Aug 2018 10:35:19 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 94703D9D; Wed, 8 Aug 2018 00:34:57 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 7C153D8C for ; Wed, 8 Aug 2018 00:34:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 35DD7766 for ; Wed, 8 Aug 2018 00:34:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C31D7A7E7; Wed, 8 Aug 2018 00:34:54 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-120-31.rdu2.redhat.com [10.10.120.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11C31213ED6A; Wed, 8 Aug 2018 00:34:54 +0000 (UTC) From: Aaron Conole To: dev@openvswitch.org Date: Tue, 7 Aug 2018 20:34:52 -0400 Message-Id: <20180808003452.21396-2-aconole@redhat.com> In-Reply-To: <20180808003452.21396-1-aconole@redhat.com> References: <20180808003452.21396-1-aconole@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 08 Aug 2018 00:34:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 08 Aug 2018 00:34:54 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'aconole@redhat.com' RCPT:'' X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Jakub Sitnicki Subject: [ovs-dev] [PATCH v2 2/2] table: fix html buffer output X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Prior to this commit, html output exhibiits a doppler effect for content by continually printing strings passed from table_print_html_cell. Fixes: cb139fa8b3a1 ("table: New function table_format() for formatting a table as a string.") Cc: Ben Pfaff Cc: Jakub Sitnicki Signed-off-by: Aaron Conole --- lib/table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/table.c b/lib/table.c index 19bf89262..ab72668c7 100644 --- a/lib/table.c +++ b/lib/table.c @@ -349,7 +349,7 @@ static void table_escape_html_text__(const char *content, size_t n, struct ds *s) { if (!strpbrk(content, "&<>\"")) { - ds_put_cstr(s, content); + ds_put_buffer(s, content, n); } else { size_t i;