Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 734618 - emerge exits with zero '0' status on failure if update flags (-u or -U) are used
Summary: emerge exits with zero '0' status on failure if update flags (-u or -U) are used
Status: RESOLVED INVALID
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-29 21:08 UTC by Angelo Babudro
Modified: 2020-07-29 21:30 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 Angelo Babudro 2020-07-29 21:08:54 UTC
Trying to install an update to a package failed by the exit code indicated success (i.e., zero).  I tried running 'emerge' alone and got an exit code of one (1).

I experimented with flags and found that when I used the -u or -U flags I always got a result of zero in spite of the failure.

In my case, this makes a script that calls 'emerge' fail to properly determine the result of the attempted update.


Reproducible: Always

Steps to Reproduce:
1.  Find an updated package that will not emerge for some reason.  The problem does not arise with a package that has never been installed (such as a masked package).
2.  Do:  emerge -av <atom>; echo $?
3.  Do:  emerge -puv <atom>; echo $?

You can also use other flags to duplicate the issue, such as -pv and -puv, or nothing at all versus -u by itself.  The key to triggering the issue is the -u (or -U) flag.

I managed to duplicate the issue on a second server.
Actual Results:  
# LC_ALL=C emerge -av dev-libs/apr-util; echo $?

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

Calculating dependencies... done!
[ebuild     U  ] dev-libs/apr-util-1.6.1-r6:1::gentoo [1.6.1-r3:1::gentoo] USE="gdbm* mysql postgres sqlite static-libs -berkdb -doc -ldap -libre
ssl -nss -odbc -openssl" 0 KiB

Total: 1 package (1 upgrade), Size of downloads: 0 KiB

!!! Multiple package instances within a single package slot have been pulled
!!! into the dependency graph, resulting in a slot conflict:

dev-libs/apr-util:1
                                                                                                                                                 
  (dev-libs/apr-util-1.6.1-r6:1/1::gentoo, ebuild scheduled for merge) USE="gdbm mysql postgres sqlite static-libs -berkdb -doc -ldap -libressl -
nss -odbc -openssl" ABI_X86="(64)" pulled in by
    dev-libs/apr-util (Argument)

  (dev-libs/apr-util-1.6.1-r3:1/1::gentoo, installed) USE="mysql postgres sqlite static-libs -berkdb -doc -gdbm -ldap -libressl -nss -odbc -opens
sl" ABI_X86="(64)" pulled in by
    =dev-libs/apr-util-1*:1/1=[-gdbm] required by (www-servers/apache-2.4.43:2/2::gentoo, installed) USE="... (details not significant)

    =dev-libs/apr-util-1*:=[gdbm=,ldap?] required by (www-servers/apache-2.4.43:2/2::gentoo, installed) USE="... (details not significant)

It may be possible to solve this problem by using package.mask to
prevent one of those packages from being selected. However, it is also
possible that conflicting dependencies exist such that they are
impossible to satisfy simultaneously.  If such a conflict exists in
the dependencies of two different packages, then those packages can
not be installed simultaneously. You may want to try a larger value of
the --backtrack option, such as --backtrack=30, in order to see if
that will solve this conflict automatically.

For more information, see MASKED PACKAGES section in the emerge man
page or refer to the Gentoo Handbook.

1      (this is the expected exit code, since it failed)

-------------------------------------

Now try again adding the update flag:


# LC_ALL=C emerge -auv dev-libs/apr-util; echo $?

 * IMPORTANT: 2 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


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

Calculating dependencies... done!

Total: 0 packages, Size of downloads: 0 KiB

WARNING: One or more updates/rebuilds have been skipped due to a dependency conflict:

dev-libs/apr-util:1

  (dev-libs/apr-util-1.6.1-r6:1/1::gentoo, ebuild scheduled for merge) USE="gdbm mysql postgres sqlite static-libs -berkdb -doc -ldap -libressl -
nss -odbc -openssl" ABI_X86="(64)" conflicts with
    =dev-libs/apr-util-1*:=[-gdbm] required by (www-servers/apache-2.4.43:2/2::gentoo, installed) USE="... (details are not significant)
                            ^^^^^ 
    =dev-libs/apr-util-1*:1/1=[-gdbm] required by (www-servers/apache-2.4.43:2/2::gentoo, installed) USE="... (details not significant)
                               ^^^^^  


0      (exit code indicates it succeeded)


-----------------------------------

Finding a package that will not build as the above is not easy, but I have an old PHP 5.6 version on a server, so tried rebuilding that:


# emerge -av dev-lang/php:5.6; echo $?; emerge -auv dev-lang/php:5.6; echo $?

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

