Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 338744 - sys-apps/portage-2.1.9.24 can't unpack zip files due to Broken pipe
Summary: sys-apps/portage-2.1.9.24 can't unpack zip files due to Broken pipe
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
: 348245 (view as bug list)
Depends on: 309001
Blocks: 349307
  Show dependency tree
 
Reported: 2010-09-26 01:24 UTC by Randall Wald
Modified: 2011-03-07 22:46 UTC (History)
6 users (show)

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


Attachments
python script showing change of SIGPIPE handler (sigpipe-test.py,197 bytes, text/plain)
2010-09-26 22:05 UTC, Zac Medico
Details
python script that changes SIGPIPE handler and execute unzip in a shell (sigpipe-excve-test.py,245 bytes, patch)
2010-09-27 03:06 UTC, Zac Medico
Details | Diff
python script that uses portage api to execute unzip in a shell (sigpipe-portage-test.py,315 bytes, text/plain)
2010-09-27 03:22 UTC, Zac Medico
Details
handle echo failure (echo_unzip.patch,753 bytes, patch)
2010-12-29 18:55 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Randall Wald 2010-09-26 01:24:01 UTC
When trying to upgrade my version of liberation-fonts to 1.05, I get the following error, repeated over and over again until it completely wipes out the scrollback buffer. (I believe the portage output immediately preceding it is the "Unpacking liberation-fonts-ttf-1.05.zip to /var/tmp/portage/media-fonts/liberation-fonts-1.05/work" line, but since I can't scroll back far enough I can't be sure.)

/usr/lib64/portage/bin/ebuild.sh: line 393: echo: write error: Broken pipe

I checked that line in ebuild.sh, and line 393 is the line with > in the following excerpt:

case "${x##*.}" in
    ...
    ZIP|zip|jar)
        # unzip will interactively prompt under some error conditions,
        # as reported in bug #336285
>       ( while true ; do echo n ; done ) | \
        unzip -qo "${srcdir}${x}" || die "$myfail"
        ;;

This was apparently added to fix bug #336285, which also relates to zip file unpacking part of portage. I posted about this error in the comments to that bug, but Zac Medico was unable to reproduce the problem.

I've been able to hit this bug again when compiling the dev-utils/weka-3.6.2 package, which also requires portage to use unzip in the unpack process; this lends credence to the idea that the bug relates to portage's handling of zip files.

Note also that I'm able to use unzip normally, outside the context of portage.

Anyway, here's my emerge --info:

Portage 2.2_rc86 (default/linux/amd64/10.0/desktop, gcc-4.4.3, glibc-2.11.2-r0, 2.6.34-gentoo-r6 x86_64)
=================================================================
System uname: Linux-2.6.34-gentoo-r6-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T7300_@_2.00GHz-with-gentoo-2.0.1
Timestamp of tree: Sat, 25 Sep 2010 21:15:02 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.3
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.4_p6-r1, 1.5-r1, 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE CCPL-Attribution-NonCommercial-NoDerivs-2.0 fairuse freedist free-noncomm"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/portage /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/portage/distfiles"
FEATURES="assume-digests ccache distlocks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://www.gtlib.gatech.edu/pub/gentoo ftp://ftp.gtlib.gatech.edu/pub/gentoo http://distro.ibiblio.org/pub/linux/distributions/gentoo/ ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://gentoo.osuosl.org/ "
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_US en ja"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/haskell /usr/local/portage"
SYNC="rsync://rsync21.us.gentoo.org/gentoo-portage"
USE="64bit 7zip X a52 aac aalib acl acpi aim alsa amarok amazon amd64 animgif anthy audacious bash-completion berkdb bidi bittorrent bluetooth branding bzip2 cairo cdaudio cdda cddb cdparanoia cdr cjk cli console consolekit cracklib crypt css cups cxx dbus dict directfb divx djvu dri dts dvd dvdnav dvdr dvi emboss encode exif fam fat fbcon fbcondecor fbsplash ffmpeg flac fortran ftp gdbm gif gimp gimpprint glitz glsa gmail gpm gs gtk hal hdaps hddtemp hfs ibmacpi iconv icq icu idea ieee1394 imagemagick immqt-bc ipv6 ipw4965 jabber java javascript jingle john jpeg kerberos kpathsea lame laptop latex lcms ldap libcaca libnotify lm_sensors lua mad matroska md5sum mikmod mmx mng modules mono mp3 mp4 mpeg mplayer msn mtp mudflap multilib musicbrainz mysql ncurses nethack nls nptl nptlonly nsplugin ntfs offensive ogg opengl openmp openssl opensslcrypt openvpn pam pango pcmcia pcre pdf perl pidgin png pop ppds pppd prediction prime python qt3support qt4 rar raw readline realmedia reflection reiserfs sdl server session smapi spell sse sse2 ssl stream svg sysfs tcpd theora threads thunderbird tiff timidity tracker truetype uim unicode usb vim-syntax vim-with-x visualization vlm vorbis wav wifi wma wmp wordperfect wxwindows x264 xcb xcomposite xml xorg xscreensaver xulrunner xv xvid yahoo zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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" ELIBC="glibc" INPUT_DEVICES="synaptics evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_US en ja" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="vesa vga i810 i830 intel" 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:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Zac Medico gentoo-dev 2010-09-26 01:41:18 UTC
Do unzip -v and bash --version show the expected versions? Maybe you have a stray unzip binary in /usr/local/bin/ or something like that.
Comment 2 Randall Wald 2010-09-26 01:46:54 UTC
Yep, unzip -v gives 6.00 (which matches the installed unzip-6.0-r1), and bash --version gives 4.0.37(2)-release (which matches the installed bash-4.0_p37). I also ran locate {bash|unzip}|grep bin and came up with the following lists:

