Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 663848 - sys-apps/portage-2.3.46: USE="test" is enabled inconsistently for emerge -Du @world and emerge -1 <package>
Summary: sys-apps/portage-2.3.46: USE="test" is enabled inconsistently for emerge -Du ...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
Depends on:
Blocks: 912975 659322
  Show dependency tree
 
Reported: 2018-08-17 06:10 UTC by tka
Modified: 2023-08-24 20:28 UTC (History)
0 users

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


Attachments
config.regenerate: reset features USE (0001-config.regenerate-reset-features-USE-bug-663848.patch,1.80 KB, patch)
2018-08-17 11:30 UTC, Zac Medico
Details | Diff
config: initialize global features USE (bug 663848) (0001-config-initialize-global-features-USE-bug-663848.patch,1.94 KB, patch)
2018-08-17 17:02 UTC, Zac Medico
Details | Diff
config: default features USE for conditional RESTRICT (0001-config-default-features-USE-for-conditional-RESTRICT.patch,2.20 KB, patch)
2018-08-17 17:31 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tka 2018-08-17 06:10:39 UTC
emerge enables the test flag for packages if asked to update @world. However, asking emerge to update/rebuild a specific package yields a disabled test flag. Here is an example:

# emerge -Duvpq @world
[ebuild     U ] sys-devel/llvm-6.0.1-r1 [6.0.1] USE="libffi ncurses test xml -debug -doc -gold -libedit -xar" LLVM_TARGETS="BPF NVPTX (X86) -AArch64 -AMDGPU -ARM -Hexagon -Lanai -MSP430 -Mips -PowerPC -Sparc -SystemZ -XCore" 

# emerge -1pvq =sys-devel/llvm-6.0.1-r1
[ebuild     U ] sys-devel/llvm-6.0.1-r1 [6.0.1] USE="libffi ncurses xml -debug -doc -gold -libedit -test* -xar" LLVM_TARGETS="BPF NVPTX (X86) -AArch64 -AMDGPU -ARM -Hexagon -Lanai -MSP430 -Mips -PowerPC -Sparc -SystemZ -XCore" 

This may be related to bug 663278, since the llvm ebuild has RESTRICT="!test? ( test )" in it. But whatever is the intended value for the use flag test in that case, it should be consistent for both cases.

