Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Nov 2020 18:23:24 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 251110] Mk/Scripts/qa.sh: stripped() can fail after pipefail was added; also misses the single file case
Message-ID:  <bug-251110-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D251110

            Bug ID: 251110
           Summary: Mk/Scripts/qa.sh: stripped() can fail after pipefail
                    was added; also misses the single file case
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: jcfyecrayz@liamekaens.com

Created attachment 219641
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D219641&action=
=3Dedit
[patch] fix qa.sh:stripped() - possible pipefail + single file issues (v1)

(1)
If there are any non-ELF files in the staging area, the stripped() test in
qa.sh can fail now (silently) after 'set -o pipefail' was added.  This occu=
rs
if readelf from the binutils port is in your path ahead of readelf in base
(tested on 11.x).  The former exits with a non-zero exit code if any input
files are not ELF files.

$ /usr/bin/readelf -S /dev/null || echo FAILED
readelf: elf_begin() failed: Invalid argument
$ /usr/local/bin/readelf -S /dev/null || echo FAILED
readelf: Error: '/dev/null' is not an ordinary file
FAILED

We could try to only feed in ELF files (which may have a slight speed
improvement because it avoids unecessary pipeline I/O or more likely might =
be
slower because of an extra test).

Or we could tweak the pipeline to all ignore readelf errors.

We could also specify /usr/bin/readelf, which relies on readelf in base nev=
er
changing course and returning non-zero exit code on errors.

Or we could do nothing because in most cases, /usr/bin/readelf will be found
first.

Finally, we could temporarily disable pipefail for stripped() (causing all =
find
+ readelf errors to be ignored).


(2)
Note also that stripped() test fails to work as intended if there is only a
single file because readelf -S does not print the 'File:' part unless there=
 are
multiple files (both versions of readelf behave the same here: base &
binutils).  That is, if there is a single file and it is not stripped, the
current implementation in stripped() misses it.  Easy fix: add /dev/null as=
 a
argument.


The attached patch specifies /usr/bin/readelf to fix (1) and adds /dev/null=
 to
fix (2) (and adds -- for safety in the very unlikely case any filenames sta=
rt
with -).

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-251110-7788>