[cairo-bugs] [Bug 34012] New: check-plt.sh doesn't correctly detect the absence of readelf

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Feb 7 16:51:16 PST 2011


https://bugs.freedesktop.org/show_bug.cgi?id=34012

           Summary: check-plt.sh doesn't correctly detect the absence of
                    readelf
           Product: cairo
           Version: 1.10.2
          Platform: Other
        OS/Version: Solaris
            Status: NEW
          Severity: minor
          Priority: medium
         Component: general
        AssignedTo: cworth at cworth.org
        ReportedBy: Tim.Mooney at ndsu.edu
         QAContact: cairo-bugs at cairographics.org


x86_64-sun-solaris2.10, Solaris 10u6 (not OpenSolaris)

Although the src/check-plt.sh tries to detect whether readelf is available, it
uses the "which" command to do so, and in so doing relies on the semantics of
the Linux "which" command.  This will fail if "which" has been aliased to
something else (like "builtin type -all" for bash), or if "which" is what POSIX
systems typically have -- a csh shell script that only really works for people
that use Csh.

There are a couple of options:

1) use "command -v", which is apparently what POSIX specifies instead of the
"which" command.

2) Just try execute the command, and test the return value for 127, which is
what it should be for "command not found":

    readelf /bin/sh >/dev/null 2>&1
    if test $? -eq 127 ; then
        :
    else
        echo "'readelf' not found; skipping test"
        exit 0
    fi

3) search the PATH for a readelf, and exit if none is found:

    OLD_IFS="$IFS"
    IFS=":"

    for d in $PATH
    do
        #echo "Checking $d for readelf..."
        if test -x $d/readelf ; then
           readelf=$d/readelf
            break;
        fi
    done
    IFS="$OLD_IFS"

    if test X"$readelf" != X""; then
        :
    else
        echo "'readelf' not found; skipping test"
        exit 0
    fi


I'll happily provide a patch for any of these, if you're willing to accept one
of them as a suitable change.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the cairo-bugs mailing list