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

Bug 27226

Summary: qpkg spews some of its code with a broken pipe error when you quit a multi-page list early
Product: Portage Development Reporter: Dan Foster <dsf>
Component: ToolsAssignee: Portage Tools Team <tools-portage>
Status: RESOLVED CANTFIX    
Severity: trivial    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Dan Foster 2003-08-24 08:56:22 UTC
If 'qpkg -I -v' output spans more than one page, and if you pipe it through more
or less, it spews out some of its code along with the expected broken pipe error.

May want to have it trap SIGPIPE and/or SIGCHLD to exit gracefully? (i.e. by
running 'trap' via bash early on in the qpkg script?) Or perhaps wrap these
commands around a subshell that redirects stderr to /dev/null?

Reproducible: Always
Steps to Reproduce:
1. qpkg -I -v must exceed a single page
2. $ qpkg -I -v | more
3. press 'q' to quit the pager before it has finished

Actual Results:  
/usr/bin/qpkg: line 520:  2726 Done                    if [ ! \( "${tcheck}" -o
"${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -gt
0 \) ]; then
    sed -e "s:-r[0-9]\+$::" -e "s:-[0-9][^-]*$::" | sort -k2 | uniq -f1;
else
    if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}"
-o "${mask}" -o ${verb} -lt 2 \) ]; then
        sort -k2 | uniq -f1;
    else
        cat;
    fi;
fi
      2727 Broken pipe             | sed -e "s:^iii
${X}/${X}:${BR}\1/${CY}\2${STAR}${NO}:" -e "s:^uuu
${X}/${X}:${BR}\1/${YL}\2${NO}:" -e "s:^vvv \(.*\)$:${BL}\1${NO}:" -e "s:^obj
::;s:^sym ::;s:^dir ::"



Expected Results:  
Ideally, no error message/spew upon quitting the pager early.

Portage 2.0.48-r5 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1)
=================================================================
System uname: 2.4.20-gentoo-r5 i686 Pentium III (Coppermine)
GENTOO_MIRRORS="ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo"
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config
/usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config
/usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR_OVERLAY=""
USE="x86 oss 3dnow apm avi crypt cups encode foomaticdb gif jpeg libg++ libwww
mad mikmod mmx mpeg ncurses nls pdflib png quicktime spell truetype xml2 xmms xv
zlib gdbm berkdb slang readline arts svga java sdl gpm perl python esd imlib
oggvorbis motif opengl mozilla ldap X qt kde tcpd pam ssl mbox -gnome -gtk -maildir"
COMPILER="gcc3"
CHOST="i686-pc-linux-gnu"AUTOCLEAN="yes"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
FEATURES="sandbox ccache"
CFLAGS="-mcpu=i686 -O3 -pipe"
CXXFLAGS="-mcpu=i686 -O3 -pipe"
ACCEPT_KEYWORDS="x86"
MAKEOPTS="-j2"
Comment 1 SpanKY gentoo-dev 2003-08-24 14:15:17 UTC
the fact that the code is spewed out is a 'feature' of bash ... bash is just showing 
the code that was run and was given the signal 
Comment 2 Marius Mauch (RETIRED) gentoo-dev 2004-08-21 12:57:24 UTC
As Spanky said.