From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55AD5C432C0 for ; Tue, 3 Dec 2019 13:00:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29747206EC for ; Tue, 3 Dec 2019 13:00:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726254AbfLCNAy (ORCPT ); Tue, 3 Dec 2019 08:00:54 -0500 Received: from mx2.suse.de ([195.135.220.15]:34812 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725954AbfLCNAy (ORCPT ); Tue, 3 Dec 2019 08:00:54 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 34583B1EA; Tue, 3 Dec 2019 13:00:52 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 70BB4E0125; Tue, 3 Dec 2019 14:00:51 +0100 (CET) Date: Tue, 3 Dec 2019 14:00:51 +0100 From: Michal Kubecek To: netdev@vger.kernel.org Cc: Brian Vazquez , Brian Vazquez , David Ahern , Stephen Hemminger , Mahesh Bandewar , Maciej Zenczykowski , Hritik Vijay Subject: Re: [PATCH iproute2] ss: fix end-of-line printing in misc/ss.c Message-ID: <20191203130051.GD22263@unicorn.suse.cz> References: <20191127052118.163594-1-brianvv@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191127052118.163594-1-brianvv@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Nov 26, 2019 at 09:21:18PM -0800, Brian Vazquez wrote: > Before commit 5883c6eba517, function field_is_last() was incorrectly > reporting which column was the last because it was missing COL_PROC > and by purely coincidence it was correctly printing the end-of-line and > moving to the first column since the very last field was empty, and > end-of-line was added for the last non-empty token since it was seen as > the last field. > > This commits correcrly prints the end-of-line for the last entrien in > the ss command. > > Tested: > diff <(./ss.old -nltp) <(misc/ss -nltp) > 38c38 > < LISTEN 0 128 [::1]:35417 [::]:* users:(("foo",pid=65254,fd=116)) > \ No newline at end of file > --- > > LISTEN 0 128 [::1]:35417 [::]:* users:(("foo",pid=65254,fd=116)) > > Cc: Hritik Vijay > Fixes: 5883c6eba517 ("ss: show header for --processes/-p") > Signed-off-by: Brian Vazquez Tested-by: Michal Kubecek > --- > misc/ss.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/misc/ss.c b/misc/ss.c > index c58e5c4d..95f1d37a 100644 > --- a/misc/ss.c > +++ b/misc/ss.c > @@ -1290,6 +1290,11 @@ static void render(void) > > token = buf_token_next(token); > } > + /* Deal with final end-of-line when the last non-empty field printed > + * is not the last field. > + */ > + if (line_started) > + printf("\n"); > > buf_free_all(); > current_field = columns; > -- > 2.24.0.432.g9d3f5f5b63-goog >