Merge lp:~dominique-ramaekers/command-not-found/thinerBug into lp:~command-not-found-developers/command-not-found/trunk

Proposed by Dominique Ramaekers on 2016-11-29
Status: Merged
Merge reported by: Michael Vogt
Merged at revision: not available
Proposed branch: lp:~dominique-ramaekers/command-not-found/thinerBug
Merge into: lp:~command-not-found-developers/command-not-found/trunk
Diff against target: 23 lines (+3/-3)
1 file modified
CommandNotFound/ (+3/-3)
To merge this branch: bzr merge lp:~dominique-ramaekers/command-not-found/thinerBug
Reviewer Review Type Date Requested Status
Michael Vogt 2016-11-29 Approve on 2016-12-13
Review via email:

Description of the change

Fixes Bug #1643167: command-not-found crash on inreasonably long input

To post a comment you must log in.
Michael Vogt (mvo) wrote :

Looks good, thank you!

review: Approve
Michael Vogt (mvo) wrote :

This is now part of - this is the best branch to target for the command-not-found work, the lp:command-not-found is pointing to something that is not quite ready (trunk). I will upload it soon.

Thank you to. I won't bug you so much anymore. I'm glad I now can
contribute after years of using OSS. And on a tool that helped me a lot and
still is of good use for me.



Op dinsdag 13 december 2016 07:53:21 CET schreef Michael Vogt
<email address hidden>:
> Review: Approve
> Looks good, thank you!

Verzonden via Dekko vanaf mijn Ubuntu-apparaat

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CommandNotFound/'
2--- CommandNotFound/ 2016-10-09 19:49:45 +0000
3+++ CommandNotFound/ 2016-11-29 18:56:23 +0000
4@@ -135,16 +135,16 @@
5 except KeyError:
6 self.user_can_sudo = False
8- def print_spelling_suggestion(self, word, min_len=3, max_len=15):
9+ def print_spelling_suggestion(self, word, min_len=3, max_len=256, max_alt=15):
10 " try to correct the spelling "
11- if len(word) < min_len:
12+ if not (min_len <= len(word) <= max_len):
13 return
14 possible_alternatives = []
15 for w in similar_words(word):
16 packages = self.getPackages(w)
17 for (package, comp) in packages:
18 possible_alternatives.append((w, package, comp))
19- if len(possible_alternatives) > max_len:
20+ if len(possible_alternatives) > max_alt:
21 print(_("No command '%s' found, but there are %s similar ones") % (word, len(possible_alternatives)), file=sys.stderr)
22 elif len(possible_alternatives) > 0:
23 print(_("No command '%s' found, did you mean:") % word, file=sys.stderr)


People subscribed via source and target branches