Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 54652 - binary QA interceptors are never defined/executed.
Summary: binary QA interceptors are never defined/executed.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 56408
Blocks:
  Show dependency tree
 
Reported: 2004-06-21 08:19 UTC by Brian Harring (RETIRED)
Modified: 2004-08-11 11:26 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Harring (RETIRED) gentoo-dev 2004-06-21 08:19:52 UTC
This one's pretty straightforward-
current ebuild.sh as of .51_pre11

if [ "${EBUILD_PHASE}" == "depend" ]; then
function grep() {
..blah...
}
function gcc() {
..blah..
}
fi

You get the jist- if during the depend phase, we define QA interceptors.
The problem is, that EBUILD_PHASE isn't defined at that point- it's defined *way* down the line.
So, unless ebuild.sh DEPEND is ran twice, reusing the exported environment the second time, all of the QA interceptors are *never* used.

If this is intentional, might as well remove the interceptors.  If not, I suggest using this instead

for BIN in java-config python-config gcc perl grep sed python; do
src="function ${BIN}() {
[ \"\${EBUILD_PHASE}\" == \"depend\" ] && echo \"QA Notice: ${BIN} in global scope: \${CATEGORY}/\$PF\" >&2
local bin_path
bin_path=\`type -pf ${BIN}\`
if [ \$? != 0 ]; then
        echo \"missing ${BIN}\" >&2
        return 127
else
        \$bin_path \"\$*\"
        return \$?
fi
}";
eval "$src" || die "error creating QA interceptor ${BIN}"
done

It's mildly ugly, but it centralizes all QA interceptors to one correct definition.
As to why I'm explicitly testing the return of type, see bug #54576 ; the current attempt at outputting "blar is missing" is wrong.  My definition above does it correctly.

Also, note type -pf, rather then type -p.  If you defined a function named grep, then performed type -p grep, bash notices the function, and doesn't return anything.

This affects portage-2.0.50_pre10/11, and likely extends a bit further back.
Comment 1 Brian Harring (RETIRED) gentoo-dev 2004-06-21 08:22:02 UTC
doh, never stated the fix for QA interceptors being defined/executed-
If you're after getting the QA interceptors turned on just remove the 
if [ "$EBUILD_PHASE" ==  "depend" ] check, or move EBUILD_PHASE's definition to the top of ebuild.sh.
Comment 2 Brian Harring (RETIRED) gentoo-dev 2004-07-13 11:19:05 UTC
pre13's bin interceptor's are still broke.
gcc() {
[ "$EBUILD_PHASE" == "depend" ] && complain
`type -p gcc || echo "missing.gcc"` "$@"
}

isn't valid.  type -p will find the function first, and block the fullpath of gcc from being used.
use
`type -fp gcc || echo "missing.gcc"` "$@"

This still is broke imo; it's not very useful to users if they end up getting

bash: missing.gcc: command not found
Comment 3 Brian Harring (RETIRED) gentoo-dev 2004-08-11 11:26:46 UTC
I re-enable the QA interceptors somewhere around pre14.
Either way, they're back on now.