emerge --ask cannot be redirected to a file or to tee, because emerge checks the stdout file descriptor to see if it's running on a terminal, instead of checking stdin. Since the important thing is to ensure that input can, in fact, be given, and this makes capturing the output more difficult, I would say this is a bug. I understand that emerge already sends much of this output, if not all, to files, but those files are buried, poorly documented last I checked, and not intuitive. Further, it limits redirecting the file to a more interesting program, such as a speech synthesizer or alternate text highlighter. Reproducible: Always Steps to Reproduce: 1. emerge -a world | tee ~/consolidated.logfile.I.can.find Actual Results: !!! "--ask" should only be used in a terminal. Exiting. Expected Results: These are the packages that I would merge, in order: Calculating world dependencies ...done! ... Portage 2.0.51-r8 (hardened/x86, gcc-3.3.4, glibc-2.3.4.20040808-r1, 2.6.5-hardened-r5 i686) ============================================================ ===== System uname: 2.6.5-hardened-r5 i686 AMD Athlon(tm) XP 2500+ Gentoo Base System version 1.4.16 Python: dev-lang/python-2.3.4 [2.3.4 (#1, Oct 21 2004, 06:09:09)] dev-lang/python: 2.3.4 sys-devel/autoconf: 2.59-r5 sys-devel/automake: 1.8.5-r1 sys-devel/binutils: 2.14.90.0.8-r1 sys-devel/libtool: 1.5.2-r7, 1.5.2-r5 virtual/os-headers: 2.6.5 ACCEPT_KEYWORDS="x86" CFLAGS="-O3 -mcpu=athlon-xp -funroll-loops -pipe -fstack-protector" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config / var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O3 -mcpu=athlon-xp -funroll-loops -pipe -fstack-protector" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs buildpkg ccache collision-protect distlocks gpg keepwork maketest notitles sandbox userpriv usersandbox" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/Linux/distributions/ gentoo" PKGDIR="/usr/portage//packages/x86/" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage/" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="3dfx 3dnow aalib accessibility aci acl acpi aim apache2 berkdb caps crypt curl dlloader dvd ethereal evo fastcgi hardened imap innodb ipv6 jpeg ldap libwww makecheck mbox mcal memlimit mikmod mmx mozilla mysql ncurses offensive oss pam pdflib perl pic pie png python readline snmp spell sse ssl tcpd unicode usb x86 zeo zlib"
Would somebody please consider changing /usr/bin/emerge at about line 352: # forbid --ask when not in a terminal # note: this breaks `emerge --ask | tee logfile`, but that doesn't work anyway. if ("--ask" in myopts) and (not sys.stdout.isatty()): portage.writemsg("!!! \"--ask\" should only be used in a terminal. Exiting.\n") sys.exit(1) into checking stdin instead of stdout?: # forbid --ask when not in a terminal if ("--ask" in myopts) and (not sys.stin.isatty()): portage.writemsg("!!! \"--ask\" should only be used in a terminal. Exiting.\n") sys.exit(1) That would help a lot. Regards
ouch, I intended to write "and (not sys.stdin.isatty()):", of course.
Fixed on or before 2.0.51.22-r1
Looking through the batch of bugs, I'm not sure that some of these are actually fixed in stable. Others, the requirements have possibly changed after the initial fix was committed. If you think this bug has been closed incorrectly, please reopen or ask that it be reopened.
Hi, I can confirm its fixed correctly in unstable (~x86), had to hit enter several times "lately". :-)) BTW, and if someone is reading this: if I do emerge -av ... 2>&1 | tee -a /tmp/e.log then not all characters appear in the logfile (/tmp/e.log) and I hit "return" blindly, which then gets mixed up with the other output. Is that my fault (because of stderr-redirection to stdout) or is there a flush(stdout+stderr) missing in emerge at the point where it is waiting for confirmation input? Kind regards, Dominik