pkgcore / pkgcheck

pkgcore-based QA utility for ebuild repos
https://pkgcore.github.io/pkgcheck
BSD 3-Clause "New" or "Revised" License
34 stars 29 forks source link

UnusedInherits false positive in >=wine-vanilla-8.13 #612

Closed ionenwks closed 9 months ago

ionenwks commented 11 months ago

Reporting for the record, but may not be worth fixing.

aka with gentoo.git at cbafd7b7750f162971e18fd80474868f05ce3825 in app-emulation/wine-vanilla (or staging):

$ pkgcheck scan
app-emulation/wine-vanilla
  UnusedInherits: version 8.13: unused eclasses: multilib, wrapper
  UnusedInherits: version 9999: unused eclasses: multilib, wrapper

But:

$ grep -nE '(make_wrapper|multilib_toolchain_setup)' wine-vanilla-8.13.ebuild
329:            multilib_toolchain_setup x86
370:        make_wrapper "${bin##*/}-${P#wine-}" "${bin#"${ED}"}"

Goes away if this earlier horrible block is removed:

CROSSCFLAGS="${CROSSCFLAGS:-$(
    filter-flags '-fstack-protector*' #870136
    filter-flags '-mfunction-return=thunk*' #878849

    # -mavx with mingw-gcc has a history of obscure issues and
    # disabling is seen as safer, e.g. `WINEARCH=win32 winecfg`
    # crashes with -march=skylake >=wine-8.10, similar issues with
    # znver4: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110273
    use custom-cflags || append-cflags -mno-avx

    CC=${mingwcc} test-flags-CC ${CFLAGS:--O2}
)}"

CROSSLDFLAGS="${CROSSLDFLAGS:-$(
    filter-flags '-fuse-ld=*'

    CC=${mingwcc} test-flags-CCLD ${LDFLAGS}
)}"

Not looked further but I have little doubt that it's tree-sitter-bash being confused by this, vim is not able to highlight this stuff properly either.

Could always use temporary variables to avoid triggering it. For now there's a note in the ebuild so these aren't removed when they shouldn't.

arthurzam commented 11 months ago

Yes, you were exactly right. If you want to quickly verify tree-sitter parsing online, you can use this. And as you said, removing this magic code (what does it even do?), and also that line does issues:

if [[ $(LC_ALL=C $(tc-getCC) ${LDFLAGS} -Wl,--version 2>/dev/null) != @(LLD|GNU\ ld)* ]]

After removing those 2 hard blocks, it now parsed correctly the ebuild.

ionenwks commented 9 months ago

Well, just tried again with pkgcheck-0.10.25-r2 which uses a tree-sitter-bash 2023-09-21 snapshot and, as expected, these false positives are gone. Think this can be considered fixed.

Thanks to everyone involved.

arthurzam commented 9 months ago

I still need to update the bundled C code to use the newest version (doesn't affect ::gentoo ebuilds, since they use system version).