Bug 28023 - Incorrect error message in readelf.c in compare_listptr
Summary: Incorrect error message in readelf.c in compare_listptr
Status: RESOLVED FIXED
Alias: None
Product: elfutils
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-29 07:32 UTC by Gabriel Valky
Modified: 2021-07-03 17:02 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriel Valky 2021-06-29 07:32:36 UTC
elfutils-0.185/src/readelf.c:4884

When comparing the attribute names in compare_listptr, the error message complaining that the attributes are different, shows the same value for both names:

      if (p1->attr != p2 ->attr)
	{
	  p1->warned = p2->warned = true;
	  error (0, 0,
		 _("%s %#" PRIx64
			  " used with different attribute %s and %s"),
		 name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr),
		 dwarf_attr_name (p2->attr));
	}

after correction:

      if (p1->attr != p2->attr)
	{
	  p1->warned = p2->warned = true;
	  error (0, 0,
		 _("%s %#" PRIx64
			  " used with different attribute %s and %s"),
		 name, (uint64_t) p1->offset, dwarf_attr_name (p1->attr),
		 dwarf_attr_name (p2->attr));
	}
Comment 1 Mark Wielaard 2021-07-03 17:02:56 UTC
Good find. Fixed by:

commit e8b5a5e9d8b8a503755a8a48c23a64a695664270 (HEAD -> master)
Author: Mark Wielaard <mark@klomp.org>
Date:   Sat Jul 3 18:56:54 2021 +0200

    readelf: Fix error message when two attribute names differ in in compare_listptr.
    
    We were printing the second attribute name twice. Print the first and second.
    
    Reported-by: Gabriel Valky <gvalky@tachyum.com>
    Signed-off-by: Mark Wielaard <mark@klomp.org>