netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute] ss: Actually print left delimiter for columns
@ 2018-10-29 22:04 Stefano Brivio
  2018-10-31 15:31 ` Stephen Hemminger
  2018-11-09 17:05 ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: Stefano Brivio @ 2018-10-29 22:04 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Yoann P., netdev

While rendering columns, we use a local variable to keep track of the
field currently being printed, without touching current_field, which is
used for buffering.

Use the right pointer to access the left delimiter for the current column,
instead of always printing the left delimiter for the last buffered field,
which is usually an empty string.

This fixes an issue especially visible on narrow terminals, where some
columns might be displayed without separation.

Reported-by: YoyPa <yoann.p.public@gmail.com>
Fixes: 691bd854bf4a ("ss: Buffer raw fields first, then render them as a table")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Tested-by: YoyPa <yoann.p.public@gmail.com>
---
 misc/ss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/ss.c b/misc/ss.c
index c8970438ce73..4d12fb5d19df 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1260,7 +1260,7 @@ static void render(void)
 	while (token) {
 		/* Print left delimiter only if we already started a line */
 		if (line_started++)
-			printed = printf("%s", current_field->ldelim);
+			printed = printf("%s", f->ldelim);
 		else
 			printed = 0;
 
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute] ss: Actually print left delimiter for columns
  2018-10-29 22:04 [PATCH iproute] ss: Actually print left delimiter for columns Stefano Brivio
@ 2018-10-31 15:31 ` Stephen Hemminger
  2018-11-09 17:05 ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2018-10-31 15:31 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: Yoann P., netdev

On Mon, 29 Oct 2018 23:04:25 +0100
Stefano Brivio <sbrivio@redhat.com> wrote:

> While rendering columns, we use a local variable to keep track of the
> field currently being printed, without touching current_field, which is
> used for buffering.
> 
> Use the right pointer to access the left delimiter for the current column,
> instead of always printing the left delimiter for the last buffered field,
> which is usually an empty string.
> 
> This fixes an issue especially visible on narrow terminals, where some
> columns might be displayed without separation.
> 
> Reported-by: YoyPa <yoann.p.public@gmail.com>
> Fixes: 691bd854bf4a ("ss: Buffer raw fields first, then render them as a table")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> Tested-by: YoyPa <yoann.p.public@gmail.com>

Looks good, applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute] ss: Actually print left delimiter for columns
  2018-10-29 22:04 [PATCH iproute] ss: Actually print left delimiter for columns Stefano Brivio
  2018-10-31 15:31 ` Stephen Hemminger
@ 2018-11-09 17:05 ` Stephen Hemminger
  2018-11-09 19:47   ` Stefano Brivio
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2018-11-09 17:05 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: Yoann P., netdev

On Mon, 29 Oct 2018 23:04:25 +0100
Stefano Brivio <sbrivio@redhat.com> wrote:

> While rendering columns, we use a local variable to keep track of the
> field currently being printed, without touching current_field, which is
> used for buffering.
> 
> Use the right pointer to access the left delimiter for the current column,
> instead of always printing the left delimiter for the last buffered field,
> which is usually an empty string.
> 
> This fixes an issue especially visible on narrow terminals, where some
> columns might be displayed without separation.
> 
> Reported-by: YoyPa <yoann.p.public@gmail.com>
> Fixes: 691bd854bf4a ("ss: Buffer raw fields first, then render them as a table")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> Tested-by: YoyPa <yoann.p.public@gmail.com>

This test broke the testsuite/ss/ssfilter.t test.
Please fix the test to match your new output format, or I will have to revert it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute] ss: Actually print left delimiter for columns
  2018-11-09 17:05 ` Stephen Hemminger
@ 2018-11-09 19:47   ` Stefano Brivio
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Brivio @ 2018-11-09 19:47 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Yoann P., netdev, Phil Sutter

On Fri, 9 Nov 2018 09:05:46 -0800
Stephen Hemminger <stephen@networkplumber.org> wrote:

> On Mon, 29 Oct 2018 23:04:25 +0100
> Stefano Brivio <sbrivio@redhat.com> wrote:
> 
> > While rendering columns, we use a local variable to keep track of the
> > field currently being printed, without touching current_field, which is
> > used for buffering.
> > 
> > Use the right pointer to access the left delimiter for the current column,
> > instead of always printing the left delimiter for the last buffered field,
> > which is usually an empty string.
> > 
> > This fixes an issue especially visible on narrow terminals, where some
> > columns might be displayed without separation.
> > 
> > Reported-by: YoyPa <yoann.p.public@gmail.com>
> > Fixes: 691bd854bf4a ("ss: Buffer raw fields first, then render them as a table")
> > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> > Tested-by: YoyPa <yoann.p.public@gmail.com>  
> 
> This test broke the testsuite/ss/ssfilter.t test.
> Please fix the test to match your new output format, or I will have to revert it.

Ouch, sorry, I didn't notice that "new" test. I'll fix that by tomorrow.

-- 
Stefano

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-10  5:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-29 22:04 [PATCH iproute] ss: Actually print left delimiter for columns Stefano Brivio
2018-10-31 15:31 ` Stephen Hemminger
2018-11-09 17:05 ` Stephen Hemminger
2018-11-09 19:47   ` Stefano Brivio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).