/usr/share/bash-completion/bind-utils
/usr/bin/bashcomp-config
/usr/bin/bashbug
/usr/lib64/portage/bin/filter-bash-environment.py
/bin/rbash
/bin/bash

/usr/bin/funzip
/usr/bin/unzipsfx
/usr/bin/hunzip
/usr/bin/unzip
/usr/bin/unzip-mem
/usr/lib64/klibc/bin/gunzip
/bin/gunzip
/bin/bunzip2

So no stray versions of either of those.

One other thing: bash isn't my default shell; instead, I use one called fish. I just checked, though, and starting bash followed by emerge -1 liberation-fonts doesn't change the outcome at all, even though I can still use unzip on my own from within that same bash instance.
Comment 3 Zac Medico gentoo-dev 2010-09-26 07:38:30 UTC
(In reply to comment #2)
> One other thing: bash isn't my default shell; instead, I use one called fish. I
> just checked, though, and starting bash followed by emerge -1 liberation-fonts
> doesn't change the outcome at all, even though I can still use unzip on my own
> from within that same bash instance.

Please check if it fails when you run this in an interactive bash shell:

  ( while true ; do echo n ; done ) | unzip -qo liberation-fonts-ttf-1.05.zip

I wonder if your SIGPIPE handler is getting broken somehow. Portage is supposed to install the default SIGPIPE handler for it's subprocesses, since bug 309001, but maybe that's not working correctly on your system for some reason.
Comment 4 Randall Wald 2010-09-26 21:34:03 UTC
Running that command outside the context of portage will silently unzip the package into the current directory...what's this about a SIGPIPE handler, and how can I test it?
Comment 5 Zac Medico gentoo-dev 2010-09-26 22:05:44 UTC
Created attachment 248715 [details]
python script showing change of SIGPIPE handler 

You can run this script to see if python responds properly to changes in the SIGPIPE signal handler. The output should look like this if it's working properly:

$ ./sigpipe-test.py
1
0

The 0 corresponds to the signal.SIG_DFL handler. If you have portage installed with USE=python3 then you should use python3 to execute the test script.

The code in portage that's supposed to make subprocesses respond correctly to SIGPIPE is shown in this patch:

  http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d80db256ec34b8aac65eda89f2ff2baea5996d5f
Comment 6 Randall Wald 2010-09-26 23:48:17 UTC
I ran your sigpipe test file, but got the same output as I was supposed to (that is, 1 on the first line and 0 on the next line); I'm really not sure what's wrong here. Oh, and I did manage to hit ctrl+c to see what happens before the long string of error messages, and it is the ">>> Unpacking liberation-fonts-ttf-1.05.zip to /var/tmp/portage/media-fonts/liberation-fonts-1.05/work" line, if there was any doubt.
Comment 7 Zac Medico gentoo-dev 2010-09-27 03:06:26 UTC
Created attachment 248729 [details, diff]
python script that changes SIGPIPE handler and execute unzip in a shell

This script does essentially the same thing that portage does to unpack a zip file. It works for me. If I comment out the SIGPIPE line and run it, then I get a "write error: Broken pipe" loop like the one that you've reported.
Comment 8 Randall Wald 2010-09-27 03:13:46 UTC
I have no idea what's doing it, then; that script works fine, unpacking the zip file into the working directory. But I still can't unpack the file using portage; as a test, I upgraded to portage-2.2_rc87 and then simply ran "sudo ebuild /usr/portage/media-fonts/liberation-fonts/liberation-fonts-1.05.ebuild unpack", but same effect: that error message repeating over and over again.
Comment 9 Zac Medico gentoo-dev 2010-09-27 03:22:39 UTC
Created attachment 248731 [details]
python script that uses portage api to execute unzip in a shell

This is similar to the previous script, but uses the portage api. It works for me.
Comment 10 Zac Medico gentoo-dev 2010-09-27 03:25:10 UTC
(In reply to comment #9)
> Created an attachment (id=248731) [details]
> python script that uses portage api to execute unzip in a shell
> 
> This is similar to the previous script, but uses the portage api. It works for
> me.

Note that it's expected to get the "write error: Broken pipe" loop if you don't have a version or portage installed that has the following patch:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d80db256ec34b8aac65eda89f2ff2baea5996d5f
Comment 11 Randall Wald 2010-09-27 03:29:49 UTC
OK, here's something interesting: the new script still works fine, just like the previous ones, but on a whim I ran it with sudo, and was able to trigger the bug. Running the sigpipe-excve-test.py version with sudo also triggers the bug. In both cases, I get infinite lines reading:

/bin/bash: line 0: echo: write error: Broken pipe

Running the scripts as my regular user doesn't trigger this. Since I never run emerge as my regular user, this is presumably part of the problem.

As for having that patched version of portage, I just upgraded to 2.2_rc87; does that have the patch?
Comment 12 Zac Medico gentoo-dev 2010-09-27 03:33:45 UTC
(In reply to comment #11)
> As for having that patched version of portage, I just upgraded to 2.2_rc87;
> does that have the patch?

Yes, it does.

We should be checking for duplicate portage modules on your system. Do these two paths resolve the same on your system?

  readlink -f /usr/lib/portage/pym
  readlink -f /usr/lib64/portage/pym

What are the outputs of these commands?

  python -c 'import portage ; print portage.__file__'
  sudo python -c 'import portage ; print portage.__file__'
Comment 13 Randall Wald 2010-09-27 03:36:20 UTC
Everything there seems to be working normally; those two readlink commands give the same result, as do the two python -c commands (in particular, they both give "/usr/lib64/portage/pym/portage/__init__.pyc").
Comment 14 Zac Medico gentoo-dev 2010-09-27 03:41:47 UTC
Let's try removing all of your compiled python bytecodes for portage and see if that helps (they will regenerate anyway).

 find /usr/lib/portage -name '*.py[co]' | xargs rm -f
Comment 15 Randall Wald 2010-09-27 03:42:38 UTC
Before I start removing portage things, how exactly will they regenerate?
Comment 16 Zac Medico gentoo-dev 2010-09-27 03:44:47 UTC
Python generates them automatically when you run portage. You can also 'emerge portage' to regenerate them all.
Comment 17 Randall Wald 2010-09-27 03:53:01 UTC
No change when I wipe out the the bytecode...however, on another whim, I tried running the script with sudo -s rather than using sudo directly; this time it worked. In fact, when using a sudo -s shell environment rather than sudo itself, I was able to emerge liberation-fonts without trouble. I've actually been having some weird bugs with sudo lately, so it seems this may be an extension of that. Should I describe them in more detail here or create a new bug report?
Comment 18 Zac Medico gentoo-dev 2010-09-27 04:03:16 UTC
You can go ahead and describe your sudo issues here. I'm adding base-system to CC in case they have any ideas about why sudo would a affect SIGPIPE handling in subprocesses, and why sudo -s would make the issue disappear.
Comment 19 Randall Wald 2010-09-27 04:12:41 UTC
Basically, the same general problem as described in bug #330995: when I run sudo to perform a specific command, it says "HXproc_run_async: pmvarrun: No such file or directory" before executing the command, and (on first run, when I had to enter my password) does "Segmentation fault" afterwards. Oddly enough, while this is the behavior with bash, there is slightly different behavior with my default shell, fish: I still get "HXproc_run_async: pmvarrun: No such file or directory" beforehand and "fish: Job 1, “sudo echo test” terminated by signal SIGSEGV (Address boundary error)" afterwards, but it never remembers my password, so the first-run behavior (i.e., ending with the segfault) happens every time. Since the pmvarrun binary comes from the pam_mount package, that may be involved as well, but I haven't had any problem with my pam_mount-mounted home directory.
Comment 20 SpanKY gentoo-dev 2010-09-27 06:36:13 UTC
post the output of `cat /proc/self/status`
Comment 21 Randall Wald 2010-09-27 06:37:46 UTC
Sure:

Name:	cat
State:	R (running)
Tgid:	28218
Pid:	28218
PPid:	4026
TracerPid:	0
Uid:	1000	1000	1000	1000
Gid:	1000	1000	1000	1000
FDSize:	64
Groups:	10 16 18 19 35 100 1000 1003 1004 1006 1011 1012 
VmPeak:	    6584 kB
VmSize:	    6584 kB
VmLck:	       0 kB
VmHWM:	     300 kB
VmRSS:	     300 kB
VmData:	     176 kB
VmStk:	     136 kB
VmExe:	      44 kB
VmLib:	    1464 kB
VmPTE:	      36 kB
VmSwap:	       0 kB
Threads:	1
SigQ:	3/30528
SigPnd:	0000000000000000
ShdPnd:	0000000000000000
SigBlk:	0000000000000000
SigIgn:	0000000000000000
SigCgt:	0000000000000000
CapInh:	0000000000000000
CapPrm:	0000000000000000
CapEff:	0000000000000000
CapBnd:	ffffffffffffffff
Cpus_allowed:	3
Cpus_allowed_list:	0-1
Mems_allowed:	00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
Mems_allowed_list:	0
voluntary_ctxt_switches:	2
nonvoluntary_ctxt_switches:	0
Comment 22 SpanKY gentoo-dev 2010-09-27 06:55:56 UTC
that looks sane.  what about `cat /proc/$$/status`.

if you do `sudo su -`, does the emerges in question work fine ?
Comment 23 Randall Wald 2010-09-27 07:03:51 UTC
Yep, the emerge still works if I do sudo su -; it's only sudo emerge itself that's failing. As for /proc/$$/status, here it is:

Name:	bash
State:	S (sleeping)
Tgid:	12862
Pid:	12862
PPid:	4026
TracerPid:	0
Uid:	1000	1000	1000	1000
Gid:	1000	1000	1000	1000
FDSize:	256
Groups:	10 16 18 19 35 100 1000 1003 1004 1006 1011 1012 
VmPeak:	   20704 kB
VmSize:	   20700 kB
VmLck:	       0 kB
VmHWM:	    2028 kB
VmRSS:	    2028 kB
VmData:	     612 kB
VmStk:	     136 kB
VmExe:	     824 kB
VmLib:	    1972 kB
VmPTE:	      60 kB
VmSwap:	       0 kB
Threads:	1
SigQ:	3/30528
SigPnd:	0000000000000000
ShdPnd:	0000000000000000
SigBlk:	0000000000010000
SigIgn:	0000000000384004
SigCgt:	000000004b813efb
CapInh:	0000000000000000
CapPrm:	0000000000000000
CapEff:	0000000000000000
CapBnd:	ffffffffffffffff
Cpus_allowed:	3
Cpus_allowed_list:	0-1
Mems_allowed:	00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
Mems_allowed_list:	0
voluntary_ctxt_switches:	138
nonvoluntary_ctxt_switches:	2

Note that since bash isn't my normal shell, I invoked it by just typing "bash" at my command prompt and doing the subsequent commands from there, before hitting ctrl+d at the end to return to my normal shell.
Comment 24 Stefan G. Weichinger 2010-11-19 17:58:51 UTC
I hit the same issue when building mythtv on my ~amd64 thinkpad.
"sudo -s ebuild ... merge" unpacks that zip OK, yes.
Please advise if I can test something ... thanks.
Comment 25 Stefan G. Weichinger 2010-12-08 08:02:56 UTC
I now also get it for dev-python/argparse.
Comment 26 Zac Medico gentoo-dev 2010-12-08 16:11:17 UTC
(In reply to comment #25)
> I now also get it for dev-python/argparse.

The problem seems to be triggered by calling emerge via sudo, so the fact that the argparse ebuild triggers the problem only implies that the argparse ebuild needs to unpack a zip file.
Comment 27 Stefan G. Weichinger 2010-12-09 08:22:13 UTC
(In reply to comment #26)
> (In reply to comment #25)
> > I now also get it for dev-python/argparse.
> 
> The problem seems to be triggered by calling emerge via sudo, so the fact that
> the argparse ebuild triggers the problem only implies that the argparse ebuild
> needs to unpack a zip file.
> 

Yep, correct.

I have to admit that I am a bit off-topic: I use an older portage than the bug-description says:

# emerge --info
Portage 2.1.9.25 (default/linux/amd64/10.0/desktop/gnome, gcc-4.5.1, glibc-2.12.1-r3, 2.6.36-tuxonice-r2 x86_64)
=================================================================
System uname: Linux-2.6.36-tuxonice-r2-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T8100_@_2.10GHz-with-gentoo-2.0.1
Timestamp of tree: Thu, 09 Dec 2010 07:30:23 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
ccache version 3.1.3 [disabled]
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r2
dev-lang/python:     2.5.4-r4, 2.6.6-r1, 3.1.2-r4
dev-util/ccache:     3.1.3
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1-r1
sys-apps/openrc:     0.6.3
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.5, 4.5.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.4-r1
sys-devel/make:      3.82
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="de_AT.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de en"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/wschlich-testing /var/lib/layman/vmware /var/lib/layman/mt-mythtv /usr/local/portage"
SYNC="rsync://172.32.99.6/gentoo-portage"
USE="X a52 aac aalib acl acpi alsa amd64 avahi avi berkdb bitmap-fonts bluetooth branding bzip2 cairo cdparanoia cdr cli consolekit cracklib crypt cups cxx dbus divx4linux dri dts dv dvd dvdr dvdread eds emboss encode evo exif fam ffmpeg firefox flac fortran gdbm gdu gif gnome gnome-keyring gpm gstreamer gtk hal hdaps howl iconv ipv6 jpeg lame lcms libnotify live mad mikmod mjpeg mmx mng modules mp3 mp4 mpeg mudflap multilib nautilus ncurses nls nptlonly ogg opengl openmp pam pango pcre pda pdf perl png policykit ppds pppd python qt3support quicktime readline sdl session spell sse sse2 ssl startup-notification svg sysfs tcpd tetex tiff truetype truetype-fonts type1-fonts unicode usb vcd vorbis x264 xcb xml xmms xorg xulrunner xv xvid zlib" ALSA_CARDS="hda-intel intel8x0 intel8x0m" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de en" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" 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:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 28 Stefan G. Weichinger 2010-12-09 08:23:54 UTC
(In reply to comment #26)
> (In reply to comment #25)
> > I now also get it for dev-python/argparse.
> 
> The problem seems to be triggered by calling emerge via sudo, so the fact that
> the argparse ebuild triggers the problem only implies that the argparse ebuild
> needs to unpack a zip file.

And I don't know if it is sudo-related as I get it when running emerge as root, as well as when I try to "ebuild xy merge" that ebuild. Using sudo as a normal user doesn't help so far (as it did with another ebuild back then).
Comment 29 Zac Medico gentoo-dev 2010-12-09 16:15:02 UTC
(In reply to comment #27)
> I have to admit that I am a bit off-topic: I use an older portage than the
> bug-description says:

portage-2.1.9.x is also affected.

(In reply to comment #28)
> And I don't know if it is sudo-related as I get it when running emerge as root,
> as well as when I try to "ebuild xy merge" that ebuild. Using sudo as a normal
> user doesn't help so far (as it did with another ebuild back then).

Maybe something in your environment is doing something similar to what sudo does to trigger this problem.
Comment 30 Zac Medico gentoo-dev 2010-12-09 16:18:53 UTC
*** Bug 348245 has been marked as a duplicate of this bug. ***
Comment 31 ippo 2010-12-09 16:20:54 UTC
(In reply to comment #30)
> *** Bug 348245 has been marked as a duplicate of this bug. ***
> 

Indeed;

more info - i`m not using sudo for emerge.
Comment 32 Stefan G. Weichinger 2010-12-10 14:54:01 UTC
(In reply to comment #29)
> (In reply to comment #27)
> portage-2.1.9.x is also affected.

I see.

> (In reply to comment #28)
> Maybe something in your environment is doing something similar to what sudo
> does to trigger this problem.

What can I do? Anything I can test/query/post ...? Thanks, Stefan

Comment 33 Zac Medico gentoo-dev 2010-12-10 14:56:39 UTC
(In reply to comment #32)
> What can I do? Anything I can test/query/post ...? Thanks, Stefan

You can run each of those 3 scripts that I attached and post the output for each one.
Comment 34 Stefan G. Weichinger 2010-12-10 15:58:37 UTC
(In reply to comment #33)
> (In reply to comment #32)
> > What can I do? Anything I can test/query/post ...? Thanks, Stefan
> 
> You can run each of those 3 scripts that I attached and post the output for
> each one.

Ah, sure, sorry.

First one gives:

1
0

Second and third both return this looping:
"/bin/bash: Zeile 0: echo: Schreibfehler: Datenübergabe unterbrochen (broken pipe)."

helpful?
Comment 35 Stefan G. Weichinger 2010-12-10 16:00:52 UTC
(In reply to comment #34)

Addition: previous runs were as root, as regular user I get

1
0

as well, but 
unzip:  cannot find or open liberation-fonts-ttf-1.05.zip, liberation-fonts-ttf-1.05.zip.zip or liberation-fonts-ttf-1.05.zip.ZIP.

for second and third script.
Comment 36 Zac Medico gentoo-dev 2010-12-11 02:57:33 UTC
(In reply to comment #34)
> helpful?

Your root shell seems to have the same problematic behavior that others have reported when running commands via sudo. Did you enter that root shell via sudo?

(In reply to comment #35)
Apparently the problem doesn't affect your normal user's shell.
Comment 37 Stefan G. Weichinger 2010-12-11 10:14:45 UTC
(In reply to comment #36)
> Your root shell seems to have the same problematic behavior that others have
> reported when running commands via sudo. Did you enter that root shell via
> sudo?

I usually open gnome-terminal as regular user, then "su" to get root-access, yes.
Opening "root terminal" from the gnome-menu also leads to that "broken pipe".

But I was able to "emerge argparse" from another tty after logging in as root, thanks.


Comment 38 infobox.oleg 2010-12-27 10:28:22 UTC
I've got the same bug. When using sudo I get broken pipe.
Tests:
sigpipe-test.py
1
0
sigpipe-excve-test.py
/bin/bash: line 0: echo: write error: Broken pipe
sigpipe-portage-test.py
bash: line 0: echo: write error: Broken pipe

When doing sudo su - or loggin in as root into tty everything is ok.
Comment 39 Zac Medico gentoo-dev 2010-12-28 17:31:35 UTC
(In reply to comment #38)
> When doing sudo su - or loggin in as root into tty everything is ok.

Maybe the sudo -i option helps?
Comment 40 Robin Bankhead 2010-12-29 11:12:08 UTC
I just encountered this when emerging (perhaps ironically) app-arch/zip-3.0-r1. It was during an unattended world update and the looped output swamped my HDD.

I've run all the attached scripts (with /usr/portage/distfiles/zip30.zip) - the first one gives the expected output (1,0) and both others cause the loop, as does issuing this from bash:

( while true ; do echo n ; done ) | unzip -qo /usr/portage/distfiles/zip30.zip

Versions:
app-shells/bash-4.1_p9
app-arch/unzip-6.0-r2
sys-apps/portage-2.1.9.26

emerge --info:
ortage 2.1.9.26 (default/linux/x86/10.0/desktop/kde, gcc-4.4.5, glibc-2.12.1-r3, 2.6.36-gentoo-r5 i686)
=================================================================
System uname: Linux-2.6.36-gentoo-r5-i686-Intel-R-_Celeron-R-_CPU_2.60GHz-with-gentoo-2.0.1
Timestamp of tree: Sun, 26 Dec 2010 20:45:01 +0000
distcc 3.1 i686-pc-linux-gnu [disabled]
ccache version 3.1.3 [enabled]
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r3
dev-lang/python:     2.6.6-r1, 2.7.1, 3.1.3
dev-util/ccache:     3.1.3
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1-r1
sys-apps/openrc:     0.6.8
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.9.6-r2, 1.10.3, 1.11.1
sys-devel/binutils:  2.21
sys-devel/gcc:       4.4.5, 4.5.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.4-r1
sys-devel/make:      3.82
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="x86 ~x86"
ACCEPT_LICENSE="*"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium4 -mmmx -msse -msse2 -fomit-frame-pointer -pipe -w"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/pam.d /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=pentium4 -mmmx -msse -msse2 -fomit-frame-pointer -pipe -w"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs ccache distlocks fixlafiles fixpackages news protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.blueyonder.co.uk/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_GB"
MAKEOPTS="-j8 -l3.5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/dev/shm"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://brazil/gentoo-portage"
USE="X a52 aac acl acpi alsa berkdb bluetooth branding bzip2 cairo cdparanoia cdr chm cli clucene consolekit cracklib crypt cups cupsddk cxx dbus dga dio dri dts dvd dvdread emboss encode exif faac faad fam ffmpeg firefox flac flash foomaticdb fortran fuse gdbm gdu gif gimp glitz gnutls gpm hal htmlhandbook iconv ieee1394 imagemagick innodb java java6 javascript jpeg kde kde4 lcms ldap libnotify libwww mad madwifi matroska mikmod mmx mng modules mp3 mp4 mpeg mplayer msn mudflap mysql mysqli ncurses nls nptl nptlonly nsplugin odbc ogg opengl openmp oss pam pango pcmcia pcntl pcre pdf perl php plasma png policykit posix ppds pppd python qalculate qt3support qt4 qwt readline rss samba scanner sdl semantic-desktop sesame2 session sharedmem soap sockets spell sqlite sqlite3 sse sse2 ssl startup-notification svg sysfs tcpd theora threads tiff tk truetype udev unicode usb vcd vhosts vorbis wicd wifi win32codecs x264 x86 xcb xcomposite xine xinerama xml xmlrpc xorg xsl xulrunner xv xvid xvmc zlib" ALSA_CARDS="intel8x0" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB" NETBEANS_MODULES="apisupport groovy gsf harness ide identity j2ee java mobility nb php soa visualweb webcommon websvccommon xml" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="i810 intel fbdev vesa" 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:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 41 Robin Bankhead 2010-12-29 11:13:55 UTC
PS - I don't use sudo either, I'm running portage (and the above scripts) in a shell (via yakuake) with su -.
Comment 43 SpanKY gentoo-dev 2010-12-29 21:55:20 UTC
why do you need the while loop ?  doesnt `yes n` work exactly the same ?
Comment 44 Zac Medico gentoo-dev 2010-12-29 22:24:21 UTC
Sure, but unlike `yes n`, the while loop is pure bash which is more portable in theory. For example, I don't see `yes` documented here:

  http://pubs.opengroup.org/onlinepubs/007908799/xcuix.html
Comment 45 Zac Medico gentoo-dev 2010-12-31 10:03:07 UTC
This is fixed in 2.1.9.27.
Comment 46 Róbert Čerňanský 2011-03-07 22:46:05 UTC
For us, poor souls that are using stable and thus has to wait until the fixed version gets stabilized, there is a workaround:

Making 'su -' twice turns to correct behaviour:

$ su -
Password: 
# su -
# emerge ...

(For the record, I was doing it over ssh in a screen session that was running on the remote machine.)