On 12/30/17 9:13 AM, Anthony G. Basile wrote:
> On 12/30/17 9:08 AM, Michael Orlitzky wrote:
>> On 12/30/2017 07:22 AM, Anthony G. Basile wrote:
>>> use_if_iuse !nopie && return 0
>>
>> Does this work? The "use" function supports negation (undocumented, but
>> it's in the PMS), but I don't think use_if_iuse does.
>>
> 
> Okay I'll read the code and test.  You're right that I just assumed it
> worked liked "use" wrt negation so the semantics need to be checked.
> 
> Thanks for looking this over carefully.
> 

It looks like it would not work as expected because eutils.eclass has

in_iuse() {
    debug-print-function ${FUNCNAME} "${@}"
    [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()"

    local flag=${1}
    local liuse=( ${IUSE} )

    has "${flag}" "${liuse[@]#[+-]}"
}

use_if_iuse() {
    in_iuse $1 || return 1
    use $1
}

So $1 in use_if_iuse binds to "!nopie" and then in in_iuse again to
"!nopie" which then messes up the has line, looking for a flag named
"!nopie" in IUSE which will always be true.

I'll change that line to

use_if_iuse nopie || return 0

Grepping the tree, I see only instances of

if ! use_if_iuse X ...

which is good.


-- 
Anthony G. Basile, Ph.D.
Gentoo Linux Developer [Hardened]
E-Mail    : bluen...@gentoo.org
GnuPG FP  : 1FED FAD9 D82C 52A5 3BAB  DC79 9384 FA6E F52D 4BBA
GnuPG ID  : F52D4BBA

Reply via email to