When you attempt to get pkg-size for a metapackage (an empty package that only has dependencies a-la "kde-base/kde-3.1.2", "media-sound/mad-0.15.0b", ...), pkg-size will return a bogus value based on the current working directory. Reproducible: Always Steps to Reproduce: 1. Install an empty metapackage (several exist, kde, gnome or xfce4 should be already installed in most cases). 2. Call pkg-size on the installed package. Actual Results: I was trying to see where space was wasted the most so I did a script to get all package sizes and sort them. Turns out I was doing this from /root so all metapackages came out as the biggest packages (considering /root/.ccache is quite large). Expected Results: Obviously, those packages should return a size of 0. Looked at pkg-size I see the problem is with the pipe to "xargs du -scb"... this works fine as long as stdin has content, but if stdin is empty (try "cat /dev/null | xargs du -scb") it will default as if called on ".". Just need to check for non-zero contents first. I'm including a patch that does this. salamander root # emerge info Portage 2.0.49-r21 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r9, 2.4.22-gentoo-r5) ================================================================= System uname: 2.4.22-gentoo-r5 i686 Pentium II (Deschutes) Gentoo Base System version 1.4.3.10 distcc 2.11.1 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled] ccache version 2.3 [enabled] ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-mcpu=pentium2 -O2 -pipe" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3/share/config /usr/share/config /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-mcpu=pentium2 -O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache distcc sandbox" GENTOO_MIRRORS="ftp://gentoo.noved.org/ http://gentoo.noved.org/ ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo http://www.mirror.ac.uk/sites/www.ibiblio.org/gentoo/" MAKEOPTS="-j6" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage" USE="3ds X aalib alsa apm arts artswrappersuid avi berkdb bonobo cdr cjk crypt cscope cups dga doc dvb encode esd faad fbcon foomaticdb gatos gdbm ggi gif gnome gpm gstreamer gtk gtk2 gtkhtml guile imlib java jpeg justify kde kerberos lcms ldap libg++ libwww mad mbox mikmod mmx mng motif mozilla moznoirc mozsvg mpeg nas ncurses nls objc oggvorbis openal opengl oss pam pdflib perl pic png ppds python qt quicktime radeon readline ruby samba sdk sdl slang slp spell ssl svga tcltk tcpd tetex tiff truetype vim-with-x wmf x86 xml xml2 xmms xv zlib"
Created attachment 24745 [details, diff] patch to pkg-size
Created attachment 24897 [details, diff] refined patch to pkg-size First patch was silly... xargs can be called with -r to do the exact same thing I was writing out in scripting... this patch just adds -r to the xargs call.
deprecated tool, use `equery size package` instead