Calculating dependencies... done!

emerge: there are no ebuilds to satisfy "dev-lang/php:5.6".
1

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

Calculating dependencies... done!

Total: 0 packages, Size of downloads: 0 KiB

0


This second test may not be helpful because with the -u flag emerge did not complain that there were no ebuilds, and if that behaviour is correct (I don't know) then the exit code '0' with -u would be appropriate.

Expected Results:  
Exit code indicating failure (e.g., '1') regardless of update flag -u or -U.


Tried with and without 'sudo' -- same results.

emerge --info

Portage 2.3.103 (python 3.7.8-final-0, default/linux/amd64/17.1/hardened, gcc-9.3.0, glibc-2.30-r8, 5.7.6 x86_64)
=================================================================
System uname: Linux-5.7.6-x86_64-AMD_Ryzen_9_3900X_12-Core_Processor-with-gentoo-2.6
KiB Mem:   131898836 total,  29442072 free
KiB Swap:    4194300 total,   4193804 free
Timestamp of repository gentoo: Wed, 29 Jul 2020 14:30:01 +0000
Head commit of repository gentoo: 4cf1f945fb93db0b9e2eceeb4025cbc34caaa940
sh bash 5.0_p17
ld GNU ld (Gentoo 2.33.1 p2) 2.33.1
app-shells/bash:          5.0_p17::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18-r1::gentoo, 3.6.11-r2::gentoo, 3.7.8-r2::gentoo, 3.8.4-r1::gentoo
dev-util/cmake:           3.16.5::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.13.4-r2::gentoo, 1.15.1-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.33.1-r1::gentoo
sys-devel/gcc:            9.3.0::gentoo
sys-devel/gcc-config:     2.3::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.30-r8::gentoo
Repositories:

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

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=znver1"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.3/ext-active/ /etc/php/apache2-php7.4/ext-active/ /etc/php/cgi-php7.3/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cli-php7.3/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=znver1"
DISTDIR="/data/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH 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 -march=znver1"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=znver1"
GENTOO_MIRRORS="rsync://viviana/ rsync://mirrors.tera-byte.com/gentoo ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/"
LANG="en_GB.utf8"
LC_ALL="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_GB en"
MAKEOPTS="-j24"
PKGDIR="/data/binpkgs"
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="256-color X aac aalib acl alsa alsa-plugin amd64 ampache amr apache2 bluetooth bluray boot bzip2 cdda cddb cdparanoia clamdtop cli cover crossfade crypt cue cups curl dbus drm dts dvd elogind encode fax ffmpeg flac fontconfig fpm gd gdbm gimp gmp-autoupdate gnome-keyring gnutls gtk hardened highlight history http iconv icu id3tag imap iptables ipv6 jack jpeg kvm ladspa lame libnotify libtirpc lxc lzma lzo mad matroska minizip mng mp3 mpeg mpg123 multilib musicbrainz mysql mysqli ncurses network nfs nls nptl ogg opengl openmp opus pam pcntl pcre pdf pdo pie png policykit postgres printsupport pulseaudio python qemu qml qt5 readline scanner seccomp sftp shout sndfile split-usr sqlite ssl ssp static-libs svc svg taglib theora threads tiff truetype tty-helpers twolame udev udisks unicode usbredir vamp vim vim-syntax virt-network virtualbox vnc vorbis vpx wavpack widgets wma x264 xattr xml xscreensaver xtpax xvid xz zeroconf zlib" ABI_X86="64" ADA_TARGET="gnat_2018" 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 sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7" QEMU_SOFTMMU_TARGETS="aarch64 arm i386 m68k mips mips64 mips64el mipsel ppc ppc64 sh4 x86_64" QEMU_USER_TARGETS="aarch64 aarch64_be arm armeb ppc ppc64 ppc64abi32 ppc64le x86_64" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Angelo Babudro 2020-07-29 21:14:52 UTC
Pardon me:  In re-reading my report I see what I missed.  I focused on the package list and neglected to see that the error message was different with and without the -u.

So this is my error in interpreting the messages I was seeing.  I'm sorry about the bogus error report.  Please close and ignore this with my apology.
Comment 2 Zac Medico gentoo-dev 2020-07-29 21:30:06 UTC
(In reply to Angelo Babudro from comment #1)
> Pardon me:  In re-reading my report I see what I missed.  I focused on the
> package list and neglected to see that the error message was different with
> and without the -u.
> 
> So this is my error in interpreting the messages I was seeing.  I'm sorry
> about the bogus error report.  Please close and ignore this with my apology.

No problem.