Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 111505 - subshells and pipelines in ebuild.sh
Summary: subshells and pipelines in ebuild.sh
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-04 13:55 UTC by Emil Beinroth
Modified: 2006-05-02 06:23 UTC (History)
0 users

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


Attachments
Move into subshell (ebuild.sh-subshell.patch,2.19 KB, patch)
2005-11-04 14:37 UTC, Emil Beinroth
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emil Beinroth 2005-11-04 13:55:01 UTC
1147     local count=0
    1148     find "${D}/" -user  portage | while read file; do
    1149         count=$(( $count + 1 ))
    1150         if [ -L "${file}" ]; then
    1151             lchown ${PORTAGE_INST_UID} "${file}"
    1152         else
    1153             s=$(stat_perms "$file")
    1154             if [ -z "${s}" ]; then
    1155                 ewarn "failed stat_perm'ing $file.  User intervention
during install isn't wise..."
    1156                 continue
    1157             fi
    1158             chown ${PORTAGE_INST_UID} "$file"
    1159             chmod "$s" "$file"
    1160         fi
    1161     done
    1162     if (( $count > 0 )); then
    1163         ewarn "$count files were installed with user portage!"
    1164     fi

$count will always be 0 because the while-stuff is executed in a subshell.
There is another find .. | while just below this one .. same problem.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.




Portage 2.0.53_rc7 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r3,
2.6.12-gentoo-r10 i686)
=================================================================
System uname: 2.6.12-gentoo-r10 i686 AMD Athlon(tm) XP 2600+
Gentoo Base System version 1.12.0_pre9
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [enabled]
dev-lang/python:     2.3.5, 2.4.2
sys-apps/sandbox:    1.2.13
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control /var/www/"
CONFIG_PROTECT_MASK="/etc/gconf /etc/init.d/ /etc/terminfo /etc/texmf/web2c
/etc/env.d"
CXXFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/local/portage/distfiles"
FEATURES="autoconfig ccache distlocks noclean parallel-fetch sandbox sfperms
strict titles userpriv"
GENTOO_MIRRORS=" http://linux.rz.ruhr-uni-bochum.de/gentoo-mirror
http://www.ibiblio.org/pub/Linux/distributions/gentoo "
LC_ALL="en_US.utf8"
MAKEOPTS="-j2"
PKGDIR="/usr/local/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/local /usr/local/portage/eix1
/usr/local/portage/eix2 /usr/local/portage/gentopia"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="x86 3dnow X aac alsa apm attr audiofile avi bash-completion bitmap-fonts
buffysize cdr chroot crypt cscope cups curl dba directfb disablexmb divx4linux
dts dvd dvdr dvdread emboss encode fbcon firefox flac font-server foomaticdb gd
gdbm gimpprint gnome gnutls gpm gstreamer gtk gtk2 guile hal hyriand id3
imagemagick imap imlib imlib2 ithreads java javascript jpeg kde kdeenablefinal
kdexdeltas lame libg++ libwww lm_sensors lynxkeymap mad maildir matroska mbox
mikmod mime mmx mozdevelop moznocompose moznoirc moznomail mozsvg mp3 mp4live
mpeg ncurses nfs nntp nptl nptlonly nsplugin offensive ogg oggvorbis opengl oss
pam pcre pdflib perl png ppds python qt quicktime readline reiserfs samba sasl
sdl sensord slang smime sox sqlite sse ssl svg svga tabs tcpd tetex threads tiff
truetype truetype-fonts type1-fonts udev unicode userlocales utf8 vimi vorbis
win32codecs xine xml xml2 xosd xrandr xv xvid zlib userland_GNU kernel_linux
elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LDFLAGS, LINGUAS
Comment 1 solar (RETIRED) gentoo-dev 2005-11-04 14:13:30 UTC
- find "${D}/" -user  portage | while read file; do
+ for file in $(find "${D}/" -user  portage); do
Comment 2 Harald van Dijk (RETIRED) gentoo-dev 2005-11-04 14:24:27 UTC
There are ebuilds which install files containing spaces, and there are probably
ebuilds which install too many files to be handled at once. How about moving the
final check into the subshell -

-       find "${D}/" -user  portage | while read file; do
+       find "${D}/" -user  portage | ( while read file; do
...
        done
        if (( $count > 0 )); then
                ewarn "$count files were installed with user portage!"
-       fi
+       fi )

except properly formatted?
Comment 3 Emil Beinroth 2005-11-04 14:37:46 UTC
Created attachment 72136 [details, diff]
Move into subshell

That would be my suggestions as well.
Comment 4 Simon Stelling (RETIRED) gentoo-dev 2006-05-02 06:23:12 UTC
since this bug has been opened, the code has changed a lot. it doesn't count anything anymore, so this can be closed.