From: Breno Leitao <leitao@debian.org>
To: Donald Hunter <donald.hunter@gmail.com>, kuba@kernel.org
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Jiri Pirko <jiri@resnulli.us>,
Stanislav Fomichev <sdf@google.com>,
donald.hunter@redhat.com
Subject: Re: [PATCH net-next v3 2/6] tools/net/ynl: Report netlink errors without stacktrace
Date: Thu, 7 Mar 2024 01:31:16 -0800 [thread overview]
Message-ID: <ZemJZPySuUyGlMTu@gmail.com> (raw)
In-Reply-To: <20240306231046.97158-3-donald.hunter@gmail.com>
Hello Donald,
On Wed, Mar 06, 2024 at 11:10:42PM +0000, Donald Hunter wrote:
> ynl does not handle NlError exceptions so they get reported like program
> failures. Handle the NlError exceptions and report the netlink errors
> more cleanly.
>
> Example now:
>
> Netlink error: No such file or directory
> nl_len = 44 (28) nl_flags = 0x300 nl_type = 2
> error: -2 extack: {'bad-attr': '.op'}
>
> Example before:
>
> Traceback (most recent call last):
> File "/home/donaldh/net-next/./tools/net/ynl/cli.py", line 81, in <module>
> main()
> File "/home/donaldh/net-next/./tools/net/ynl/cli.py", line 69, in main
> reply = ynl.dump(args.dump, attrs)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/home/donaldh/net-next/tools/net/ynl/lib/ynl.py", line 906, in dump
> return self._op(method, vals, [], dump=True)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/home/donaldh/net-next/tools/net/ynl/lib/ynl.py", line 872, in _op
> raise NlError(nl_msg)
> lib.ynl.NlError: Netlink error: No such file or directory
> nl_len = 44 (28) nl_flags = 0x300 nl_type = 2
> error: -2 extack: {'bad-attr': '.op'}
Basically this is just hidding the stack, which may make it harder for
someone not used to the code to find the problem.
Usually fatal exception is handled to make the error more meaningful,
i.e, better than just the exception message + stack. Hidding the stack
and exitting may make the error less meaningful.
On a different topic, I am wondering if we want to add type hitting for
these python program. They make the review process easier, and the
development a bit more structured. (Maybe that is what we expect from
upcoming new python code in netdev?!)
If that is where we want to go, this is *not*, by any mean, a blocker to
this code. Maybe something we can add to our public ToDo list (CC:
Jakub).
next prev parent reply other threads:[~2024-03-07 9:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 23:10 [PATCH net-next v3 0/6] tools/net/ynl: Add support for nlctrl netlink family Donald Hunter
2024-03-06 23:10 ` [PATCH net-next v3 1/6] tools/net/ynl: Fix extack decoding for netlink-raw Donald Hunter
2024-03-06 23:10 ` [PATCH net-next v3 2/6] tools/net/ynl: Report netlink errors without stacktrace Donald Hunter
2024-03-07 9:31 ` Breno Leitao [this message]
2024-03-07 11:56 ` Donald Hunter
2024-03-07 15:58 ` Jakub Kicinski
2024-03-08 18:27 ` Breno Leitao
2024-03-08 19:16 ` Jakub Kicinski
2024-03-06 23:10 ` [PATCH net-next v3 3/6] tools/net/ynl: Fix c codegen for array-nest Donald Hunter
2024-03-06 23:10 ` [PATCH net-next v3 4/6] tools/net/ynl: Add nest-type-value decoding Donald Hunter
2024-03-06 23:10 ` [PATCH net-next v3 5/6] doc/netlink: Allow empty enum-name in ynl specs Donald Hunter
2024-03-07 2:26 ` Jakub Kicinski
2024-03-07 9:08 ` Donald Hunter
2024-03-07 15:21 ` Jakub Kicinski
2024-03-06 23:10 ` [PATCH net-next v3 6/6] doc/netlink/specs: Add spec for nlctrl netlink family Donald Hunter
2024-03-08 5:00 ` [PATCH net-next v3 0/6] tools/net/ynl: Add support " patchwork-bot+netdevbpf
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=ZemJZPySuUyGlMTu@gmail.com \
--to=leitao@debian.org \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=donald.hunter@redhat.com \
--cc=edumazet@google.com \
--cc=jacob.e.keller@intel.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.