libabigail/tests/data/test-diff-pkg/spice-debuginfo-0.12.8-1.el7.x86_64.rpm
Dodji Seketeli 2dcc6062f2 Fix suppression category propagation in diff node graph
Under certain circumstances, a diff node (which we shall name N) that
belongs to the SUPPRESSED_CATEGORY category sees its belonging to that
category been propagated to its parent diff node, effectively
suppressing that parent diff node as well.  This is how some function
diff nodes ends up being suppressed just because some of their
children diff nodes were suppressed.

This suppression category propagation is performed by a pass that
walks the diff nodes graph.  To avoid infinite cycles, the pass avoids
visiting a diff node that is equivalent to a node that has already
been visited.

As a result, diff nodes equivalent to N (the class of equivalence of
N) are not traversed by the propagation pass.  So their parent diff
nodes are not suppressed.

This leads to some functions not being suppressed as they should.
This phenomenon can be observed by comparing the two packages that are
provided in the regression test accompanying this patch using
abipkgdiff with the --redundant option.

Here is how the patch addresses the issue.

When the suppression category propagation pass considers a parent diff
node (named P) of a node N' (with N' being equivalent to N), it now
looks at the category of the *class of equivalence of N'* to determine
if that category should be propagated to P.

Previously, that pass would just look at the at the category of N'
(not the category of the class of equivalence of N') for the
propagation.  But as N' has not been visited (because N has already
been visited and nodes equivalent to N are thus not visited) the
belonging of N' to the SUPPRESSED_CATEGORY hasn't been updated.  So N'
isn't marked as being in SUPPRESSED_CATEGORY.  So the
SUPPRESSED_CATEGORY wouldn't be propagated to P as it should.

So, with this patch abipkgdiff invoked with the --redundant option now
correctly yields:

$ abipkgdiff --redundant --d1 spice-debuginfo-0.12.4-19.el7.x86_64.rpm --d2 spice-debuginfo-0.12.8-1.el7.x86_64.rpm --devel1 spice-server-devel-0.12.4-19.el7.x86_64.rpm --devel2 spice-server-devel-0.12.8-1.el7.x86_64.rpm spice-server-0.12.4-19.el7.x86_64.rpm spice-server-0.12.8-1.el7.x86_64.rpm
================ changes of 'libspice-server.so.1.8.0'===============
  Functions changes summary: 1 Removed, 2 Changed (62 filtered out), 8 Added functions
  Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

[...]

  2 functions with some indirect sub-type change:

    [C]'function spice_image_compression_t spice_server_get_image_compression(SpiceServer*)' at reds.c:3618:1 has some indirect sub-type changes:
      return type changed:
        underlying type 'enum __anonymous_enum__' changed:
          type size hasn't changed
          7 enumerator deletions:
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_INVALID' value '0'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_OFF' value '1'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_AUTO_GLZ' value '2'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_AUTO_LZ' value '3'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_QUIC' value '4'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_GLZ' value '5'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_LZ' value '6'

          9 enumerator insertions:
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_INVALID' value '0'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_OFF' value '1'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_AUTO_GLZ' value '2'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_AUTO_LZ' value '3'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_QUIC' value '4'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_GLZ' value '5'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_LZ' value '6'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_LZ4' value '7'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_ENUM_END' value '8'

    [C]'function int spice_server_set_image_compression(SpiceServer*, spice_image_compression_t)' at reds.c:3602:1 has some indirect sub-type changes:
      parameter 2 of type 'typedef spice_image_compression_t' changed:
        underlying type 'enum __anonymous_enum__' changed:
          type size hasn't changed
          7 enumerator deletions:
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_INVALID' value '0'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_OFF' value '1'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_AUTO_GLZ' value '2'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_AUTO_LZ' value '3'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_QUIC' value '4'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_GLZ' value '5'
            '__anonymous_enum__::SPICE_IMAGE_COMPRESS_LZ' value '6'

          9 enumerator insertions:
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_INVALID' value '0'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_OFF' value '1'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_AUTO_GLZ' value '2'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_AUTO_LZ' value '3'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_QUIC' value '4'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_GLZ' value '5'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_LZ' value '6'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_LZ4' value '7'
            'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_ENUM_END' value '8'

================ end of changes of 'libspice-server.so.1.8.0'===============

$

	* include/abg-comparison.h (diff::get_class_of_equiv_category):
	Declare new member function.
	* src/abg-comparison.cc: Update copyright year.
	(diff::get_class_of_equiv_category): Define new member function.
	(suppression_categorization_visitor::visit_end): When considering
	children nodes category for propagation, consider the category of
	the class of equivalence of children nodes.
	* spice-debuginfo-0.12.4-19.el7.x86_64.rpm: New input test package.
	* spice-debuginfo-0.12.8-1.el7.x86_64.rpm: Likewise.
	* spice-server-0.12.4-19.el7.x86_64.rpm: Likewise.
	* spice-server-0.12.8-1.el7.x86_64.rpm: Likewise.
	* spice-server-devel-0.12.4-19.el7.x86_64.rpm: Likewise.
	* spice-server-devel-0.12.8-1.el7.x86_64.rpm: Likewise.
	* spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-0.txt:
	New reference test output.
	* spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-1.txt: Likewise.
	* spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-diff-pkg.cc (in_out_specs): Add the new test inputs
	to the list of packages to test.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-20 10:59:58 +01:00

1.4 MiB