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

Bug 363137

Summary: [option=--misspell-suggestion] >=sys-portage/portage-2.1.9.42
Product: Portage Development Reporter: Samuel Bauer <samuel.bauer>
Component: Enhancement/Feature RequestsAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: enhancement CC: tom
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 358927    
Attachments: Simply add a test to check if the user wants to compute and output misspell sugestions
Include documentation, and new constant
added misspell-suggetions to make.globals, used git diff to generate the patch
corrected mistakes in make.conf man page
Added misspell-suggestion as a command line option rather than a feature
Added misspell-suggestion as a command line option rather than a feature
Added misspell-suggestions to emerge manual
emerge: --mispell-suggestion option

Description Samuel Bauer 2011-04-11 17:47:16 UTC
The new portage version nows automatically try to complete mispelled package names.

This should be an option, not as yet necessary

Reproducible: Always

Steps to Reproduce:
emerge -pv mistake
 
Actual Results:  
These are the packages that would be merged, in order:

Calculating dependencies... done!

emerge: there are no ebuilds to satisfy "mistake".

emerge: searching for similar names...
emerge: Maybe you meant any of these: sys-devel/make, dev-util/tmake, games-arcade/snake?

Expected Results:  
Possibility to fine tune portage to keep the old behavior.
Like FEATURE="misspell-suggestions"
and test if the feature is present before to run the lines 2745 to 2794 from portage/pym/_emerge/depgraph.py (portage-2.1.9.42)
Comment 1 Rafał Mużyło 2011-04-11 19:32:04 UTC
Somewhat related to original topic:
I've noticed an interesting quirk of that feature:
if you're on stable and the whole package you want to emerge is not, then it's misdetected as not existent (and candidates given).
Should probably just report "all not keyworded/masked" instead.

Unfortunately, I've seen that awhile ago and no longer remember a specific package to reproduce.
Comment 2 Samuel Bauer 2011-04-12 18:28:02 UTC
Created attachment 269685 [details, diff]
Simply add a test to check if the user wants to compute and output misspell sugestions

This patch is only a preliminary step

2 -> The feature needs to be registered
3 -> The feature needs to be documented (man pages, API doc, etc...)
4 -> A new must be available for the user when he emerge the ebuild

And maybe more steps. (It's first time I suggest something for portage, so let me know)
Comment 3 Sebastian Luther (few) 2011-04-12 18:56:16 UTC
(In reply to comment #2)
> Created attachment 269685 [details, diff]
> Simply add a test to check if the user wants to compute and output misspell
> sugestions

Looks good.

> 
> This patch is only a preliminary step
> 
> 2 -> The feature needs to be registered

It needs to be added to SUPPORTED_FEATURES in pym/portage/const.py.

> 3 -> The feature needs to be documented (man pages, API doc, etc...)

It needs to be documented in man/make.conf.5.

> 4 -> A new must be available for the user when he emerge the ebuild

I don't get what this means.

> And maybe more steps. (It's first time I suggest something for portage, so let
> me know)

It appears as if you patched your installed portage. Take a look at [1]. It describes how to get a git checkout and how to run emerge from this checkout. You can then use git to create patches.

[1] http://www.gentoo.org/proj/en/portage
Comment 4 Samuel Bauer 2011-04-12 19:09:20 UTC
Created attachment 269691 [details, diff]
Include documentation, and new constant

Sorry, the first patch was as you said, made with my installed portage.

This one is made with diff -u --recursive, I just modified the things from a freshly uncompressed archive.

constant has been added in const.py

man page has been documented (though my english is poor)

If I use git to make the same patch, should I submit it again ?
Comment 5 Samuel Bauer 2011-04-12 19:16:08 UTC
(In reply to comment #3)
> > 4 -> A new must be available for the user when he emerge the ebuild
> 
> I don't get what this means.
> 

I just mean there should be an information available through pkg_postinst or  eselect news. Thus the ebuild needs also to be modified.
Comment 6 Sebastian Luther (few) 2011-04-12 19:21:50 UTC
(In reply to comment #4)
> Created attachment 269691 [details, diff]
> Include documentation, and new constant
> 
> Sorry, the first patch was as you said, made with my installed portage.
> 
> This one is made with diff -u --recursive, I just modified the things from a
> freshly uncompressed archive.
> 
> constant has been added in const.py
> 
> man page has been documented (though my english is poor)

s/valids packages name/valid package names/

I actually forgot something. It should be added to FEATURES in cnf/make.globals to enable it by default.

> 
> If I use git to make the same patch, should I submit it again ?

That would be neat.

> I just mean there should be an information available through pkg_postinst or 
> eselect news. Thus the ebuild needs also to be modified.

No, we don't announce stuff like this in the ebuild. If it annoys people enough they learn it from the man page or forums, etc.
Comment 7 Samuel Bauer 2011-04-12 20:20:10 UTC
Created attachment 269699 [details, diff]
added misspell-suggetions to make.globals, used git diff to generate the patch

(In reply to comment #6)
> s/valids packages name/valid package names/
Thanks, my english is poor, but we would use same structure in my native tongue (-1)

(In reply to comment #6)
> I actually forgot something. It should be added to FEATURES in cnf/make.globals
> to enable it by default.
I added it to make.globals but the heart wasn't there. This new feature makes me vomit (even I was happy to learn such algorithms at school):
         1) Lot of people don't want tooltips (especially when use a shell, else .b.nt. is very attractive s/\./u/)
         2) This is cpu greedy and not to be recommended for old configs.
         3) The way to include it by default breaks the old behavior.

(In reply to comment #6)
> No, we don't announce stuff like this in the ebuild. If it annoys people enough
> they learn it from the man page or forums, etc.
never mind.
Comment 8 Sebastian Luther (few) 2011-04-12 20:58:33 UTC
(In reply to comment #7)
> Created attachment 269699 [details, diff]
> added misspell-suggetions to make.globals, used git diff to generate the patch
> 

I suggest the following work flow:
a) Modify the branch 'master' (that's where you start) (see git branch)
b) Create a new branch and switch to it:
git checkout -b my-fancy-new-feature
c) Do a commit
git commit -a
d) Create a patch
git format-patch master
This will create a patch against the master branch
e) You can now switch back to master and start working on the next thing
git checkout master

> (In reply to comment #6)
> > s/valids packages name/valid package names/
> Thanks, my english is poor, but we would use same structure in my native tongue
> (-1)

The spelling is not corrected in the current patch.

> 
> (In reply to comment #6)
> > I actually forgot something. It should be added to FEATURES in cnf/make.globals
> > to enable it by default.
> I added it to make.globals but the heart wasn't there. This new feature makes
> me vomit (even I was happy to learn such algorithms at school):
>          1) Lot of people don't want tooltips (especially when use a shell,
> else .b.nt. is very attractive s/\./u/)
>          2) This is cpu greedy and not to be recommended for old configs.
>          3) The way to include it by default breaks the old behavior.
> 

