diff mbox series

abg-corpus.cc: report architecture discrepancies

Message ID 20200918100054.505140-1-gprocida@google.com
State New
Headers show
Series abg-corpus.cc: report architecture discrepancies | expand

Commit Message

Giuliano Procida Sept. 18, 2020, 10 a.m. UTC
If there ever is a discrepancy between the architectures of the
corpuses of a corpus group, libabigail will just abort with an
assertion, if enabled. However, this is a case of invalid input and
the cause should be reported to the user.

	* src/abg-corpus.cc (corpus_group::add_corpus): Report
	architecture discrepancies.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-corpus.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Matthias Maennich Sept. 18, 2020, 11:23 a.m. UTC | #1
On Fri, Sep 18, 2020 at 11:00:54AM +0100, Android Kernel Team wrote:
>If there ever is a discrepancy between the architectures of the
>corpuses of a corpus group, libabigail will just abort with an
>assertion, if enabled. However, this is a case of invalid input and
>the cause should be reported to the user.
>
>	* src/abg-corpus.cc (corpus_group::add_corpus): Report
>	architecture discrepancies.
>
>Signed-off-by: Giuliano Procida <gprocida@google.com>

Run into that occasionally as well. So, thanks for addressing this!

Reviewed-by: Matthias Maennich <maennich@google.com>

Cheers,
Matthias

>---
> src/abg-corpus.cc | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
>diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc
>index 1f72904d1..67f878dd6 100644
>--- a/src/abg-corpus.cc
>+++ b/src/abg-corpus.cc
>@@ -1647,8 +1647,13 @@ corpus_group::add_corpus(const corpus_sptr& corp)
>     corp_arch = corp->get_architecture_name();
>   if (cur_arch.empty())
>     set_architecture_name(corp_arch);
>-  else
>-    ABG_ASSERT(cur_arch == corp_arch);
>+  else if (cur_arch != corp_arch)
>+    {
>+      std::cerr << "corpus '" << corp->get_path() << "'"
>+		<< " has architecture '" << corp_arch << "'"
>+		<< " but expected '" << cur_arch << "'\n";
>+      ABG_ASSERT_NOT_REACHED;
>+    }
>
>   priv_->corpora.push_back(corp);
>   corp->set_group(this);
>-- 
>2.28.0.681.g6f77f65b4e-goog
>
>-- 
>To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
>
Dodji Seketeli Sept. 22, 2020, 4:15 p.m. UTC | #2
Hello,

Giuliano Procida <gprocida@google.com> a écrit:

> If there ever is a discrepancy between the architectures of the
> corpuses of a corpus group, libabigail will just abort with an
> assertion, if enabled. However, this is a case of invalid input and
> the cause should be reported to the user.
>
> 	* src/abg-corpus.cc (corpus_group::add_corpus): Report
> 	architecture discrepancies.
>
> Signed-off-by: Giuliano Procida <gprocida@google.com>

Applied to master, thanks!

[...]

Cheers,
diff mbox series

Patch

diff --git a/src/abg-corpus.cc b/src/abg-corpus.cc
index 1f72904d1..67f878dd6 100644
--- a/src/abg-corpus.cc
+++ b/src/abg-corpus.cc
@@ -1647,8 +1647,13 @@  corpus_group::add_corpus(const corpus_sptr& corp)
     corp_arch = corp->get_architecture_name();
   if (cur_arch.empty())
     set_architecture_name(corp_arch);
-  else
-    ABG_ASSERT(cur_arch == corp_arch);
+  else if (cur_arch != corp_arch)
+    {
+      std::cerr << "corpus '" << corp->get_path() << "'"
+		<< " has architecture '" << corp_arch << "'"
+		<< " but expected '" << cur_arch << "'\n";
+      ABG_ASSERT_NOT_REACHED;
+    }
 
   priv_->corpora.push_back(corp);
   corp->set_group(this);