[Bug 268071] elftoolchain readelf: feature to force display filename

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 30 Nov 2022 06:37:45 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268071

            Bug ID: 268071
           Summary: elftoolchain readelf: feature to force display
                    filename
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: tatsuki_makino@hotmail.com

Created attachment 238439
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=238439&action=edit
experimental patch

readelf displays file names when 2 or more files are given as arguments.
However, find exec and xargs are sometimes executed with 1 argument, so the
last file name may not be known.

for example,
find -s /usr/local/lib -type f -name lib\* -exec readelf -h {} +
find -s /usr/local/lib -type f -name lib\* -print0 | xargs -0 readelf -h

If the argument is limited to one, the filename is never known.

for example,
find -s /usr/local/lib -type f -name lib\* -exec readelf -h {} \;
find -s /usr/local/lib -type f -name lib\* -print0 | xargs -0 -L 1 readelf -h

A modification like the patch will force readelf to display the filename by
option.

How to use
find -s /usr/local/lib -type f -name lib\* -exec readelf --display-filename -h
{} \;
find -s /usr/local/lib -type f -name lib\* -print0 | xargs -0 -L 1 readelf
--display-filename -h

I sometimes want to run readelf on the pkg info -lq results :)
pkg info -l -q something | xargs readelf --display-filename -d -s

-- 
You are receiving this mail because:
You are the assignee for the bug.