It's actually disk bound. Some people like it, some hate it. It comes really handy if you don't have to find out yourself that foobar is actually named fooBar or foobar2.
Comment 9 Samuel Bauer 2011-04-12 21:34:51 UTC
(In reply to comment #8)
> I suggest the following work flow:
> a) Modify the branch 'master' (that's where you start) (see git branch)
> b) Create a new branch and switch to it:
> git checkout -b my-fancy-new-feature
> c) Do a commit
> git commit -a
> d) Create a patch
> git format-patch master
> This will create a patch against the master branch
Done

> (In reply to comment #6)
> > s/valids packages name/valid package names/
> The spelling is not corrected in the current patch.

I was thinking I made a mistake in the bugzilla messages.

> It's actually disk bound. Some people like it, some hate it. It comes really
> handy if you don't have to find out yourself that foobar is actually named
> fooBar or foobar2.

I have to admit in some situation it can be handy, but it's even better if the user can fine tune the behavior.

Lot of times I did some request like: emerge -S "the feature", but in some package the description is "the-feature".
When I explicitely query I would like to be able to perform fuzzy query, so would be nice to have an independent tool (qsuggests). May be it can it give some sense to the last point of the suggested workflow.
Comment 10 Sebastian Luther (few) 2011-04-12 21:49:55 UTC
(In reply to comment #9)
> 
> > (In reply to comment #6)
> > > s/valids packages name/valid package names/
> > The spelling is not corrected in the current patch.
> 
> I was thinking I made a mistake in the bugzilla messages.

No, in the description in make.conf.
Comment 11 Samuel Bauer 2011-04-12 22:29:58 UTC
Created attachment 269729 [details, diff]
corrected mistakes in make.conf man page

Should put last message content here.
Comment 12 Zac Medico gentoo-dev 2011-04-13 14:11:47 UTC
A possible alternative approach would be to allow the user to set EMERGE_DEFAULT_OPTS="--misspell-suggestions=n" in make.conf. For things that are only exist in the emerge interface, I typically use an option like this, and I reserve FEATURES for flags that need to affect all portage tools and portage API consumers.
Comment 13 Samuel Bauer 2011-04-14 07:15:16 UTC
(In reply to comment #12)
> A possible alternative approach would be to allow the user to set
> EMERGE_DEFAULT_OPTS="--misspell-suggestions=n" in make.conf. For things that
> are only exist in the emerge interface, I typically use an option like this,
> and I reserve FEATURES for flags that need to affect all portage tools and
> portage API consumers.

If I get it, I should add an option in emerge.
Comment 14 Samuel Bauer 2011-04-14 08:14:01 UTC
Created attachment 269911 [details, diff]
Added misspell-suggestion as a command line option rather than a feature

Hope it's the way, but I didn't add the doc in the man page.
Comment 15 Samuel Bauer 2011-04-14 08:29:23 UTC
Created attachment 269917 [details, diff]
Added misspell-suggestion as a command line option rather than a feature
Comment 16 Samuel Bauer 2011-04-14 15:25:27 UTC
Created attachment 269957 [details, diff]
Added misspell-suggestions to emerge manual
Comment 17 Samuel Bauer 2011-04-14 18:24:50 UTC
Created attachment 269979 [details, diff]
emerge: --mispell-suggestion option
Comment 18 Zac Medico gentoo-dev 2011-04-28 16:20:34 UTC
Thanks, this is in git now:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ebb887ee7606ec2dd7b266dd3538e68b31ac3a38

I didn't include it in the short --help message, since I'd rather reserve that area for more important options. Also, I made it a < y | n > option since the code is a bit simpler that way.
Comment 19 Samuel Bauer 2011-04-29 16:18:23 UTC
It's pleasure for me to have a more than modest contribution to gentoo after near ten years using it.

For the --help short message, I didn't know.
For the < y | n > option, it was done like this in the submitted patch.

Thanks
Comment 20 Zac Medico gentoo-dev 2011-05-05 19:50:46 UTC
This is in 2.1.9.47 and 2.2.0_alpha31.
Comment 21 Tom Noonan 2011-05-09 03:41:09 UTC
*** Bug 366521 has been marked as a duplicate of this bug. ***