[Bug 294732] Mk/Scripts/qa.sh: Fix for FreeBSD-15.0

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 23 Apr 2026 17:01:36 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294732

            Bug ID: 294732
           Summary: Mk/Scripts/qa.sh: Fix for FreeBSD-15.0
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: svysh.fbsd@gmail.com
                CC: brooks@FreeBSD.org, cy@FreeBSD.org
                CC: brooks@FreeBSD.org, cy@FreeBSD.org

- fix stripped() function so, that is works with a new readelf (which is a llvm
variant) from 15.0 base, and with an old readelf (which is a GNU variant) from
14.4 or 13.5 base.

Mk/Scripts/qa.sh script in FreeBSD-15.0 is broken. 
"make stage-qa" silently ignores non-stripped so objects.

FreeBSD-15.0 has in base a new llvm variant of /usr/bin/readelf. It differs
from the old GNU variant of /usr/bin/readelf in FreeBSD-14.4 or 13.5 at least
with these:

1) Argument separator "--" is not allowed for new readelf and triggers an
error;
2) When given a list of files to read, and some file triggers an error (e.g.
the file is not an ELF object), new readelf immediately terminates work and
does not proceed with the rest of files. This behavior can not be altered with
hacks like "|| :" or "2>/dev/null".

This violates work of stripped() function in Mk/Scripts/qa.sh script in
FreeBSD-15 so that "make stage-qa" silently ignores non-stripped ELF objects.
Silence is caused by suppressing of ALL error messages from readelf within this
function.

Proposed here is a working version of stripped() function which is easy both to
understand and maintain. It handles filenames with spaces or with leading
minus. To be on a safe side with possible future evolution, it's works has been
tested with both llvm-readelf (from base 15.0 system or from port devel/llvm*)
and with GNU-readelf (from base 14.4 system, base 13.5 system, or from port
devel/binutils).

Tested with poudriere jails as follows:

1)
cd /usr/ports/security/p5-Crypt-Argon2
make && make stage-qa

Should report no issues with non-stripped objects.

2) Repeate step 1 with lines commented out in Makefile:
#post-install:
#       ${STRIP_CMD}
${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}/auto/Crypt/Argon2/Argon2.so

Should report an issue with a non-stripped object.

3) Repeate steps 1 and 2 for readelf from base in poudriere jails 
        with FreeBSD 15.0, 14.4, 13.5.
4) Add devel/binutils (which includes its own readelf) to DEPENDS of Makefile,
and edit Mk/Scripts/qa.sh so that it uses readelf from ports:
RE="/usr/local/bin/readelf"
Repeate steps 1 and 2 for readelf from ports in poudriere jails 
        with FreeBSD 15.0, 14.4, 13.5.
5) Repeate step 4 with devel/llvm19 (which includes its own readelf) instead of
devel/binutils (need to remove it). This last step was not perfomed.

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