* [PATCH net 0/3] tools: ynl-gen: fix glitches found by Chuck
@ 2023-02-23 18:31 Jakub Kicinski
2023-02-23 18:31 ` [PATCH net 1/3] tools: ynl-gen: fix single attribute structs with attr 0 only Jakub Kicinski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2023-02-23 18:31 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, Jakub Kicinski
A handful of fixes Chuck run into while trying to define the family
for crypto handshakes.
Jakub Kicinski (3):
tools: ynl-gen: fix single attribute structs with attr 0 only
tools: ynl-gen: re-raise the exception instead of printing
tools: net: add __pycache__ to gitignore
tools/net/ynl/lib/.gitignore | 1 +
tools/net/ynl/lib/nlspec.py | 4 +---
tools/net/ynl/ynl-gen-c.py | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
create mode 100644 tools/net/ynl/lib/.gitignore
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/3] tools: ynl-gen: fix single attribute structs with attr 0 only
2023-02-23 18:31 [PATCH net 0/3] tools: ynl-gen: fix glitches found by Chuck Jakub Kicinski
@ 2023-02-23 18:31 ` Jakub Kicinski
2023-02-23 18:31 ` [PATCH net 2/3] tools: ynl-gen: re-raise the exception instead of printing Jakub Kicinski
2023-02-23 18:31 ` [PATCH net 3/3] tools: net: add __pycache__ to gitignore Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2023-02-23 18:31 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, Jakub Kicinski, Chuck Lever III
Chuck run into an issue with a single-element attr-set which
only has an attr with value of 0. The search for max attr in
a struct records attrs with value larger than 0 only (max_val
is set to 0 at the start). Adjust the comparison, alternatively
max_val could be init'ed to -1. Somehow picking the last attr
of a value seems like a good idea in general.
Reported-by: Chuck Lever III <chuck.lever@oracle.com>
Fixes: be5bea1cc0bf ("net: add basic C code generators for Netlink")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
tools/net/ynl/ynl-gen-c.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index 3942f24b9163..274e9c566f61 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -546,7 +546,7 @@ from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation
max_val = 0
self.attr_max_val = None
for name, attr in self.attr_list:
- if attr.value > max_val:
+ if attr.value >= max_val:
max_val = attr.value
self.attr_max_val = attr
self.attrs[name] = attr
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/3] tools: ynl-gen: re-raise the exception instead of printing
2023-02-23 18:31 [PATCH net 0/3] tools: ynl-gen: fix glitches found by Chuck Jakub Kicinski
2023-02-23 18:31 ` [PATCH net 1/3] tools: ynl-gen: fix single attribute structs with attr 0 only Jakub Kicinski
@ 2023-02-23 18:31 ` Jakub Kicinski
2023-02-23 18:31 ` [PATCH net 3/3] tools: net: add __pycache__ to gitignore Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2023-02-23 18:31 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, Jakub Kicinski, Chuck Lever III
traceback.print_exception() seems tricky to call, we're missing
some argument, so re-raise instead.
Reported-by: Chuck Lever III <chuck.lever@oracle.com>
Fixes: 3aacf8281336 ("tools: ynl: add an object hierarchy to represent parsed spec")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
tools/net/ynl/lib/nlspec.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/net/ynl/lib/nlspec.py b/tools/net/ynl/lib/nlspec.py
index e204679ad8b7..71da568e2c28 100644
--- a/tools/net/ynl/lib/nlspec.py
+++ b/tools/net/ynl/lib/nlspec.py
@@ -3,7 +3,6 @@
import collections
import importlib
import os
-import traceback
import yaml
@@ -234,8 +233,7 @@ jsonschema = None
resolved.append(elem)
if len(resolved) == 0:
- traceback.print_exception(last_exception)
- raise Exception("Could not resolve any spec element, infinite loop?")
+ raise last_exception
def new_attr_set(self, elem):
return SpecAttrSet(self, elem)
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 3/3] tools: net: add __pycache__ to gitignore
2023-02-23 18:31 [PATCH net 0/3] tools: ynl-gen: fix glitches found by Chuck Jakub Kicinski
2023-02-23 18:31 ` [PATCH net 1/3] tools: ynl-gen: fix single attribute structs with attr 0 only Jakub Kicinski
2023-02-23 18:31 ` [PATCH net 2/3] tools: ynl-gen: re-raise the exception instead of printing Jakub Kicinski
@ 2023-02-23 18:31 ` Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2023-02-23 18:31 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, Jakub Kicinski, Chuck Lever III
Python will generate its customary cache when running ynl scripts:
?? tools/net/ynl/lib/__pycache__/
Reported-by: Chuck Lever III <chuck.lever@oracle.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
tools/net/ynl/lib/.gitignore | 1 +
1 file changed, 1 insertion(+)
create mode 100644 tools/net/ynl/lib/.gitignore
diff --git a/tools/net/ynl/lib/.gitignore b/tools/net/ynl/lib/.gitignore
new file mode 100644
index 000000000000..c18dd8d83cee
--- /dev/null
+++ b/tools/net/ynl/lib/.gitignore
@@ -0,0 +1 @@
+__pycache__/
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-23 18:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-23 18:31 [PATCH net 0/3] tools: ynl-gen: fix glitches found by Chuck Jakub Kicinski
2023-02-23 18:31 ` [PATCH net 1/3] tools: ynl-gen: fix single attribute structs with attr 0 only Jakub Kicinski
2023-02-23 18:31 ` [PATCH net 2/3] tools: ynl-gen: re-raise the exception instead of printing Jakub Kicinski
2023-02-23 18:31 ` [PATCH net 3/3] tools: net: add __pycache__ to gitignore Jakub Kicinski
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).