Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 375571

Summary: sys-apps/portage-2.2.0_alpha45: --update --deep --newuse --noreplace propose downgrading of packages
Product: Portage Development Reporter: Cyprien Nicolas (fulax) <cyprien>
Component: Core - DependenciesAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: Normal    
Version: 2.2   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 373933    
Attachments: emerge -p -DunN gd --debug &> debug1.log; bzip2 debug1.log
emerge -p -DuN gd --debug &> debug2.log; bzip2

Description Cyprien Nicolas (fulax) 2011-07-18 15:28:24 UTC
I noticed that combining --newuse and --noreplace (together with --update --deep) makes portage try to find downgrades with different IUSE.

The portage(1) manual, for --noreplace, says: "Also note that this option takes precedence over options such as --newuse, preventing a package from being reinstalled even though the corresponding USE flag settings may have changed."

So either the documentation is not correct, of the portage behavior is not.


$ emerge -p -DunN gd

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     UD ] app-text/ghostscript-gpl-9.01 [9.02] USE="X cups gtk idn -bindist -djvu -jpeg2k (-dbus%*)" LINGUAS="-ja -ko -zh_CN -zh_TW" 0 kB

$ emerge -p -DuN gd

These are the packages that would be merged, in order:

Calculating dependencies... done!

Total: 0 packages, Size of downloads: 0 kb


