Fix -- list_package not finding all deps.
authorSteve Youngs <steve@steveyoungs.com>
Tue, 22 Jun 2021 22:57:13 +0000 (08:57 +1000)
committerSteve Youngs <steve@steveyoungs.com>
Tue, 22 Jun 2021 22:57:13 +0000 (08:57 +1000)
If a binary is built as a "Position Independent Executable" (-fPIC)
the dependency miner would fail because it wasn't testing for that
MIME type.  This change fixes that.

* usr/bin/list_package (categorise): Test executables against
'x-(pie-)?(executable|sharedlib)'

Signed-off-by: Steve Youngs <steve@steveyoungs.com>
usr/bin/list_package

index 51ef12d..c6736cb 100755 (executable)
@@ -234,7 +234,7 @@ categorise()
            if [[ -f ${PKGASSETS[$i]} && -x ${PKGASSETS[$i]} ]]; then
                UBINS[$U]=$(basename ${PKGASSETS[$i]})
                # add to the list of all execs (not scripts)
-               if [[ $(file -i ${PKGASSETS[$i]}) =~ x-executable ]]; then
+               if [[ $(file -i ${PKGASSETS[$i]}) =~ x-(pie-)?(executable|sharedlib) ]]; then
                    AEXEC[$A]=${PKGASSETS[$i]}
                    A=$((($A + 1)))
                fi
@@ -248,7 +248,7 @@ categorise()
                    -x ${PKGASSETS[$i]} ]]; then
            EBINS[$E]=${PKGASSETS[$i]}
            # add to the list of all execs (not scripts)
-           if [[ $(file -i ${EBINS[$E]}) =~ x-(executable|sharedlib) ]]; then
+           if [[ $(file -i ${EBINS[$E]}) =~ x-(pie-)?(executable|sharedlib) ]]; then
                AEXEC[$A]=${EBINS[$E]}
                A=$((($A + 1)))
            fi