Reproducible: Always
Comment 1 tka 2018-08-17 06:11:16 UTC
# emerge --info =sys-devel/llvm-6.0.1-r1
Portage 2.3.46 (python 3.6.6-final-0, default/linux/amd64/17.0/no-multilib/hardened, gcc-7.3.0, glibc-2.27-r6, 4.18.1 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.18.1-x86_64-Intel-R-_Core-TM-_i7-3720QM_CPU_@_2.60GHz-with-gentoo-2.6
KiB Mem:    16387564 total,  13044704 free
KiB Swap:   17825788 total,  17825788 free
Timestamp of repository gentoo: Fri, 17 Aug 2018 05:00:01 +0000
Head commit of repository gentoo: 23a99667766a27b7d411d5159a1176b0ef82f174
sh bash 4.4_p23
ld GNU ld (Gentoo 2.31.1 p1) 2.31.1
app-shells/bash:          4.4_p23::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.6::gentoo
dev-util/cmake:           3.12.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.38.2::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.31.1::gentoo
sys-devel/gcc:            6.4.0-r1::gentoo, 7.3.0-r3::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.17::gentoo (virtual/os-headers)
sys-libs/glibc:           2.27-r6::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24

local
    location: /var/lib/portage-local/local
    masters: gentoo
    priority: 0

testing
    location: /var/lib/portage-local/testing
    masters: gentoo
    priority: 1

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -mtune=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs cgroup collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch preserve-libs protect-owned sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
LINGUAS=""
MAKEOPTS="-j8"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 acl acpi alsa amd64 avx bzip2 cairo caps cdda cddb cdparanoia crypt cups cxx dbus dri dts dvd fam ffmpeg fftw flac fontconfig gif gimp gmp gnutls gtk hardened iconv icu idn ipv6 jpeg lame lcms libnotify libtirpc lzma mad matroska mmap mmx mmxext mp3 mpeg ncurses networkmanager nptl ogg opengl openmp pam pcre pie png policykit ppds readline sasl sdl seccomp sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssp ssse3 startup-notification svg theora threads tiff truetype udev unicode upower vaapi vorbis wayland x264 xattr xcb xinerama xml xtpax xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon plan sheets stage words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx f16c mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="i965 intel nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Zac Medico gentoo-dev 2018-08-17 09:52:00 UTC
I can see that there's an issue with the evaluation of RESTRICT, where it evaluates incorrectly if the futures USE is supposed to contain "test" for the current package, but "test" was disabled for the previous package considered. For example, I can trigger it if I put ">=sys-devel/llvm-7 -test" in package.use, and enable FEATURES=test for sys-devel/llvm via package.env. The sys-devel/llvm-6.0.1-r1 package shows with USE="-test" inappropriately, because is considered sys-devel/llvm-7.0.9999 just before, with the package.use setting.
Comment 3 Zac Medico gentoo-dev 2018-08-17 11:30:31 UTC
Created attachment 543768 [details, diff]
config.regenerate: reset features USE

You can apply this patch by saving in as /etc/portage/patches/sys-apps/portage-2.3.46/663848.patch and rebuilding portage.
Comment 4 tka 2018-08-17 13:47:52 UTC
With that patch, test is enabled in both cases. Thanks.
Comment 5 tka 2018-08-17 14:48:38 UTC
Oh wait. Using emerge -Du with --newuse now behaves strange. Sometimes it tries to rebuild lots of packages with USE="-test" and other times it tries to pull in test dependencies for packages that have hard RESTRICT="-test" or selectively FEATURES="-test" through package.env.
Comment 6 Zac Medico gentoo-dev 2018-08-17 17:02:18 UTC
Created attachment 543778 [details, diff]
config: initialize global features USE (bug 663848)

(In reply to tka from comment #5)
> Oh wait. Using emerge -Du with --newuse now behaves strange. Sometimes it
> tries to rebuild lots of packages with USE="-test" and other times it tries
> to pull in test dependencies for packages that have hard RESTRICT="-test" or
> selectively FEATURES="-test" through package.env.

This new patch should correct that problem. Please test.
Comment 7 Zac Medico gentoo-dev 2018-08-17 17:31:10 UTC
Created attachment 543830 [details, diff]
config: default features USE for conditional RESTRICT

Updated to regenerate USE in the config constructor, so that it will have the correct value for the first conditional RESTRICT evaluation.
Comment 8 Zac Medico gentoo-dev 2018-08-17 18:10:16 UTC
Comment on attachment 543830 [details, diff]
config: default features USE for conditional RESTRICT

I've fixed another issue, please test with this patch:

https://github.com/gentoo/portage/pull/360.patch
Comment 9 tka 2018-08-17 18:13:29 UTC
Patch from comment #6 did not work. Will try comment #8 now.
Comment 10 tka 2018-08-17 19:02:10 UTC
(In reply to Zac Medico from comment #8)
> I've fixed another issue, please test with this patch:
> 
> https://github.com/gentoo/portage/pull/360.patch

Looks good now. The test flag is enabled in both cases from the description, and an update with --newuse does not try to disable it unreasonably for any packages.
Comment 11 Zac Medico gentoo-dev 2018-08-17 20:16:19 UTC
(In reply to tka from comment #10)
> Looks good now. The test flag is enabled in both cases from the description,
> and an update with --newuse does not try to disable it unreasonably for any
> packages.

Great, thanks for testing!

Patch posted for review:

https://archives.gentoo.org/gentoo-portage-dev/message/9cc34980c2761eee5436522904da4697
https://github.com/gentoo/portage/pull/360
Comment 12 Larry the Git Cow gentoo-dev 2018-08-17 22:35:23 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=ad607b8ecfad3e099cae508ff4d3b5b62cab969f

commit ad607b8ecfad3e099cae508ff4d3b5b62cab969f
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-08-17 11:08:21 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-08-17 20:12:32 +0000

    config: default features USE for conditional RESTRICT (bug 663848)
    
    Initialize default features USE state, and reset when appropriate,
    so that the "test" flag state is correct for evaluation of !test?
    conditionals in RESTRICT.
    
    Fixes: 45986341a80c ("Support !test? conditionals in RESTRICT (bug 663278)")
    Bug: https://bugs.gentoo.org/663848

 lib/portage/package/ebuild/config.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)