Thread (4 messages) 4 messages, 1 author, 2021-09-27

[PATCH 1/3] scripts: get_abi.pl: produce an error if the ref tree is broken

flat view
STALE1843d LANDED

From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Date: 2021-09-27 13:50:01
Also in: lkml
Subsystem: the rest · Maintainer: Linus Torvalds

Landed in mainline as 3a1cc06c0e07 on 2021-09-28.

The logic under graph_add_file should create, for every entry, a
__name name array for all entries of the tree. If this fails, the
symlink parsing will break.

Add an error if this ever happens.

While here, improve the output of data dumper to be more
compact and to avoid displaying things like $VAR1=.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---

See [PATCH 0/3] at: https://lore.kernel.org/all/cover.1632750315.git.mchehab+huawei@kernel.org/ (local)

 scripts/get_abi.pl | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl
index c191c024f052..26a3f8ff566a 100755
--- a/scripts/get_abi.pl
+++ b/scripts/get_abi.pl
@@ -27,6 +27,9 @@ my $dbg_what_open = 2;
 my $dbg_dump_abi_structs = 4;
 my $dbg_undefined = 8;
 
+$Data::Dumper::Indent = 1;
+$Data::Dumper::Terse = 1;
+
 #
 # If true, assumes that the description is formatted with ReST
 #
@@ -597,7 +600,6 @@ sub graph_add_link {
 
 	my @queue;
 	my %seen;
-	my $base_name;
 	my $st;
 
 	push @queue, $file_ref;
@@ -611,6 +613,12 @@ sub graph_add_link {
 			next if $seen{$$v{$c}};
 			next if ($c eq "__name");
 
+			if (!defined($$v{$c}{"__name"})) {
+				printf STDERR "Error: Couldn't find a non-empty name on a children of $file/.*: ";
+				print STDERR Dumper(%{$v});
+				exit;
+			}
+
 			# Add new name
 			my $name = @{$$v{$c}{"__name"}}[0];
 			if ($name =~ s#^$file/#$link/#) {
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help