[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191203130051.GD22263@unicorn.suse.cz>
Date: Tue, 3 Dec 2019 14:00:51 +0100
From: Michal Kubecek <mkubecek@...e.cz>
To: netdev@...r.kernel.org
Cc: Brian Vazquez <brianvv@...gle.com>,
Brian Vazquez <brianvv.kernel@...il.com>,
David Ahern <dsahern@...il.com>,
Stephen Hemminger <stephen@...workplumber.org>,
Mahesh Bandewar <maheshb@...gle.com>,
Maciej Zenczykowski <maze@...gle.com>,
Hritik Vijay <hritikxx8@...il.com>
Subject: Re: [PATCH iproute2] ss: fix end-of-line printing in misc/ss.c
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 <hritikxx8@...il.com>
> Fixes: 5883c6eba517 ("ss: show header for --processes/-p")
> Signed-off-by: Brian Vazquez <brianvv@...gle.com>
Tested-by: Michal Kubecek <mkubecek@...e.cz>
> ---
> 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
>
Powered by blists - more mailing lists