Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 200370 - /usr/bin/emerge should not forbid --ask not in a terminal
Summary: /usr/bin/emerge should not forbid --ask not in a terminal
Status: RESOLVED WONTFIX
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: High minor
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-26 07:09 UTC by danl
Modified: 2007-11-26 21:48 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description danl 2007-11-26 07:09:05 UTC
there are scenarios where running emerge --ask in a script is desirable.
(mine is an automated/minimal-intervention emerge-world script where I want to log --pretend output, on a slower box where a separate --pretend step would be a nontrivial increase in system usage.)

it is also unclear what benefit this limitation brings.
for the benefit of emerge's flexibility as a unix utility, and its code clarity and minimalism, this check should be removed.

Reproducible: Always

Steps to Reproduce:
1. run:
#!/bin/bash
nice -n40
(
  echo '~/BIN/EW RUNNING EMERGE WORLD AT';
  date;
  yes | emerge -autvgDN world
) | tee -a ~/log/u
Actual Results:  
~/BIN/EW RUNNING EMERGE WORLD AT
Sun Nov 25 22:10:28 PST 2007
!!! "--ask" should only be used in a terminal. Exiting.

Expected Results:  
~/BIN/EW RUNNING EMERGE WORLD AT
Sun Nov 25 23:08:58 PST 2007

These are the packages that would be merged, in reverse order:

Calculating world dependencies
...

a patch against /usr/bin/emerge of sys-apps/portage-2.1.4_rc3

6393,6399d6392
<       # 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.stdin.isatty()):
<               portage.writemsg("!!! \"--ask\" should only be used in a terminal. Exiting.\n",
<                       noiselevel=-1)
<               sys.exit(1)
<
Comment 1 Andrew Gaffney (RETIRED) gentoo-dev 2007-11-26 12:56:45 UTC
And what exactly is the point of this? You can run emerge with -v and it will output a deptree before building. Doing 'yes | emerge --ask' is just silly.
Comment 2 danl 2007-11-26 13:28:02 UTC
it is not that silly when you consider that there are packages like sci-libs/blas-atlas that needlessly pretend to require interactive configuration to compile

although the -v solution also addresses some of my issues, the isatty check is still paternalistic, un-unixlike, and unnecessary while offering no safety.  i for one will continue to auto-patch it out on upgrades

i would at least clean up the comment there

good luck
Comment 3 Zac Medico gentoo-dev 2007-11-26 21:48:29 UTC
(In reply to comment #2)
> although the -v solution also addresses some of my issues, the isatty check is
> still paternalistic, un-unixlike, and unnecessary while offering no safety.  i
> for one will continue to auto-patch it out on upgrades

Isn't it a reasonable assumption that something unintended has happened when --ask is not accompanied by a tty? If we're not going to exit, wouldn't it be safer to drop to --pretend mode?

I'd prefer not to encourage or have to support the abuse of options in ways that they are not intended to work. Is there something about the -v option that makes it unsuitable for your needs?