# emerge --info --ignore-default-opts sys-apps/portage
Portage 2.2.0_alpha45 (default/linux/x86/10.0/desktop, gcc-4.5.2, glibc-2.13-r4, 2.6.39-gentoo-r2 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-2.6.39-gentoo-r2-x86_64-Intel-R-_Xeon-R-_CPU_5120_@_1.86GHz-with-gentoo-2.0.3
Timestamp of tree: Mon, 18 Jul 2011 08:30:01 +0000
app-shells/bash:          4.2_p10
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2, 3.1.3-r1, 3.2
dev-util/cmake:           2.8.5
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.10.3, 1.11.1-r1
sys-devel/binutils:       2.21.1
sys-devel/gcc:            4.5.2
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.38 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo lisp emacs mozilla sita fulax
Installed sets: 
ACCEPT_KEYWORDS="x86 ~x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /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="-O2 -march=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--verbose"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_IE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
LINGUAS="en"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-9"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/lisp /var/lib/layman/emacs /var/lib/layman/mozilla /usr/local/portage /home/cnicolas/gentoo/dev/fulax-gentoo-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa bash-completion berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gdu gif gpm gtk iconv idn ipv6 jpeg lcms ldap libnotify mad mng modules mp3 mp4 mpeg mudflap ncurses network-cron nls nptl nptlonly ogg opengl openmp pam pango pcre pdf perl png policykit ppds pppd python qt3support qt4 readline sdl session spell ssl startup-notification svg sysfs tcpd threads tiff truetype udev unicode usb vorbis x264 x86 xcb xft xinerama xml xorg xulrunner xv xvid zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="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:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

sys-apps/portage-2.2.0_alpha45 was built with the following:
USE="(ipc) less python3 -build -doc -epydoc -python2 (-selinux)" LINGUAS="-pl"
Comment 1 Zac Medico gentoo-dev 2011-07-18 18:31:01 UTC
(In reply to comment #0)
> I noticed that combining --newuse and --noreplace (together with --update
> --deep) makes portage try to find downgrades with different IUSE.
> 
> The portage(1) manual, for --noreplace, says: "Also note that this option takes
> precedence over options such as --newuse, preventing a package from being
> reinstalled even though the corresponding USE flag settings may have changed."

If a different version gets pulled in --noreplace and --newuse are irrelevant because the difference in version is an overriding factor.

> So either the documentation is not correct, of the portage behavior is not.

The documentation could be clarified to indicate that version changes are an overriding factor.

> $ emerge -p -DunN gd
> 
> These are the packages that would be merged, in order:
> 
> Calculating dependencies... done!
> [ebuild     UD ] app-text/ghostscript-gpl-9.01 [9.02] USE="X cups gtk idn
> -bindist -djvu -jpeg2k (-dbus%*)" LINGUAS="-ja -ko -zh_CN -zh_TW" 0 kB
> 
> $ emerge -p -DuN gd
> 
> These are the packages that would be merged, in order:
> 
> Calculating dependencies... done!
> 
> Total: 0 packages, Size of downloads: 0 kb

I don't understand why the ghostscript-gpl update was not pulled in by the second command. Please attach debug output for both commands:

  emerge -p -DunN gd --debug &> debug1.log
  emerge -p -DuN gd --debug &> debug2.log
Comment 2 Cyprien Nicolas (fulax) 2011-07-18 18:52:29 UTC
Created attachment 280319 [details]
emerge -p -DunN gd --debug &> debug1.log; bzip2 debug1.log
Comment 3 Cyprien Nicolas (fulax) 2011-07-18 18:54:22 UTC
Created attachment 280321 [details]
emerge -p -DuN gd --debug &> debug2.log; bzip2
Comment 4 Zac Medico gentoo-dev 2011-07-19 00:43:29 UTC
This seems to be a strange interaction between --noreplace and --newuse. Since you have ghostscript-gpl-9.02 installed, --noreplace causes the corresponding unbuilt ebuild of the same version to be rejected, and then ghostscript-gpl-9.01 gets pulled in to satisfy the dependency instead.

I'm not sure if this is worth "fixing". Maybe we should simply deprecate the --noreplace option or make it an alias for --selective. The --selective option has a similar effect, but without the extra logic that makes --noreplace give strange results in this case.
Comment 5 Zac Medico gentoo-dev 2011-07-19 00:53:09 UTC
(In reply to comment #4)
> I'm not sure if this is worth "fixing". Maybe we should simply deprecate the
> --noreplace option or make it an alias for --selective.

I suppose we could try to make --noreplace avoid downgrades, but it doesn't seem worth supporting. I'd rather just simplify things by removing the version-related logic and making --noreplace an alias for --selective.
Comment 6 Cyprien Nicolas (fulax) 2011-07-19 06:16:25 UTC
(In reply to comment #4)
> This seems to be a strange interaction between --noreplace and --newuse. Since
> you have ghostscript-gpl-9.02 installed, --noreplace causes the corresponding
> unbuilt ebuild of the same version to be rejected, and then
> ghostscript-gpl-9.01 gets pulled in to satisfy the dependency instead.

--noreplace is supposed to only apply to packages given on the command-line, not dependencies. As you said that ghostscript-gpl-9.02 is skipped because of --noreplace, now I'm sure I hit a bug here.

It happens also with --changed-use instead of --newuse.

> I'm not sure if this is worth "fixing". Maybe we should simply deprecate the
> --noreplace option or make it an alias for --selective. The --selective option
> has a similar effect, but without the extra logic that makes --noreplace give
> strange results in this case.

Sounds safe, if this extra logic offers no benefits.

Another possibility could be to keep the current logic of --noreplace into something like --reinstall=no, and make --noreplace as an alias for --selective, as you said.
Comment 7 Zac Medico gentoo-dev 2011-07-19 08:00:25 UTC
(In reply to comment #6)
> --noreplace is supposed to only apply to packages given on the command-line,
> not dependencies. 

If we only applied the logic for atoms given on the command-line, people will still be able to trigger strange behavior that's worthy of bug reports. I'd much rather remove the strange logic and be done with it.

> Sounds safe, if this extra logic offers no benefits.
> 
> Another possibility could be to keep the current logic of --noreplace into
> something like --reinstall=no, and make --noreplace as an alias for
> --selective, as you said.

I don't want to rename it because that still leaves an avenue for future bug reports about the strange behavior.
Comment 8 Zac Medico gentoo-dev 2011-07-19 08:40:06 UTC
This makes --noreplace identical to --selective:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=72f83d8078da7aab7be9236b86be1526c15a4185
Comment 9 Zac Medico gentoo-dev 2011-07-19 22:14:22 UTC
This is fixed in 2.1.10.7 and 2.2.0_alpha46.