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

Bug 80752

Summary: Leaving out a hyphen from either deep or update (-deep, -update) trips up emerge
Product: Portage Development Reporter: Maurice Volaski <mvolaski>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED WORKSFORME    
Severity: normal CC: ssl
Priority: High    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---

Description Maurice Volaski 2005-02-04 10:33:25 UTC
Two hyphens must prepend deep and update each to update the world

emerge -v --update --deep world

Leaving out a single hyphen
emerge -v -update --deep world
emerge -v --update -deep world

causes emerge to spew out junk

Calculating world dependencies -
Parent:    ebuild / sys-apps/man-pages-2.01 merge
Depstring:  sys-apps/man
Candidates: ['sys-apps/man']
ebuild: sys-apps/man-1.5p
binpkg: None                                                                                                                                                               \
Parent:    ebuild / sys-apps/man-1.5p merge
Depstring: virtual/libc >=sys-apps/sed-4 !bootstrap? ( sys-devel/patch ) !bootstrap? ( sys-devel/patch ) sys-apps/cronbase >=sys-apps/groff-1.18 nls? ( sys-devel/gettext )
Candidates: ['>=sys-apps/sed-4', 'sys-devel/patch', 'sys-devel/gettext', 'sys-apps/cronbase', 'sys-libs/glibc', '>=sys-apps/groff-1.18']
ebuild: sys-apps/sed-4.0.9

[this continues for a while and]
[then it will atempt to emerge the whole world and every dependency!]

emerge should recognize some basic malformed arguments and notify the user.
Comment 1 SpanKY gentoo-dev 2005-02-04 10:37:43 UTC
-deep -> -d -e -p -> --debug --empty --pretend
-update -> -u -p -d -a -t -e -> --update --pretend --debug --ask --tree --empty
Comment 2 Maurice Volaski 2005-02-04 10:48:14 UTC
I consider this a bug because it's not performing as I thought it would and it was sufficiently non-obvious that I posted a bug about it.

Perhaps emerge itself should regurgitate the arguments it thinks the user is passing to it in full English, as you have done below.

(For that matter, every CLU should do this :-)
Comment 3 Jason Stubbs (RETIRED) gentoo-dev 2005-02-04 16:15:11 UTC
It does already. They are in the title bar of your term (if you have one and it is supported) as well as in /var/log/emerge.log.
Comment 4 Maurice Volaski 2005-02-04 16:38:14 UTC
Ideally, I think emerge should more intelligence about this. It should guess that if a user is typing

emerge -v -update -deep world
or
emerge -v --update -deep world

they really just left out a hyphen

(All computer programs should have this type of defensive-style programming.. this probably something to to think about in future versions of portage.) 
Comment 5 SpanKY gentoo-dev 2005-03-10 12:32:39 UTC
*** Bug 84779 has been marked as a duplicate of this bug. ***
Comment 6 Slobodan D. Sredojevic 2005-03-13 15:01:48 UTC
Can't tell that we have bugs in #84779 and this (#80752) report. This is why I filled report with MINOR priority. Anyway, still, my attitude is that behavior like this raises some problems:

- using long options like --pretend, --update, --deep and others is frequent
- forgetting one dash (-) is something that happens
- probability that user with --update want to do: --update --pretend --debug --ask --tree and --emptytree all in one is very low
- this causes waste of computer resources (think servers). Did you try "emerge -debug package_name"? User/administrator wanted to do --debug not to rebuild whole portage tree! This is worst scenario of this bug/problem. 
- new and more emerge options (one letter parameters) will bring more problems someday

I suggest that, in the first pass, emerge checks is option given after two dashes (--) belongs to group {ask, buildpkg, ... debug, deep ... version} and do the same for all text after one dash. If it is correct option after (--) execute the command. If it is correct option after (-) print one-line error message (suggesting adding dash) and stop execution. Only if the given command doesn't belong to mentioned group (second pass) do parsing of the letters as in -pv -pvu etc.


This is all about making emerge better. At the moment I am thinking this problem really is funny. Also I agree with Maurice on everything he said.

Cheers