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

Proposed by Dominique Ramaekers
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/CommandNotFound.py (+3/-3)
To merge this branch: bzr merge lp:~dominique-ramaekers/command-not-found/thinerBug
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+312081@code.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Looks good, thank you!

review: Approve
Revision history for this message
Michael Vogt (mvo) wrote :

This is now part of http://bazaar.launchpad.net/~ubuntu-core-dev/command-not-found/ubuntu/revision/199 - 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.

Revision history for this message
Dominique Ramaekers (dominique-ramaekers) wrote :

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.

Greetings,

Dominique.

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
=== modified file 'CommandNotFound/CommandNotFound.py'
--- CommandNotFound/CommandNotFound.py 2016-10-09 19:49:45 +0000
+++ CommandNotFound/CommandNotFound.py 2016-11-29 18:56:23 +0000
@@ -135,16 +135,16 @@
135 except KeyError:135 except KeyError:
136 self.user_can_sudo = False136 self.user_can_sudo = False
137137
138 def print_spelling_suggestion(self, word, min_len=3, max_len=15):138 def print_spelling_suggestion(self, word, min_len=3, max_len=256, max_alt=15):
139 " try to correct the spelling "139 " try to correct the spelling "
140 if len(word) < min_len:140 if not (min_len <= len(word) <= max_len):
141 return141 return
142 possible_alternatives = []142 possible_alternatives = []
143 for w in similar_words(word):143 for w in similar_words(word):
144 packages = self.getPackages(w)144 packages = self.getPackages(w)
145 for (package, comp) in packages:145 for (package, comp) in packages:
146 possible_alternatives.append((w, package, comp))146 possible_alternatives.append((w, package, comp))
147 if len(possible_alternatives) > max_len:147 if len(possible_alternatives) > max_alt:
148 print(_("No command '%s' found, but there are %s similar ones") % (word, len(possible_alternatives)), file=sys.stderr)148 print(_("No command '%s' found, but there are %s similar ones") % (word, len(possible_alternatives)), file=sys.stderr)
149 elif len(possible_alternatives) > 0:149 elif len(possible_alternatives) > 0:
150 print(_("No command '%s' found, did you mean:") % word, file=sys.stderr)150 print(_("No command '%s' found, did you mean:") % word, file=sys.stderr)

Subscribers

People subscribed via source and target branches