From: Stefano Brivio <sbrivio@redhat•com>
To: "Yoann P." <yoann.p.public@gmail•com>
Cc: netdev@vger•kernel.org, Stephen Hemminger <stephen@networkplumber•org>
Subject: Re: [PATCH] Fix ss Netid column and Local/Peer_Address
Date: Mon, 29 Oct 2018 19:20:36 +0100 [thread overview]
Message-ID: <20181029192036.567fc122@redhat.com> (raw)
In-Reply-To: <5185850.l7bAsbzJZX@yo-gs>
Hi Yohann,
On Fri, 26 Oct 2018 22:53:32 +0200
"Yoann P." <yoann.p.public@gmail•com> wrote:
> When using ss -Hutn4 or -utn3, Netid and State columns are sometime merged, it
> can be confusing when trying to pipe into awk or column.
Thanks for fixing this. A few comments though:
> @@ -144,9 +144,9 @@ static struct column columns[] = {
> { ALIGN_LEFT, "State", " ", 0, 0, 0 },
> { ALIGN_LEFT, "Recv-Q", " ", 0, 0, 0 },
> { ALIGN_LEFT, "Send-Q", " ", 0, 0, 0 },
> - { ALIGN_RIGHT, "Local Address:", " ", 0, 0, 0 },
> + { ALIGN_RIGHT, "Local_Address:", " ", 0, 0, 0 },
> { ALIGN_LEFT, "Port", "", 0, 0, 0 },
> - { ALIGN_RIGHT, "Peer Address:", " ", 0, 0, 0 },
> + { ALIGN_RIGHT, "Peer_Address:", " ", 0, 0, 0 },
This is needed only if you pipe the output to column(1), I don't think
it's a bug, because printing the header when you pass the output to
column(1) makes little sense -- one should use -H then.
By the way, why do you use column(1), when ss already prints output in
columns? Any other issue you are working around?
> { ALIGN_LEFT, "Port", "", 0, 0, 0 },
> { ALIGN_LEFT, "", "", 0, 0, 0 },
> };
> @@ -1334,7 +1334,7 @@ static void sock_state_print(struct sockstat *s)
> out("`- %s", sctp_sstate_name[s->state]);
> } else {
> field_set(COL_NETID);
> - out("%s", sock_name);
> + out("%-6s", sock_name);
I could reproduce this issue with a 70-columns terminal and the options
you gave.
Anyway, I don't think this is the right way to fix it: this will waste
one to two columns in case we have three letters for the Netid
specifier, and won't work the day we get six-letters names. In general,
it looks like a bad idea to reintroduce hardcoded width counts.
The actual issue seems to be that in some cases the left delimiter for
the State column is not printed, and I think you should fix that
instead. I'll look into this within a couple of days and give you some
more specific hints in case you still need them by then.
--
Stefano
next prev parent reply other threads:[~2018-10-30 3:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-26 20:53 [PATCH] Fix ss Netid column and Local/Peer_Address Yoann P.
2018-10-29 17:02 ` Stephen Hemminger
2018-10-29 18:20 ` Stefano Brivio [this message]
2018-10-29 18:49 ` Stefano Brivio
2018-10-29 20:07 ` Yoann P.
2018-10-29 22:03 ` Stefano Brivio
2018-10-29 20:06 ` Yoann P.
2018-10-29 22:03 ` Stefano Brivio
2018-10-29 22:20 ` Yoann P.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181029192036.567fc122@redhat.com \
--to=sbrivio@redhat$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=stephen@networkplumber$(echo .)org \
--cc=yoann.p.public@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox