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

Bug 200313

Summary: portage does not handle broken ebuilds nicely
Product: Portage Development Reporter: Harald van Dijk (RETIRED) <truedfx>
Component: UnclassifiedAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: High    
Version: 2.1   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 200044    

Description Harald van Dijk (RETIRED) gentoo-dev 2007-11-25 18:58:31 UTC
# cat test-1.0.ebuild
KEYWORDS="~x86"
SLOT="0"
IUSE="test"
src_install() {
        echo ${$PV}
        dodir /test
}
# emerge test
Calculating dependencies... done!
>>> Verifying ebuild Manifests...

>>> Emerging (1 of 1) test/test-1.0 to /
 * checking ebuild checksums ;-) ...                                                                                   [ ok ]
 * checking auxfile checksums ;-) ...                                                                                  [ ok ]
 * checking miscfile checksums ;-) ...                                                                                 [ ok ]
>>> Unpacking source...
>>> Source unpacked.
>>> Compiling source in /var/tmp/portage/test/test-1.0/work ...
>>> Source compiled.
>>> Test phase [not enabled]: test/test-1.0

>>> Install test-1.0 into /var/tmp/portage/test/test-1.0/image/ category test
/var/tmp/portage/test/test-1.0/temp/environment: line 151: ${$PV}: bad substitution
!!! WARNING: Expected SLOT='0', got ''
* checking 0 files for package collisions
>>> Merging test/test-1.0 to /
 * Removing /var/www
>>> test/test-1.0 merged.
>>> Recording test/test in "world" favorites file...

>>> No packages selected for removal by clean
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.
 * GNU info directory index is up-to-date.

In this case, src_install aborted, but portage went on to install the package anyway, even though the installation was incomplete.

emerge --info:
Portage 2.1.4_rc3 (default-linux/x86/no-nptl, gcc-4.2.2, glibc-2.5-r4, 2.6.23-gentoo-r2 i686)
=================================================================
System uname: 2.6.23-gentoo-r2 i686 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+
Timestamp of tree: Sun, 25 Nov 2007 14:30:03 +0000
app-shells/bash:     3.2_p17-r1
dev-lang/python:     2.5.1-r4
sys-apps/baselayout: 2.0.0_rc6
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.23-r2
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -g"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.9/env /usr/kde/3.9/share/config /usr/kde/3.9/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo /etc/t
exmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=athlon64 -O2 -pipe -g"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FEATURES="assume-digests autopatch collision-protect cvs distlocks installsources metadata-transfer multilib-strict notitles
parallel-fetch sandbox sfperms sign splitdebug strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
INSTALL_MASK="/var/www"
LANG="en_GB.UTF-8"
LDFLAGS="-Xlinker --as-needed"
LINGUAS="*"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after
--stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/etc/portage/overlay /etc/portage/overlay/kde4 /var/cvs/gentoo-x86"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac accessibility acpi akode alsa bidi bindist bitmap-fonts boost bzip2 cddb cdparanoia chm cjk cli
 clucene composite contrib cracklib crypt curl cvs cyrillic dbus disk-partition dri dvd dvdnav dvdread emerald ffmpeg filepic
ker firefox flac ftp games gif gmp gnustep gnutella gpg gtk hal iconv immqt inotify ipv6 isdnlog ithreads jpeg kde kdeenablef
inal kdehiddenvisibility kpathsea ldap mad mbox midi mmx mmxext mozdevelop mp3 mpeg mudflap music ncurses nls nocxx nptl nspl
ugin objc objc++ ogg openft opengl pam pango pascal pdf perl pg-intdatetime pic png pppd qt3support qt4 readline reflection r
tc samba science screen sdl session skins spl sql sse sse2 ssl subversion svg tcpd teletext tetex theora threads toolkit-scro
ll-bars truetype truetype-fonts type1-fonts unicode urandom v4l v4l2 vorbis x86 xcomposite xim xml xorg zlib" ALSA_CARDS="ali
5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0
intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop
empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="
glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb nc
urses text" LINGUAS="*" USERLAND="GNU" VIDEO_CARDS="vesa"
Unset:  CPPFLAGS, CTARGET, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Zac Medico gentoo-dev 2007-11-25 22:07:49 UTC
Aside from using a modified version of bash or some other shell implementation, I'm not sure if this can be fixed. For example, doing this in ebuild.sh doesn't seem to help:

src_compile || die "src_compile failed"

Apparently the shell exits with status 0 before the die call is even reached! Maybe that's a bug in bash that we should report upstream.

Even if checking the return value of the ebuild phase does help in a new version of bash, we might have to do an EAPI bump if we want to force all ebuild phases to return 0 on success.
Comment 2 Zac Medico gentoo-dev 2007-11-26 12:17:11 UTC
Here is how it's now fixed in svn:

We use a EBUILD_EXIT_STATUS_FILE environment variable
to specify a file that the shell code is supposed to
create when it exits in a normal manner. If the file
does not get created like it's supposed to be then we
can conclude that the shell has exited in some
unexpected way.
Comment 3 Harald van Dijk (RETIRED) gentoo-dev 2007-11-26 19:49:25 UTC
Thanks. This seems pretty similar to the way ebuild(1) behaves when passing all commands separately:

ebuild /etc/portage/overlay/test/test/test-1.0.ebuild clean setup unpack compile install qmerge
 * checking ebuild checksums ;-) ...                                                                                   [ ok ]
 * checking auxfile checksums ;-) ...                                                                                  [ ok ]
 * checking miscfile checksums ;-) ...                                                                                 [ ok ]
>>> Unpacking source...
>>> Source unpacked.
 * checking ebuild checksums ;-) ...                                                                                   [ ok ]
 * checking auxfile checksums ;-) ...                                                                                  [ ok ]
 * checking miscfile checksums ;-) ...                                                                                 [ ok ]
>>> Compiling source in /var/tmp/portage/test/test-1.0/work ...
>>> Source compiled.
 * checking ebuild checksums ;-) ...                                                                                   [ ok ]
 * checking auxfile checksums ;-) ...                                                                                  [ ok ]
 * checking miscfile checksums ;-) ...                                                                                 [ ok ]

>>> Install test-1.0 into /var/tmp/portage/test/test-1.0/image/ category test
/var/tmp/portage/test/test-1.0/temp/environment: line 165: ${$PV}: bad substitution
 * checking ebuild checksums ;-) ...                                                                                   [ ok ]
 * checking auxfile checksums ;-) ...                                                                                  [ ok ]
 * checking miscfile checksums ;-) ...                                                                                 [ ok ]
!!! mydo=qmerge, but the install phase has not been run

Since .installed has not been created, ebuild won't merge.
Comment 4 Zac Medico gentoo-dev 2007-11-28 11:11:33 UTC
This has been released in portage-2.1.4_rc4.